:root {
  color-scheme: light;
  --ink: #09204f;
  --muted: #5d6e96;
  --blue: #1769e8;
  --gold: #ffc844;
  --paper: rgba(255, 255, 255, 0.88);
  --line: rgba(24, 81, 164, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(235,246,255,0.78)),
    radial-gradient(circle at 18% 18%, rgba(255, 211, 91, 0.35), transparent 28%),
    radial-gradient(circle at 83% 14%, rgba(58, 153, 255, 0.28), transparent 32%),
    linear-gradient(135deg, #dff0ff, #fff6dc);
}

.app-shell {
  width: min(1500px, 100vw);
  height: 100vh;
  margin: 0 auto;
  padding: 22px 28px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
}

.topbar,
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1;
  color: var(--ink);
}

.actions {
  display: flex;
  gap: 10px;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.icon-btn,
.control-btn,
.primary-btn {
  min-width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(8, 39, 95, 0.12);
}

.icon-btn {
  font-size: 24px;
  font-weight: 900;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  border-radius: 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.film-rail {
  position: absolute;
  inset: 8% 0;
  background:
    repeating-linear-gradient(90deg, rgba(9, 32, 79, 0.16) 0 12px, transparent 12px 32px) top / 100% 18px no-repeat,
    repeating-linear-gradient(90deg, rgba(9, 32, 79, 0.16) 0 12px, transparent 12px 32px) bottom / 100% 18px no-repeat,
    linear-gradient(90deg, transparent, rgba(3, 21, 55, 0.08), transparent);
  border-radius: 26px;
  pointer-events: none;
}

.card-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  perspective: 1300px;
  transform-style: preserve-3d;
  touch-action: pan-y;
  user-select: none;
}

.word-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 980px);
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 34px 80px rgba(7, 25, 68, 0.26),
    0 0 0 1px rgba(23, 105, 232, 0.10);
  transform-style: preserve-3d;
  transition: transform 280ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease, filter 220ms ease;
}

.word-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  background: #fff;
  pointer-events: none;
}

.audio-hotspot {
  position: absolute;
  left: 8%;
  top: 8%;
  width: 40%;
  height: 24%;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.word-card:not(.is-current) .audio-hotspot {
  display: none;
}

.zoom-btn {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #08306f;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(23, 105, 232, 0.22);
  box-shadow: 0 10px 24px rgba(7, 25, 68, 0.18);
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.word-card:not(.is-current) .zoom-btn {
  display: none;
}

.zoom-btn:hover {
  background: #ffffff;
  transform: scale(1.05);
}

.audio-hotspot:focus-visible {
  outline: 3px solid rgba(23, 105, 232, 0.78);
  outline-offset: 3px;
}

.word-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, transparent 35%, rgba(7, 19, 50, var(--shade, 0)) 100%),
    linear-gradient(90deg, rgba(255,255,255,0.1), transparent 28%, transparent 72%, rgba(0,0,0,0.08));
  pointer-events: none;
}

.word-card.is-current {
  box-shadow:
    0 42px 100px rgba(3, 23, 69, 0.34),
    0 0 0 3px rgba(255, 200, 68, 0.9),
    0 0 34px rgba(23, 105, 232, 0.18);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.control-btn,
.primary-btn {
  min-width: 118px;
  padding: 0 20px;
  font-weight: 800;
}

.primary-btn {
  min-width: 150px;
  color: white;
  background: linear-gradient(135deg, #1769e8, #063d9f);
}

.statusbar {
  min-height: 32px;
  color: var(--muted);
  font-weight: 800;
}

#wordLabel {
  color: var(--ink);
  font-size: 20px;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 10, 30, 0.78);
}

.viewer[hidden] {
  display: none;
}

.viewer-frame {
  position: relative;
  display: inline-block;
  max-width: 96vw;
  max-height: 92vh;
}

.viewer img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 36px 120px rgba(0,0,0,0.5);
  display: block;
}

.viewer-audio-hotspot {
  position: absolute;
  left: 8%;
  top: 8%;
  width: 40%;
  height: 24%;
  border-radius: 18px;
  background: transparent;
  z-index: 2;
  cursor: pointer;
}

.viewer-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,0.16);
  font-size: 34px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

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

  .app-shell {
    height: 100dvh;
    padding: 14px;
  }

  .word-card {
    width: 88vw;
  }

  .card-stage {
    min-height: 420px;
  }

  .control-btn,
  .primary-btn {
    min-width: 94px;
    padding: 0 12px;
  }
}
