:root {
  --navy-950: #0d162a;
  --navy-900: #111d35;
  --navy-800: #172642;
  --ink: #17233b;
  --muted: #76819a;
  --line: #e7ebf2;
  --paper: #f7f8fc;
  --white: #ffffff;
  --coral: #f46f5f;
  --coral-dark: #df5c4d;
  --yellow: #ffca58;
  --mint: #74d7bd;
  --shadow: 0 28px 70px rgba(19, 32, 59, 0.13), 0 4px 12px rgba(19, 32, 59, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(1380px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 26px clamp(18px, 5vw, 78px) 20px;
  display: flex;
  flex-direction: column;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; width: 38px; height: 38px; place-items: center;
  color: var(--white); background: var(--coral); border-radius: 12px 12px 12px 3px;
  font: 900 23px/1 "Outfit", sans-serif; transform: rotate(-6deg);
}
.brand strong { display: block; letter-spacing: .14em; font: 900 16px/1 "Outfit", sans-serif; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.topbar-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.live-dot { width: 7px; height: 7px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 4px rgba(116, 215, 189, .15); }

.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(270px, .75fr) minmax(540px, 1.25fr);
  align-items: center;
  gap: clamp(40px, 8vw, 118px);
  padding: clamp(42px, 8vh, 100px) 0 clamp(40px, 8vh, 82px);
}

.intro-panel { max-width: 385px; }
.eyebrow { display: flex; align-items: center; gap: 11px; color: var(--coral-dark); font: 800 11px/1 "Outfit", sans-serif; letter-spacing: .18em; }
.eyebrow-line { width: 27px; height: 2px; background: var(--coral); }
h1 { margin: 22px 0 20px; color: var(--navy-950); font-size: clamp(42px, 5vw, 70px); font-weight: 900; letter-spacing: -.055em; line-height: 1.08; }
h1 em { color: var(--coral); font-style: normal; }
.intro-copy { margin: 0; color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); line-height: 1.9; white-space: pre-line; }

.how-to-play { margin-top: 39px; padding: 18px 0 19px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.how-to-play-title { margin-bottom: 14px; color: var(--navy-900); font-size: 13px; font-weight: 800; }
.rule-row { display: flex; align-items: baseline; gap: 12px; margin: 9px 0; color: #69758f; font-size: 12px; line-height: 1.6; }
.rule-number { min-width: 24px; color: var(--coral); font: 700 11px/1 "Outfit", sans-serif; letter-spacing: .05em; }

.score-card { display: flex; align-items: center; justify-content: space-between; margin-top: 25px; padding: 16px 19px; color: var(--white); background: var(--navy-900); border-radius: 14px; }
.score-label { display: block; color: #9eabc5; font-size: 11px; }
.score-card strong { display: block; margin-top: 2px; font: 800 25px/1 "Outfit", sans-serif; letter-spacing: .06em; }
.trophy { display: grid; width: 36px; height: 36px; place-items: center; color: var(--yellow); border: 1px solid rgba(255, 202, 88, .35); border-radius: 50%; font-size: 18px; }

.game-card { position: relative; min-width: 0; padding: clamp(18px, 3vw, 32px); background: var(--white); border-radius: 24px; box-shadow: var(--shadow); }
.game-card-topline, .progress-labels { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.game-card-topline { margin-bottom: 19px; }
.question-count { color: var(--navy-900); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.question-count strong { color: var(--coral); font: 800 17px/1 "Outfit", sans-serif; }
.question-count i { color: #a6aec0; font-style: normal; font-weight: 500; }
.score-lives-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 1px 17px; color: #95a0b4; font-size: 10px; font-weight: 700; }
.score-lives-row strong { margin-left: 5px; color: var(--navy-900); font: 800 15px/1 "Outfit", sans-serif; letter-spacing: .04em; }
.lives-display strong { color: var(--coral); letter-spacing: .12em; }
.player-profile { margin: 0 1px 17px; padding: 12px 13px; background: #fafbfc; border: 1px solid #edf0f5; border-radius: 11px; }
.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.profile-heading strong { color: var(--navy-900); font-size: 11px; font-weight: 800; }
.profile-heading span { color: #a2abbb; font-size: 9px; font-weight: 600; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.profile-grid label { color: #8e99ad; font-size: 9px; font-weight: 700; }
.profile-grid input { display: block; width: 100%; height: 36px; margin-top: 5px; padding: 0 10px; color: var(--ink); background: var(--white); border: 1px solid #dfe4ed; border-radius: 8px; outline: none; font-size: 12px; }
.profile-grid input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(244, 111, 95, .1); }
.profile-grid input:disabled { cursor: not-allowed; opacity: .65; }
.profile-hint { margin: 8px 0 0; color: #a0a9ba; font-size: 9px; line-height: 1.5; }
.profile-hint.error { color: var(--coral-dark); font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: #8a96ab; background: #f5f7fb; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-dot { width: 6px; height: 6px; background: #b9c1cf; border-radius: 50%; }
.status-pill.playing { color: #197d68; background: #e8f8f3; }
.status-pill.playing .status-dot { background: var(--mint); box-shadow: 0 0 0 3px rgba(116, 215, 189, .2); }
.status-pill.success { color: #a36903; background: #fff5dc; }
.status-pill.success .status-dot { background: var(--yellow); }
.status-pill.failed { color: #b2493f; background: #fff0ee; }
.status-pill.failed .status-dot { background: var(--coral); }

.image-stage { position: relative; overflow: hidden; aspect-ratio: 1.45 / 1; background: #cbd1da; border-radius: 16px; isolation: isolate; }
.image-base, .image-reveal, .image-reveal img { position: absolute; inset: 0; width: 100%; height: 100%; }
.image-base { object-fit: cover; filter: blur(17px) saturate(.72); transform: scale(1.08); opacity: .75; }
.image-tint { position: absolute; inset: 0; z-index: 1; background: linear-gradient(135deg, rgba(19, 31, 53, .6), rgba(38, 48, 69, .2)); }
.image-reveal { z-index: 2; clip-path: inset(48% 48% 48% 48% round 18px); transition: clip-path 180ms linear; }
.image-reveal::after { position: absolute; inset: 0; content: ""; border: 2px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(13, 22, 42, .12); pointer-events: none; }
.image-reveal img { object-fit: cover; }
.stage-center-message { position: absolute; z-index: 3; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; gap: 4px; width: max-content; max-width: calc(100% - 32px); color: var(--white); text-align: center; transform: translate(-50%, -50%); pointer-events: none; text-shadow: 0 2px 10px rgba(0, 0, 0, .28); transition: opacity .25s ease; }
.stage-center-message strong { font-size: clamp(15px, 2vw, 19px); font-weight: 800; }
.stage-center-message span:last-child { font-size: 11px; opacity: .8; }
.lock-icon { display: grid; width: 39px; height: 39px; place-items: center; margin-bottom: 5px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 50%; font-size: 24px; line-height: 1; transform: rotate(90deg); }
.stage-badge { position: absolute; z-index: 4; right: 13px; bottom: 13px; padding: 6px 9px; color: var(--white); background: rgba(13, 22, 42, .65); border: 1px solid rgba(255, 255, 255, .22); border-radius: 7px; font: 700 11px/1 "Outfit", sans-serif; backdrop-filter: blur(8px); }
.life-penalty { position: absolute; z-index: 8; left: 50%; top: 50%; display: flex; align-items: center; gap: 10px; min-width: 154px; padding: 12px 15px; color: var(--white); background: linear-gradient(135deg, #eb6254, #bd3e4e); border: 1px solid rgba(255, 255, 255, .35); border-radius: 13px; box-shadow: 0 15px 35px rgba(106, 27, 45, .32); opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, -50%) scale(.7); }
.life-penalty.show { animation: life-penalty-pop 1.15s ease both; }
.penalty-icon { display: grid; width: 26px; height: 26px; place-items: center; color: #ffd3c9; background: rgba(255, 255, 255, .15); border-radius: 50%; font-size: 14px; }
.life-penalty strong { display: block; font-size: 14px; font-weight: 900; white-space: nowrap; }
.life-penalty small { display: block; margin-top: 2px; color: rgba(255, 255, 255, .8); font-size: 9px; font-weight: 600; white-space: nowrap; }
@keyframes life-penalty-pop { 0% { opacity: 0; visibility: visible; transform: translate(-50%, -50%) scale(.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 30% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; transform: translate(-50%, -57%) scale(1); } 100% { opacity: 0; visibility: hidden; transform: translate(-50%, -65%) scale(.94); } }

.game-info { display: flex; align-items: end; gap: 27px; margin: 20px 2px 0; }
.timer-block { min-width: 96px; padding-right: 20px; border-right: 1px solid var(--line); }
.info-label, .answer-form label { display: block; color: #95a0b4; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.timer-block strong { color: var(--navy-900); font: 800 29px/1.15 "Outfit", sans-serif; letter-spacing: .02em; }
.timer-block .unit { color: #8792a9; font-size: 11px; }
.progress-block { flex: 1; min-width: 0; padding-bottom: 2px; }
.progress-labels { margin-bottom: 9px; color: #8c97ab; font-size: 10px; font-weight: 600; }
.progress-labels strong { color: var(--coral); font: 800 12px/1 "Outfit", sans-serif; }
.progress-track { height: 7px; overflow: hidden; background: #edf0f5; border-radius: 99px; }
.progress-track span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--coral), #ff9c6b); border-radius: inherit; transition: width 180ms linear; }

.answer-form { margin-top: 24px; }
.answer-input-row { display: flex; gap: 9px; margin-top: 8px; }
.answer-input-row input { min-width: 0; flex: 1; height: 47px; padding: 0 15px; color: var(--ink); background: #fafbfc; border: 1px solid #dfe4ed; border-radius: 11px; outline: none; font-size: 14px; transition: border-color .2s ease, box-shadow .2s ease; }
.answer-input-row input::placeholder { color: #b2b9c8; }
.answer-input-row input:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(244, 111, 95, .12); }
.answer-input-row input:disabled { cursor: not-allowed; opacity: .7; }
.submit-button { flex: 0 0 auto; height: 47px; padding: 0 18px; color: var(--white); background: var(--navy-900); border: 0; border-radius: 11px; cursor: pointer; font-size: 12px; font-weight: 800; transition: transform .2s ease, background .2s ease, opacity .2s ease; }
.submit-button span { display: inline-block; margin-left: 8px; font-size: 16px; vertical-align: -1px; }
.submit-button:not(:disabled):hover { background: var(--coral-dark); transform: translateY(-1px); }
.submit-button:disabled { cursor: not-allowed; opacity: .38; }
.answer-hint { min-height: 18px; margin: 8px 0 0; color: #9da6b8; font-size: 10px; }

.action-row { display: flex; align-items: center; gap: 15px; margin-top: 9px; }
.start-button { flex: 1; min-height: 51px; padding: 0 18px; color: var(--white); background: var(--coral); border: 0; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 800; box-shadow: 0 8px 18px rgba(244, 111, 95, .2); transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.start-button:hover { background: var(--coral-dark); box-shadow: 0 11px 22px rgba(244, 111, 95, .28); transform: translateY(-2px); }
.start-button:active, .submit-button:active { transform: translateY(0); }
.start-button:disabled { cursor: default; opacity: .85; }
.button-arrow { float: right; font-size: 20px; font-weight: 500; line-height: 1; }
.reset-button { padding: 12px 3px; color: #99a3b4; background: none; border: 0; cursor: pointer; font-size: 11px; font-weight: 700; }
.reset-button:hover { color: var(--coral-dark); }
.feedback { min-height: 24px; margin-top: 12px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 700; }
.feedback.success { color: #16836c; }
.feedback.failed { color: var(--coral-dark); }
.result-screen { position: absolute; z-index: 20; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 34px; color: var(--white); text-align: center; background: linear-gradient(145deg, rgba(17, 29, 53, .98), rgba(32, 47, 78, .98)); border-radius: 24px; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px) scale(.98); transition: opacity .28s ease, transform .28s ease, visibility .28s ease; }
.result-screen.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.result-screen.success { background: linear-gradient(145deg, #123f42, #116d68); }
.result-kicker { color: #ffb07c; font: 800 11px/1 "Outfit", sans-serif; letter-spacing: .22em; }
.result-screen.success .result-kicker { color: #a6f0d9; }
.result-screen h2 { margin: 16px 0 9px; font-size: clamp(30px, 5vw, 46px); font-weight: 900; letter-spacing: -.05em; }
.result-score-label { color: rgba(255, 255, 255, .67); font-size: 11px; font-weight: 600; }
.result-score { margin-top: 5px; font: 900 clamp(55px, 10vw, 86px)/.95 "Outfit", sans-serif; letter-spacing: .04em; }
.result-screen p { max-width: 420px; margin: 17px 0 0; color: rgba(255, 255, 255, .74); font-size: 11px; line-height: 1.8; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-top: 17px; color: #a3acbc; border-top: 1px solid var(--line); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.footer span:first-child { color: var(--coral); font-family: "Outfit", sans-serif; font-weight: 800; letter-spacing: .14em; }

@media (max-width: 900px) {
  .app-shell { max-width: 720px; }
  .game-layout { grid-template-columns: 1fr; gap: 34px; padding-top: 50px; }
  .intro-panel { max-width: none; }
  .intro-panel h1 br { display: none; }
  .intro-copy { line-height: 1.7; }
  .how-to-play { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 27px; padding: 15px 0; }
  .how-to-play-title { grid-column: 1 / -1; margin: 0; }
  .rule-row { display: block; margin: 0; font-size: 11px; }
  .rule-number { display: block; margin-bottom: 5px; }
  .score-card { display: none; }
  .game-card { padding: 24px; }
}

@media (max-width: 560px) {
  .app-shell { padding: 17px 14px max(17px, env(safe-area-inset-bottom)); }
  .topbar-note { font-size: 0; }
  .topbar-note .live-dot { width: 8px; height: 8px; }
  .game-layout { gap: 25px; padding-top: 35px; }
  h1 { margin-top: 17px; font-size: clamp(37px, 12vw, 52px); }
  .desktop-break { display: none; }
  .how-to-play { grid-template-columns: 1fr; gap: 8px; margin-top: 23px; }
  .rule-row { display: flex; margin: 0; }
  .rule-number { display: inline; margin: 0; }
  .game-card { padding: 15px; border-radius: 19px; }
  .result-screen { border-radius: 19px; }
  .game-card-topline { margin-bottom: 13px; }
  .profile-grid { grid-template-columns: 1fr; gap: 7px; }
  .image-stage { aspect-ratio: 1 / 1; border-radius: 13px; }
  .image-reveal::after { border-radius: 13px; }
  .stage-center-message strong { font-size: 14px; }
  .stage-center-message span:last-child { font-size: 10px; }
  .game-info { gap: 14px; margin-top: 15px; }
  .timer-block { min-width: 85px; padding-right: 14px; }
  .timer-block strong { font-size: 26px; }
  .answer-input-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .answer-input-row input, .submit-button { width: 100%; height: 48px; }
  .action-row { margin-top: 4px; }
  .start-button { min-height: 48px; }
  .footer { flex-direction: column; align-items: flex-start; padding-top: 13px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
