:root {
  --wall: #1c2b31;
  --wall-2: #24383f;
  --ink: #e7eef0;
  --muted: #9eb0b6;
  --line: #3e5860;
  --led: #f0b429;
  --paper: #e7eef1;
  --paper-ink: #1a2a30;
  --wood: #5c3d2e;
  --good: #1f7a52;
  --bad: #b64040;
  --sans: "PingFang TC", "Noto Sans TC", "Heiti TC", sans-serif;
  --kai: "Kaiti TC", "BiauKai", "DFKai-SB", "Kaiti SC", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2d4650 0%, transparent 55%),
    var(--wall);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

button, select, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--led);
  outline-offset: 2px;
}

.top, main {
  width: min(760px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px 0 8px;
}

h1 {
  margin: 0;
  font-family: var(--kai);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

.timbre {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

select, input[type="text"], input[type="date"], input[inputmode="numeric"], #seed, #melody-input {
  background: var(--wall);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
  min-height: 40px;
}

.panel, .stage, .daily {
  margin-top: 18px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.controls label, .daily-head label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

#seed { width: 7rem; }

.controls button, .text-btn, .melody-form button, .daily-play {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  min-height: 40px;
  padding: 8px 14px;
}

.controls button {
  background: var(--led);
  color: #1c1404;
  border-color: #d7a020;
  font-weight: 600;
}

#reveal {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 400;
}

#reveal:disabled { opacity: 0.4; cursor: not-allowed; }

.rule, .qid, .status, .custom-label {
  color: var(--muted);
  font-size: 14px;
}

.rule { margin: 12px 0 0; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 12px;
}

.transport {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.cone {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%,
      #142026 0 7px,
      #c5d0d4 8px 9px,
      #7f949b 10px 28px,
      #d7e0e4 29px 31px,
      #5f767d 32px 52px,
      #e7eef0 53px 55px,
      #4e666e 56px 74px,
      #d5dee2 75px);
  box-shadow:
    inset 0 0 0 10px #162328,
    0 0 0 1px #0e171b;
}

.transport.is-playing .cone {
  box-shadow:
    inset 0 0 0 10px #162328,
    0 0 0 3px var(--led);
}

.transport-label {
  font-family: var(--kai);
  font-size: 28px;
  line-height: 1;
}

.prompt {
  margin: 8px 0 0;
  font-family: var(--kai);
  font-size: 28px;
  line-height: 1.35;
  max-width: 38rem;
}

.qid { margin: 4px 0 0; min-height: 1.2em; }

#custom {
  margin-top: 12px;
  max-width: 40rem;
}

.custom-notes {
  margin: 0;
  font-size: 18px;
  word-break: break-word;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  max-width: 40rem;
}

.choice, .melody-form button {
  background: var(--wall-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  min-height: 40px;
  padding: 6px 10px;
}

.choice.is-right {
  background: var(--good);
  border-color: var(--good);
  color: white;
}

.choice.is-wrong {
  background: var(--bad);
  border-color: var(--bad);
  color: white;
}

.melody-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-top: 16px;
}

.melody-form label {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 14px;
}

#melody-input { min-width: min(100%, 16rem); }

.verdict {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-family: var(--kai);
  font-size: 22px;
}

.answer {
  width: min(100%, 640px);
  margin-top: 8px;
  padding: 16px 16px 12px;
  background: var(--paper);
  color: var(--paper-ink);
}

.answer-label {
  margin: 0;
  font-family: var(--kai);
  font-size: 32px;
  line-height: 1.25;
}

.solfege, .answer-detail, .answer-notes {
  margin: 6px 0 0;
}

.answer-notes { letter-spacing: 0.02em; }

.fret-list {
  margin: 12px 0 0;
  padding-left: 1.2em;
}

.fret-list li { margin: 2px 0; }

.fretboard {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 8px;
}

.daily { padding-bottom: 48px; }

.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

h2 {
  margin: 0;
  font-family: var(--kai);
  font-size: 32px;
  font-weight: 400;
}

.daily-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.daily-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas:
    "play no type"
    "play no prompt";
  column-gap: 12px;
  row-gap: 0;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.daily-play { grid-area: play; }
.daily-no { grid-area: no; color: var(--muted); width: 1.2em; }
.daily-type { grid-area: type; }
.daily-prompt { grid-area: prompt; color: var(--muted); font-size: 14px; }

.daily-item.is-current .daily-type { color: var(--led); }

.status { min-height: 1.2em; }

@media (max-width: 640px) {
  h1 { font-size: 40px; }
  .top { flex-direction: column; align-items: flex-start; }
  .cone { width: 120px; height: 120px; }
  .prompt { font-size: 24px; }
  .daily-item {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "play type"
      "play prompt";
  }
  .daily-no { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
