:root {
  color-scheme: dark;
  --ink: #11131f;
  --paper: #fffaf2;
  --panel: rgba(15, 17, 31, 0.72);
  --panel-strong: rgba(255, 250, 242, 0.14);
  --line: rgba(255, 255, 255, 0.22);
  --text: #fffaf2;
  --muted: rgba(255, 250, 242, 0.72);
  --coral: #ff7f6e;
  --aqua: #44d7d2;
  --yellow: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(17, 19, 31, 0.82), rgba(17, 19, 31, 0.2) 48%, rgba(17, 19, 31, 0.84)),
    url("assets/bg/city-pop-rhythm.png") center / cover fixed,
    #171421;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 32px);
  display: grid;
  place-items: center;
  align-content: start;
  gap: clamp(28px, 6vw, 72px);
}

.stage {
  width: min(1440px, 100%);
  min-height: calc(100vh - clamp(32px, 6vw, 64px));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.stage.is-playing .flip-card {
  animation: pop-card 360ms ease-out;
}

.top-bar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  background: rgba(17, 19, 31, 0.7);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.eyebrow,
.hint,
.card-caption {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(1.65rem, 3vw, 3rem);
  line-height: 1;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.recent-panel button {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.13);
  cursor: pointer;
  text-decoration: none;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

.icon-button svg path {
  vector-effect: non-scaling-stroke;
}

.icon-button .mail-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.recent-panel button:hover {
  background: rgba(68, 215, 210, 0.24);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(320px, 1fr) minmax(220px, 280px);
  gap: 18px;
  align-items: stretch;
}

.info-panel,
.recent-panel {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #8a8f9d;
  box-shadow: 0 0 0 5px rgba(138, 143, 157, 0.12);
}

.status-dot.ready {
  background: var(--aqua);
  box-shadow: 0 0 0 5px rgba(68, 215, 210, 0.14);
}

.status-dot.error {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(255, 127, 110, 0.14);
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  padding: 0 12px;
  outline: none;
}

.field .input-with-icon {
  position: relative;
}

.field .input-with-icon input {
  padding-right: 44px;
}

.field .input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: currentColor;
  opacity: 0.72;
  pointer-events: none;
}

.field-hint {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
}

.field input:invalid {
  border-color: #ff7f6e;
}

.field .input-with-icon input:invalid + .input-icon,
.field .input-with-icon input:invalid ~ .input-icon {
  color: #ff7f6e;
}

.field--email {
  padding: 16px 18px 18px;
  border: 1px solid rgba(255, 127, 110, 0.55);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.field--email span:first-child {
  display: block;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.88);
}

.field--email .input-with-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  overflow: hidden;
}

.field--email input {
  border: none;
  background: transparent;
  min-height: 60px;
  padding: 16px 48px 16px 18px;
  font-size: 1rem;
}

.field--email input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.field--email input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(68, 215, 210, 0.8);
}

.field--email .input-with-icon input:invalid {
  box-shadow: inset 0 0 0 1px #ff7f6e;
}

.field--email .input-icon {
  right: 16px;
}

.field--email .field-hint {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.63);
}

.field textarea {
  min-height: 132px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.field option {
  color: var(--ink);
}

.contact-section {
  width: min(960px, 100%);
  min-height: calc(100vh - clamp(32px, 6vw, 64px));
  display: grid;
  align-items: center;
  scroll-margin-top: 20px;
}

.contact-inner {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: clamp(22px, 5vw, 56px);
  padding: clamp(22px, 5vw, 48px);
  border: 1px solid var(--line);
  background: rgba(17, 19, 31, 0.54);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.contact-copy h2 {
  margin: 8px 0 14px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
}

.contact-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.contact-form {
  display: grid;
}

.anti-spam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.captcha-image {
  width: 180px;
  height: 58px;
  max-width: 100%;
  border-radius: 18px;
  overflow: visible;
}

.captcha-image rect {
  fill: rgba(255, 255, 255, 0.14);
  stroke: rgba(255, 255, 255, 0.18);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.18));
}

.captcha-image path {
  fill: none;
  stroke: rgba(255, 209, 102, 0.7);
  stroke-width: 2;
}

.captcha-image .captcha-code text {
  fill: var(--text);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.captcha-image .captcha-code text:nth-child(odd) {
  opacity: 0.95;
}

.captcha-image .captcha-code text:nth-child(even) {
  opacity: 0.85;
}

.captcha-canvas {
  width: 220px;
  height: 80px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  background: transparent;
}

.captcha-refresh {
  height: 36px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
}

.captcha-refresh:hover {
  background: rgba(68,215,210,0.08);
}

.contact-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.text-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 250, 242, 0.1);
  cursor: pointer;
}

.text-button.primary {
  border-color: rgba(68, 215, 210, 0.7);
  background: rgba(68, 215, 210, 0.24);
}

.text-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.form-status {
  margin: 12px 0 0;
  color: var(--aqua);
}

.form-status.error {
  color: var(--coral);
}

.contact-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}

.metric-grid div {
  min-height: 82px;
  padding: 12px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.metric-grid strong {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  line-height: 1;
}

.metric-grid span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

.card-zone {
  min-height: 680px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
}

.flip-card {
  width: min(420px, 82vw);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1400px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.card-inner.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 10px solid var(--paper);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  backface-visibility: hidden;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(17, 19, 31, 0.2);
}

.card-back {
  transform: rotateY(180deg);
}

.card-face img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fallback-card {
  width: 100%;
  height: 100%;
  padding: clamp(20px, 4vw, 34px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  text-align: center;
  background: var(--paper);
}

.corner {
  position: absolute;
  top: 18px;
  left: 18px;
  min-width: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 800;
}

.staff-notation {
  width: min(100%, 360px);
  margin-top: 2px;
  overflow: visible;
}

.clef-mark {
  fill: var(--ink);
  font-family: "Noto Music", "Segoe UI Symbol", "Arial Unicode MS", serif;
  font-size: 82px;
  dominant-baseline: central;
  text-anchor: middle;
}

.staff-lines line,
.ledger-lines line,
.note-stem {
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: square;
}

.ledger-lines line {
  stroke-width: 2.8;
}

.note-head {
  fill: var(--ink);
}

.accidental {
  fill: var(--ink);
  font-size: 48px;
  font-weight: 800;
  dominant-baseline: middle;
  text-anchor: middle;
}

.octave-mark text {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  text-anchor: middle;
}

.octave-mark.above text {
  dominant-baseline: auto;
}

.octave-mark.below text {
  dominant-baseline: text-after-edge;
}

.theory-symbol {
  width: min(100%, 320px);
  min-height: 260px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  border: 3px solid var(--ink);
  background:
    linear-gradient(var(--ink) 0 0) 50% 36% / 78% 2px no-repeat,
    linear-gradient(var(--ink) 0 0) 50% 43% / 78% 2px no-repeat,
    linear-gradient(var(--ink) 0 0) 50% 50% / 78% 2px no-repeat,
    linear-gradient(var(--ink) 0 0) 50% 57% / 78% 2px no-repeat,
    linear-gradient(var(--ink) 0 0) 50% 64% / 78% 2px no-repeat,
    rgba(255, 255, 255, 0.58);
}

.theory-symbol.plain-symbol {
  border: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(68, 215, 210, 0.16), transparent 58%),
    rgba(255, 255, 255, 0.5);
}

.theory-symbol.plain-symbol span {
  font-size: clamp(7rem, 22vw, 12rem);
}

.theory-symbol span {
  display: block;
  color: var(--ink);
  font-family: "Noto Music", "Segoe UI Symbol", "Arial Unicode MS", serif;
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 800;
  line-height: 1;
}

.theory-symbol.tenor-clef span {
  transform: translateY(24px);
}

.fallback-card h2 {
  max-width: 88%;
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
}

.fallback-card p {
  margin: 0;
  color: #5c6070;
  font-weight: 700;
}

.back-fallback {
  align-content: start;
  justify-items: stretch;
  padding-top: 74px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 127, 110, 0.2), rgba(68, 215, 210, 0.18)),
    var(--paper);
}

.back-fallback h2 {
  max-width: none;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--ink);
}

.back-fallback dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.back-fallback div {
  padding: 12px;
  border: 2px solid rgba(17, 19, 31, 0.18);
  background: rgba(255, 255, 255, 0.58);
}

.back-fallback dt {
  margin-bottom: 5px;
  font-weight: 900;
}

.back-fallback dd {
  margin: 0;
  line-height: 1.55;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.recent-panel ol {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.recent-panel li {
  min-height: 54px;
  padding: 10px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  cursor: pointer;
}

.recent-panel li:hover {
  border-color: rgba(68, 215, 210, 0.7);
}

.recent-panel li span {
  min-height: 34px;
  display: grid;
  place-items: center;
  background: rgba(255, 209, 102, 0.18);
  color: var(--yellow);
  font-weight: 800;
}

.recent-panel li strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes pop-card {
  0% {
    transform: translateY(12px) scale(0.94);
    opacity: 0.72;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .play-area {
    grid-template-columns: 1fr;
  }

  .card-zone {
    min-height: auto;
    order: -1;
    padding: 22px 0;
  }

  .info-panel,
  .recent-panel {
    min-height: 0;
  }

  .contact-inner {
    grid-template-columns: 1fr;
  }

  .anti-spam-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls {
    width: 100%;
    justify-content: stretch;
  }

  .icon-button {
    flex: 1;
  }

  .flip-card {
    width: min(350px, 88vw);
  }
}
