:root {
  --bg-0: #0f172a;
  --bg-1: #111827;
  --panel: #1f2937;
  --wood-0: #f2c57c;
  --wood-1: #c68b45;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #22d3ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, #1e293b 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, #0ea5e9 0%, transparent 38%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1));
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  width: min(1180px, 98vw);
  height: calc(100vh - 8px);
  margin: 4px auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  background: rgba(34, 211, 238, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.36);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 10px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.board-wrap {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  padding: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

canvas {
  display: block;
  flex: 0 0 auto;
  align-self: center;
  touch-action: manipulation;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.38);
  background: linear-gradient(160deg, var(--wood-0), var(--wood-1));
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.card {
  background: rgba(31, 41, 55, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  flex-shrink: 0;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

label {
  display: block;
  margin-top: 6px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="text"],
input[type="range"],
button {
  width: 100%;
}

select,
input[type="text"],
button {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #0b1220;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

button {
  margin-top: 6px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  border-color: rgba(34, 211, 238, 0.66);
}

button.secondary {
  background: #0a2230;
}

.range-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.audio-tip {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.hidden {
  display: none;
}

.stats {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.stats li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.28);
  padding-bottom: 6px;
}

@media (max-width: 960px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    width: min(100vw, 1180px);
    margin: 0 auto;
    padding: 8px 8px 12px;
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }

  .status-pill {
    width: 100%;
    text-align: center;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .board-wrap {
    min-height: min(66vh, 560px);
    padding: 8px;
  }

  .panel {
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 18px;
  }

  .subtitle {
    font-size: 11px;
  }

  .card {
    padding: 9px 10px;
  }

  .inline-actions {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stats li {
    font-size: 13px;
  }
}
