:root {
  --pts-navy-950: #030914;
  --pts-navy-900: #061626;
  --pts-navy-800: #09233a;
  --pts-navy-700: #0e3558;
  --pts-blue: #118cff;
  --pts-cyan: #4fd8ff;
  --pts-mint: #47e6a1;
  --pts-yellow: #ffd76a;
  --pts-red: #ff6b7a;
  --text: #f3fbff;
  --muted: #a9c2d8;
  --panel: rgba(9, 35, 58, 0.78);
  --panel-strong: rgba(10, 43, 72, 0.94);
  --line: rgba(255, 255, 255, 0.13);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius-xl: 30px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html { touch-action: manipulation; }
body {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(17, 140, 255, 0.34), transparent 32rem),
    radial-gradient(circle at 88% 16%, rgba(79, 216, 255, 0.22), transparent 28rem),
    linear-gradient(180deg, var(--pts-navy-900), var(--pts-navy-950));
  overflow-x: hidden;
}
button, input { font: inherit; font-size: 16px; }
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }

.bg-orbs span {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.18;
  pointer-events: none;
  background: var(--pts-blue);
  animation: floaty 9s ease-in-out infinite alternate;
}
.bg-orbs span:nth-child(1) { left: -8rem; top: 10rem; }
.bg-orbs span:nth-child(2) { right: -9rem; top: 28rem; background: var(--pts-cyan); animation-delay: -2s; }
.bg-orbs span:nth-child(3) { left: 30%; bottom: -10rem; background: var(--pts-mint); animation-delay: -4s; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}
.screen { width: 100%; }
.glass-card {
  background: linear-gradient(180deg, rgba(16, 48, 79, 0.86), rgba(5, 18, 33, 0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.brand-row { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.brand-mark {
  width: 62px; height: 62px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--pts-blue), #064179);
  box-shadow: 0 18px 50px rgba(17, 140, 255, 0.26);
  font-weight: 950; letter-spacing: 0.08em;
}
.eyebrow { color: var(--pts-cyan); text-transform: uppercase; letter-spacing: 0.13em; font-size: 0.72rem; font-weight: 850; }
h1 { margin: 4px 0 0; font-size: clamp(2rem, 8vw, 3.15rem); line-height: 0.96; letter-spacing: -0.04em; }
h2 { margin: 4px 0 8px; font-size: clamp(1.35rem, 5vw, 2rem); line-height: 1.06; letter-spacing: -0.03em; }
h3 { margin: 0 0 10px; font-size: 1.35rem; }
p { color: var(--muted); line-height: 1.45; }

.intro-card { padding: 18px; display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.intro-card p { margin: 0; font-size: 1rem; }
.intro-clock { min-width: 112px; }
.login-form { padding: 18px; }
.login-form label, .field-title { display: block; color: var(--muted); font-weight: 800; margin: 0 0 8px; }
.login-form input {
  width: 100%; border: 1px solid rgba(255,255,255,0.14); border-radius: 18px;
  background: rgba(255,255,255,0.08); color: var(--text); outline: none;
  padding: 15px 16px; margin-bottom: 16px; font-size: 16px; -webkit-appearance: none; appearance: none;
}
.login-form input:focus { border-color: var(--pts-cyan); box-shadow: 0 0 0 4px rgba(79,216,255,0.12); }
.avatar-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.avatar-option {
  min-height: 58px; border: 1px solid rgba(255,255,255,0.12); border-radius: 18px;
  background: rgba(255,255,255,0.06); color: var(--text); font-size: 1.65rem;
}
.avatar-option.is-selected { border-color: var(--pts-cyan); background: rgba(79,216,255,0.16); box-shadow: inset 0 0 0 1px rgba(79,216,255,0.2); }
.primary-btn {
  width: 100%; border: 0; border-radius: 20px; padding: 15px 18px;
  color: white; font-weight: 950;
  background: linear-gradient(135deg, var(--pts-blue), var(--pts-cyan));
  box-shadow: 0 18px 44px rgba(17, 140, 255, 0.26);
}
.primary-btn:active, .step-btn:active, .choice-btn:active, .ghost-btn:active { transform: translateY(1px) scale(0.99); }

.game-screen { display: grid; gap: 12px; }
.game-header { padding: 12px; display: flex; align-items: center; justify-content: space-between; }
.player-chip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar-bubble {
  width: 50px; height: 50px; border-radius: 18px; display: grid; place-items: center; font-size: 1.75rem;
  background: linear-gradient(145deg, rgba(79,216,255,0.16), rgba(17,140,255,0.08));
  border: 1px solid rgba(255,255,255,0.10);
}
.icon-btn {
  width: 46px; height: 46px; border: 1px solid rgba(255,255,255,0.12); border-radius: 16px;
  background: rgba(255,255,255,0.07); color: var(--text); font-size: 1.2rem;
}
.stats-card { padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px; border-radius: 18px; background: rgba(255,255,255,0.06); }
.stat span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 800; }
.stat strong { display: block; margin-top: 2px; font-size: 1.1rem; }
.xp-wrap { grid-column: 1 / -1; height: 12px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,0.08); }
.xp-wrap div { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--pts-blue), var(--pts-mint)); transition: width 420ms ease; }

.mission-card { padding: 14px; display: grid; grid-template-columns: 86px 1fr; gap: 14px; align-items: center; }
.character-stage { position: relative; height: 86px; display: grid; place-items: center; }
.magic-ring {
  position: absolute; width: 78px; height: 78px; border-radius: 999px;
  background: conic-gradient(from 0deg, rgba(79,216,255,0.05), rgba(79,216,255,0.5), rgba(71,230,161,0.18), rgba(79,216,255,0.05));
  animation: spin 7s linear infinite;
}
.character { position: relative; font-size: 3rem; filter: drop-shadow(0 14px 20px rgba(0,0,0,0.25)); animation: idle 2.5s ease-in-out infinite; }
.character.success { animation: bounceWin 700ms ease; }
.mission-copy p { margin: 0; font-size: 0.94rem; }

.play-card { padding: 14px; overflow: hidden; touch-action: manipulation; }
.clock-host { width: 100%; display: grid; place-items: center; }
.main-clock svg { width: min(100%, 390px); height: auto; display: block; }
.clock-svg { overflow: visible; user-select: none; touch-action: none; }
.clock-svg.interactive { cursor: grab; }
.clock-face { fill: rgba(255, 255, 255, 0.96); filter: drop-shadow(0 18px 26px rgba(0,0,0,0.24)); }
.clock-ring { fill: none; stroke: #0e3558; stroke-width: 10; }
.clock-inner { fill: #f4fbff; stroke: rgba(14,53,88,0.16); stroke-width: 2; }
.tick { stroke: #7e94a6; stroke-linecap: round; }
.tick.major { stroke: #153d63; stroke-width: 3.5; }
.tick.minor { stroke-width: 1.2; opacity: 0.55; }
.hour-number { fill: #08213a; font-weight: 950; font-size: 21px; text-anchor: middle; dominant-baseline: middle; }
.minute-number { fill: #236d9e; font-size: 10px; font-weight: 850; text-anchor: middle; dominant-baseline: middle; opacity: 0.8; }
.quarter-chip { fill: rgba(17,140,255,0.10); stroke: rgba(17,140,255,0.20); }
.quarter-label { fill: #0d4d82; font-size: 8px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; }
.hand-hour-outline { stroke: #08213a; stroke-linecap: round; stroke-width: 16; }
.hand-hour { stroke: #ffffff; stroke-linecap: round; stroke-width: 9; }
.hand-minute { stroke: #118cff; stroke-linecap: round; stroke-width: 7; }
.hand-shadow { stroke: rgba(0,0,0,0.16); stroke-linecap: round; }
.center-pin { fill: white; stroke: #118cff; stroke-width: 6; }
.clock-caption { fill: #236d9e; font-weight: 900; font-size: 10px; text-anchor: middle; dominant-baseline: middle; }

.clock-controls { margin-top: 12px; display: grid; gap: 12px; touch-action: manipulation; }
.control-row { display: grid; grid-template-columns: 74px 1fr 74px; gap: 10px; align-items: center; }
.step-btn {
  min-height: 70px;
  min-width: 70px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(79,216,255,0.20), rgba(17,140,255,0.12));
  color: var(--text);
  font-size: 2.35rem;
  line-height: 1;
  font-weight: 950;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 12px 28px rgba(0,0,0,0.14);
}
.step-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.control-value {
  min-height: 70px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.075);
  border: 1px solid rgba(255,255,255,0.10);
}
.control-value span { color: var(--muted); font-size: 0.78rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.08em; }
.control-value strong { font-size: 1.65rem; margin-top: -6px; }
.digital-display {
  justify-self: center; min-width: 152px; text-align: center; border-radius: 22px;
  background: rgba(3,9,20,0.45); border: 1px solid rgba(79,216,255,0.18);
  padding: 10px 18px; color: var(--pts-cyan); font-size: 2rem; font-weight: 950; letter-spacing: 0.02em;
  box-shadow: inset 0 0 28px rgba(79,216,255,0.05);
}

.quick-time-panel {
  display: grid;
  gap: 12px;
  border-radius: 24px;
  padding: 12px;
  background: rgba(3,9,20,0.22);
  border: 1px solid rgba(255,255,255,0.09);
  touch-action: manipulation;
}
.quick-section { display: grid; gap: 8px; }
.quick-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}
.quick-grid { display: grid; gap: 7px; }
.hour-grid { grid-template-columns: repeat(6, 1fr); }
.minute-grid { grid-template-columns: repeat(4, 1fr); }
.quick-chip {
  min-height: 46px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.075);
  color: var(--text);
  font-weight: 950;
  font-size: 1.05rem;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.quick-chip.is-selected {
  color: #061626;
  background: linear-gradient(135deg, var(--pts-yellow), var(--pts-cyan));
  border-color: rgba(255,255,255,0.42);
  box-shadow: 0 10px 24px rgba(79,216,255,0.16);
}
.quick-chip:disabled { opacity: 0.35; }

.choices { display: grid; gap: 10px; margin-top: 14px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-btn {
  border: 1px solid rgba(255,255,255,0.12); border-radius: 20px; background: rgba(255,255,255,0.08);
  color: var(--text); min-height: 74px; padding: 12px; text-align: left;
}
.choice-btn strong { display: block; font-size: 1.5rem; }
.choice-btn span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.86rem; }
.choice-btn:hover, .choice-btn:focus { outline: none; border-color: rgba(79,216,255,0.55); background: rgba(79,216,255,0.12); }
.clock-choice-btn { min-height: 160px; text-align: center; }
.clock-choice-btn .mini-clock { width: 116px; margin: 0 auto 8px; }
.clock-choice-btn strong { font-size: 1rem; }
.feedback { min-height: 44px; display: grid; place-items: center; margin-top: 12px; border-radius: 18px; padding: 10px; font-weight: 900; text-align: center; }
.feedback.ok { color: #b9ffd9; background: rgba(71,230,161,0.10); border: 1px solid rgba(71,230,161,0.18); }
.feedback.bad { color: #ffd2d7; background: rgba(255,107,122,0.10); border: 1px solid rgba(255,107,122,0.18); }

.bottom-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ghost-btn {
  border: 1px solid rgba(255,255,255,0.11); border-radius: 18px;
  background: rgba(255,255,255,0.07); color: var(--text); min-height: 48px; font-weight: 900;
}
.ghost-btn.danger { color: #ffd4d9; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,0.55); }
.modal-panel { width: min(100%, 420px); padding: 20px; }
.modal-panel p { margin: 0 0 16px; color: var(--text); }
.celebration { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti {
  position: absolute; width: 10px; height: 16px; border-radius: 4px;
  background: var(--pts-cyan);
  left: var(--x); top: -24px;
  animation: confettiFall var(--d) linear forwards;
  transform: rotate(var(--r));
}
.confetti:nth-child(3n) { background: var(--pts-blue); }
.confetti:nth-child(3n+1) { background: var(--pts-mint); }
.confetti:nth-child(3n+2) { background: var(--pts-yellow); }

@keyframes floaty { to { transform: translateY(-2rem) translateX(1.5rem); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bounceWin { 0% { transform: scale(1); } 35% { transform: scale(1.22) rotate(-8deg); } 70% { transform: scale(0.96) rotate(5deg); } 100% { transform: scale(1); } }
@keyframes confettiFall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; } }

@media (max-width: 380px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .control-row { grid-template-columns: 68px 1fr 68px; }
  .step-btn { min-height: 66px; min-width: 66px; font-size: 2.15rem; }
  .hour-grid { grid-template-columns: repeat(4, 1fr); }
  .minute-grid { grid-template-columns: repeat(3, 1fr); }
  .intro-card { grid-template-columns: 1fr; text-align: center; }
  .mission-card { grid-template-columns: 72px 1fr; }
  .character-stage { height: 72px; }
  .magic-ring { width: 66px; height: 66px; }
  .character { font-size: 2.45rem; }
  .choice-grid { grid-template-columns: 1fr; }
}
.choice-instruction {
  width: 100%; border-radius: 22px; padding: 16px; text-align: center;
  color: var(--text); font-weight: 900; line-height: 1.35;
  background: rgba(79,216,255,0.08); border: 1px solid rgba(79,216,255,0.16);
}


/* v2.0.5 iPhone/mobile touch fix */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea {
  font-size: 16px !important;
  -webkit-user-select: text;
  user-select: text;
}
button, .choice-btn, .ghost-btn, .primary-btn, .clock-controls, .time-picker, .quick-chip {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.clock-controls {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}
.digital-display {
  min-width: 184px;
  padding: 12px 20px;
  font-size: 2.35rem;
  border-radius: 26px;
}
.time-picker {
  display: grid;
  gap: 14px;
  border-radius: 26px;
  padding: 14px;
  background: rgba(3,9,20,0.24);
  border: 1px solid rgba(255,255,255,0.09);
}
.time-section { display: grid; gap: 9px; }
.input-help {
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(79,216,255,0.08);
  border: 1px solid rgba(79,216,255,0.16);
  color: var(--muted);
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
}
.input-help strong { color: var(--pts-cyan); }
.time-picker .hour-grid { grid-template-columns: repeat(4, 1fr); gap: 9px; }
.time-picker .minute-grid { grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 9px; }
.time-picker .minute-grid.is-dense { grid-template-columns: repeat(5, 1fr); gap: 7px; }
.time-picker .quick-chip {
  min-height: 58px;
  border-radius: 18px;
  font-size: 1.22rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}
.time-picker .minute-grid.is-dense .quick-chip {
  min-height: 44px;
  font-size: 0.98rem;
  border-radius: 14px;
}
.time-picker .quick-chip:active {
  transform: translateY(1px) scale(0.99);
}
.time-picker .quick-chip.is-selected {
  color: #04101e;
  background: linear-gradient(135deg, var(--pts-yellow), var(--pts-cyan));
  border-color: rgba(255,255,255,0.50);
  box-shadow: 0 12px 28px rgba(79,216,255,0.18);
}
.answer-btn { min-height: 66px; font-size: 1.18rem; }
.primary-btn { min-height: 58px; font-size: 1.05rem; }
.ghost-btn { min-height: 54px; }
.hand-hour-outline { stroke: #061626; stroke-linecap: round; stroke-width: 15; }
.hand-hour { stroke: #ffffff; stroke-linecap: round; stroke-width: 8.5; }
.hand-minute-outline { stroke: rgba(255,255,255,0.85); stroke-linecap: round; stroke-width: 10.5; }
.hand-minute { stroke: #118cff; stroke-linecap: round; stroke-width: 7; }
.clock-caption { font-size: 10.5px; }

@media (max-width: 380px) {
  .clock-controls { gap: 12px; }
  .digital-display { min-width: 168px; font-size: 2.1rem; }
  .time-picker { padding: 12px; gap: 12px; }
  .time-picker .hour-grid { grid-template-columns: repeat(3, 1fr); }
  .time-picker .quick-chip { min-height: 54px; font-size: 1.1rem; }
  .time-picker .minute-grid.is-dense { grid-template-columns: repeat(4, 1fr); }
}
