@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Work+Sans:wght@400;500;600;700&display=swap');

/*
 * The visual language remains the original H5's cyan / violet, layered sci-fi
 * treatment. This file only adapts the new information architecture to it.
 */
:root {
  --layout-cyan: #12d9f4;
  --layout-blue: #2c9dff;
  --layout-violet: #7c5cff;
  --layout-ink: #070c19;
  --layout-panel: rgba(18, 31, 53, .92);
  --layout-line: rgba(75, 193, 240, .58);
  --layout-text: #f3f7ff;
  --layout-muted: #91acd3;
}

html, body, #app, #view { max-width: 100%; overflow-x: hidden; }
#view { padding: 26px 22px calc(94px + env(safe-area-inset-bottom)); }

/* Keep the former header glow and simply fit the timer/status into it. */
#topbar { gap: 14px; box-sizing: border-box; }
#brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topStatus:not([hidden]) { display: flex !important; min-width: 0; flex: 0 1 auto; align-items: center; justify-content: flex-end; gap: 9px; margin: 0 !important; padding: 0 !important; background: transparent !important; border: 0 !important; }
#eventClock, #progressText { display: block !important; flex: 0 0 auto; margin: 0 !important; color: #9db4d7 !important; font-size: 14px !important; line-height: 1 !important; }
#progressTrack { display: block !important; flex: 0 1 clamp(52px, 18vw, 118px); min-width: 44px; width: clamp(52px, 18vw, 118px); height: 8px !important; margin: 0 !important; overflow: hidden; border: 0 !important; border-radius: 99px; background: #1b2840 !important; }
#progressBar { display: block !important; width: 0; height: 100% !important; margin: 0 !important; border-radius: inherit; background: linear-gradient(90deg, #0ddbf1, #36a8ff) !important; box-shadow: 0 0 10px rgba(16, 219, 244, .75); }

/* New three-tab navigation, using the legacy luminous button treatment. */
#tabbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#tabbar button { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; width: 100%; padding: 7px 3px !important; }
#tabbar button b { display: block; margin: 0; font-size: 19px; line-height: 1; font-family: inherit; }
#tabbar button span { display: block; max-width: 100%; overflow: visible; text-overflow: clip; white-space: nowrap; font-size: 13px !important; line-height: 1.1; }

.entry-page, .home-page, .leaderboard-page, .profile-page, .challenge-page {
  width: 100%; min-width: 0; box-sizing: border-box;
}

/* Home: order and content follow the revised layout; card finish remains 3D. */
.home-greeting { margin: 2px 0 22px; }
.home-greeting h1 { margin: 0 0 8px; color: var(--layout-text); font-size: clamp(29px, 8.5vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
.home-greeting p { margin: 0; color: var(--layout-muted); font-size: 16px; line-height: 1.55; }
.home-section-title { margin: 26px 0 13px; color: var(--layout-text); font-size: 25px; line-height: 1.15; }

.main-tower {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%; box-sizing: border-box;
  margin: 0 0 22px; padding: 22px 20px 18px;
  border: 1px solid rgba(49, 214, 249, .76); border-radius: 22px;
  background:
    radial-gradient(circle at 76% 22%, rgba(248, 55, 75, .25), transparent 29%),
    radial-gradient(circle at 22% 0%, rgba(116, 81, 253, .34), transparent 48%),
    linear-gradient(135deg, #17224e 0%, #0d1836 56%, #071225 100%);
  box-shadow: inset 0 1px 0 rgba(136, 236, 255, .3), 0 15px 34px rgba(2, 7, 23, .56), 0 0 28px rgba(31, 211, 245, .1);
}
.main-tower::before { content: ''; position: absolute; inset: 13px 18px auto; height: 5px; border-radius: 99px; background: linear-gradient(90deg, #0bdff4, #48a7ff); box-shadow: 0 0 13px rgba(18, 217, 244, .9); }
.main-tower > * { position: relative; z-index: 1; }
.main-tower .eyebrow { margin-top: 19px; color: #98aed7; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.main-tower .tower-chip { margin-top: 19px; color: #ff8b96; font-size: 12px; font-weight: 850; letter-spacing: .13em; }
.main-tower-copy { position: relative; z-index: 2; max-width: 59%; }
.main-tower h2 { max-width: 63%; margin: 8px 0; color: var(--layout-text); font-size: clamp(25px, 7vw, 35px); line-height: 1.04; letter-spacing: -.025em; }
.main-tower p { max-width: 64%; margin: 0; color: var(--layout-muted); font-size: 15px; line-height: 1.45; }
.main-tower-art { position: absolute !important; z-index: 2 !important; top: 35px; right: 12px; width: min(39%, 146px); height: auto; max-height: 150px; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(255, 42, 64, .36)); pointer-events: none; }
.main-tower .main-emblem { display: none !important; }
.main-tower button, .main-tower .main-actions { position: relative; z-index: 3; width: 59%; min-height: 54px; margin-top: 22px; border-radius: 15px; }
.main-tower .main-actions { display: flex; width: 100%; gap: 10px; }
.main-tower .main-actions button { width: 50%; margin: 0; }
.main-tower .locked-actions { max-width: 100%; }
.main-tower .power-up { white-space: nowrap; }
.main-tower .locked-actions #unlockMain[disabled] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #dbe9ff;
  opacity: 1;
}
.lock-glyph {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 15px;
  margin-top: 6px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(195, 217, 255, .22), rgba(79, 101, 139, .46));
  box-shadow: 0 0 9px rgba(190, 219, 255, .2), inset 0 1px rgba(255, 255, 255, .25);
}
.lock-glyph::before {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 10px;
  height: 9px;
  content: '';
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  transform: translateX(-50%);
}
.lock-glyph::after {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 3px;
  height: 5px;
  content: '';
  border-radius: 4px;
  background: currentColor;
  box-shadow: 0 -2px 0 -1px currentColor;
  transform: translateX(-50%);
}

.tower-list { display: grid; gap: 13px; width: 100%; }
.tower-card {
  --tower-accent: var(--layout-blue);
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; column-gap: 13px;
  width: 100%; min-width: 0; box-sizing: border-box; padding: 15px 16px;
  border: 1px solid var(--layout-line); border-left: 7px solid var(--tower-accent); border-radius: 18px;
  background: linear-gradient(105deg, rgba(20, 42, 71, .98), rgba(11, 23, 44, .96));
  box-shadow: inset 0 1px 0 rgba(139, 229, 255, .12), 0 10px 22px rgba(2, 8, 24, .36), 0 0 17px color-mix(in srgb, var(--tower-accent) 15%, transparent);
  text-align: left;
}
.tower-card.orange { --tower-accent: #ffad1b; }
.tower-card.purple { --tower-accent: #8d70ff; }
.tower-card.blue { --tower-accent: #269cff; }
.tower-card > span:nth-child(2) { display: block; min-width: 0; }
.tower-card .tower-icon { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--tower-accent) 80%, white); border-radius: 50%; color: var(--tower-accent); background: radial-gradient(circle, color-mix(in srgb, var(--tower-accent) 22%, transparent), rgba(11, 22, 42, .75)); box-shadow: inset 0 0 14px color-mix(in srgb, var(--tower-accent) 38%, transparent), 0 0 14px color-mix(in srgb, var(--tower-accent) 28%, transparent); font-size: 26px; }
.tower-card strong, .tower-card small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower-card strong { color: var(--layout-text); font-size: clamp(17px, 5.3vw, 23px); line-height: 1.2; }
.tower-card small { margin-top: 5px; color: var(--layout-muted); font-size: 14px; line-height: 1.25; }
.tower-card > b { min-width: 44px; color: var(--tower-accent); font-size: 18px; text-align: right; white-space: nowrap; }

/* Preserve the original panel depth for all revised page groups. */
.question-shell, .video-shell, .personality-shell, .leaderboard-card, .profile-card, .resume-card, .entry-card, .modal-card {
  width: 100%; min-width: 0; box-sizing: border-box;
  border: 1px solid rgba(76, 150, 208, .42); border-radius: 19px;
  background: linear-gradient(145deg, rgba(25, 43, 70, .96), rgba(12, 23, 43, .98));
  box-shadow: inset 0 1px 0 rgba(162, 222, 255, .12), 0 12px 26px rgba(2, 7, 22, .4);
}
.choice, .option-button { width: 100%; min-width: 0; box-sizing: border-box; overflow-wrap: anywhere; }
.choice.selected, .option-button.selected { border-color: var(--layout-cyan); box-shadow: 0 0 0 1px rgba(18, 217, 244, .25), 0 0 18px rgba(18, 217, 244, .12); }
.leaderboard-row.is-current { border-left-color: #ff4c5c; background: linear-gradient(90deg, rgba(255, 48, 67, .18), rgba(28, 35, 57, .86)); }

@media (max-width: 380px) {
  #view { padding-inline: 16px; }
  #topbar { padding-inline: 16px; gap: 8px; }
  #brand { font-size: 14px; }
  #eventClock { display: none; }
  .main-tower { padding-inline: 16px; }
  .main-tower-art { top: 41px; right: 9px; width: 37%; max-height: 130px; }
  .main-tower-copy { max-width: 62%; }
  .main-tower button { width: 62%; }
  .tower-card { grid-template-columns: 45px minmax(0, 1fr) auto; padding: 13px 11px; column-gap: 10px; }
  .tower-card .tower-icon { width: 42px; height: 42px; font-size: 21px; }
  .tower-card strong { font-size: 16px; }
  .tower-card small { font-size: 12px; }
  .tower-card > b { min-width: 36px; font-size: 16px; }
}

/* Challenge pages: legacy luminous cards, retained with the revised copy flow. */
.challenge-page {
  min-height: calc(100dvh - 170px);
  display: flex; flex-direction: column;
  color: var(--layout-text);
}
.challenge-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -2px 8px; padding: 0 2px 12px;
  border-bottom: 1px solid rgba(92, 160, 213, .36);
}
.challenge-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--layout-cyan); font-size: 17px; }
.challenge-head span { flex: 0 0 auto; color: var(--layout-muted); font-size: 13px; }
.challenge-head.orange strong, .tower-slogan.orange { color: #ffb020; }
.challenge-head.purple strong, .tower-slogan.purple { color: #a689ff; }
.challenge-head.blue strong, .tower-slogan.blue { color: #42b8ff; }
.tower-slogan { margin: 14px 0 26px; font-size: 15px; font-style: italic; line-height: 1.5; color: var(--layout-muted); }
.challenge-page h1 { margin: 0 0 10px; color: var(--layout-text); font-size: clamp(24px, 7vw, 31px); line-height: 1.16; letter-spacing: -.025em; }
.challenge-page .instruction { margin: 0 0 15px; color: var(--layout-muted); font-size: 14px; }
.answer-list { display: grid; gap: 10px; margin: 8px 0 20px; }
.answer-option {
  position: relative; display: block; min-height: 61px; padding: 16px 17px;
  border: 1px solid rgba(74, 126, 178, .58); border-radius: 13px;
  background: linear-gradient(110deg, rgba(29, 49, 81, .96), rgba(19, 33, 59, .98));
  box-shadow: inset 0 1px 0 rgba(177, 225, 255, .08), 0 6px 15px rgba(1, 6, 18, .25);
  color: #deebff; font: inherit; font-size: 15px; line-height: 1.45; text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.answer-option:hover { transform: translateY(-1px); border-color: rgba(51, 207, 248, .85); }
.intelligence-page .answer-option.selected, .intelligence-page .answer-option:focus-visible { border-color: #ffac13; background: linear-gradient(110deg, rgba(115, 66, 7, .55), rgba(37, 31, 27, .98)); box-shadow: 0 0 0 1px rgba(255, 163, 0, .28), 0 0 22px rgba(255, 151, 0, .14); }
.video-page .answer-option.selected, .video-page .answer-option:focus-visible { border-color: #9a82ff; box-shadow: 0 0 0 1px rgba(154, 130, 255, .3), 0 0 20px rgba(131, 89, 255, .16); }
.personality-page .answer-option.selected, .personality-page .answer-option:focus-visible { border-color: #32b9ff; box-shadow: 0 0 0 1px rgba(50, 185, 255, .3), 0 0 20px rgba(26, 166, 255, .15); }
.challenge-page .primary { width: 100%; min-height: 53px; margin-top: 8px; margin-bottom: 24px; flex: 0 0 auto; border: 0; border-radius: 13px; font: 800 16px/1 inherit; letter-spacing: .01em; }
.challenge-page .primary.orange { background: linear-gradient(100deg, #ff9d00, #ffbd22); color: #1c170c; box-shadow: 0 0 22px rgba(255, 153, 0, .28), inset 0 1px 0 rgba(255, 239, 184, .56); }
.challenge-page .primary.purple { background: linear-gradient(100deg, #7559e9, #9479ff); color: #fff; box-shadow: 0 0 22px rgba(134, 92, 255, .25), inset 0 1px 0 rgba(237, 230, 255, .38); }
.challenge-page .primary.blue { background: linear-gradient(100deg, #08c6dd, #299eff); color: #03121f; box-shadow: 0 0 22px rgba(26, 185, 255, .25), inset 0 1px 0 rgba(211, 253, 255, .6); }

.agent-record, .result-panel {
  padding: 18px; border: 1px solid rgba(72, 137, 209, .45); border-radius: 15px;
  background: linear-gradient(145deg, rgba(22, 41, 68, .92), rgba(11, 24, 42, .97));
  box-shadow: inset 0 1px 0 rgba(179, 226, 255, .08), 0 12px 23px rgba(1, 7, 19, .26);
}
.agent-record { margin-top: 15px; }
.agent-record span, .result-panel > span { display: block; margin-bottom: 9px; color: #78b6ff; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.agent-record p, .result-panel p { margin: 0; color: #c2d4ef; font-size: 15px; line-height: 1.55; }
.agent-record.revealed { border-color: rgba(91, 192, 106, .55); background: linear-gradient(145deg, rgba(18, 56, 31, .88), rgba(13, 35, 28, .98)); }
.agent-record.revealed span { color: #72d889; }
.story-copy { margin: 19px 0; color: #bdcbe4; font-size: 16px; line-height: 1.5; }
.story-copy.emphasis { font-weight: 800; font-style: italic; text-align: center; color: #ffdf9d; }
.result-panel { margin: auto 0; text-align: center; }
.result-panel h1 { margin: 6px 0 13px; }
.result-panel .result-unlock { margin-top: 18px; color: #65d5ff; font-weight: 700; }
.result-panel.wrong { border-color: rgba(255, 131, 62, .55); }
.result-panel.wrong > span { color: #ffb052; }
.result-panel .primary { margin-top: 24px; }

.video-intro { margin: 0 0 13px; color: #d4c8ff; font-weight: 750; }
.video-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; margin: 4px 0 22px; border: 1px solid rgba(149, 123, 255, .58); border-radius: 16px; background: linear-gradient(135deg, #18213c, #10192b); box-shadow: inset 0 0 26px rgba(110, 83, 255, .15), 0 10px 24px rgba(1, 6, 19, .4); }
.video-frame::after { content: '▶'; position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; color: #f4f0ff; font-size: 38px; text-shadow: 0 0 20px #876fff; pointer-events: none; }
.video-frame iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; }
.video-fallback { position: relative; z-index: 1; display: grid; width: 100%; height: 100%; place-items: center; color: var(--layout-muted); }

/* Leaderboard: the new table data receives the same in-app panel treatment. */
.leaderboard-page { color: var(--layout-text); }
.leaderboard-title { position: relative; overflow: hidden; margin: 0 0 17px; padding: 19px 18px 17px; border: 1px solid rgba(46, 213, 246, .52); border-radius: 17px; background: radial-gradient(circle at 100% 0%, rgba(216, 61, 96, .25), transparent 35%), linear-gradient(135deg, rgba(35, 45, 98, .97), rgba(14, 28, 50, .98)); box-shadow: inset 0 1px 0 rgba(152, 237, 255, .18), 0 12px 26px rgba(1, 7, 20, .34); }
.leaderboard-title::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 4px; border-radius: 0 0 9px 9px; background: linear-gradient(90deg, #14dced, #378fff); box-shadow: 0 0 12px rgba(20, 220, 237, .75); }
.leaderboard-title > span { display: block; margin-top: 8px; color: #9ec3ff; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.leaderboard-title > b { position: absolute; right: 18px; top: 21px; color: #52edcf; font-size: 12px; }
.leaderboard-title h1 { margin: 8px 0 6px; font-size: 27px; line-height: 1.1; }
.leaderboard-title p { margin: 0; color: var(--layout-muted); font-size: 14px; }
.rank-list { overflow: hidden; border: 1px solid rgba(62, 127, 182, .5); border-radius: 16px; background: rgba(13, 27, 49, .87); box-shadow: inset 0 1px 0 rgba(171, 225, 255, .09), 0 12px 24px rgba(1, 6, 18, .35); }
.rank-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 66px; padding: 11px 14px; border-bottom: 1px solid rgba(81, 126, 171, .23); }
.rank-row:last-child { border-bottom: 0; }
.rank-row > b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #243956; color: #c8dcff; font-size: 13px; }
.rank-row:nth-child(1) > b { background: linear-gradient(135deg, #ffd978, #cf8e24); color: #2d1c00; box-shadow: 0 0 12px rgba(255, 190, 61, .37); }
.rank-row:nth-child(2) > b { background: linear-gradient(135deg, #dfeaff, #8294b6); color: #101a2c; }
.rank-row:nth-child(3) > b { background: linear-gradient(135deg, #ffc58f, #a4653e); color: #28170d; }
.rank-row > span { min-width: 0; }
.rank-row strong, .rank-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row strong { color: #edf5ff; font-size: 15px; }
.rank-row small { margin-top: 4px; color: var(--layout-muted); font-size: 12px; }
.rank-row time { color: #c5d9ff; font-size: 13px; white-space: nowrap; }
.rank-row.mine { position: relative; background: linear-gradient(90deg, rgba(192, 42, 54, .34), rgba(51, 24, 36, .46)); box-shadow: inset 3px 0 0 #ec3347; }
.rank-row.mine strong, .rank-row.mine time { color: #fff3f4; }

/* Profile: compact legacy panels; nothing functional is changed. */
.profile-page { color: var(--layout-text); }
.profile-page > h1 { margin: 0 0 20px; font-size: 28px; }
.profile-user { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 13px; margin-bottom: 14px; padding: 16px; border: 1px solid rgba(66, 191, 239, .6); border-radius: 17px; background: radial-gradient(circle at 98% 0%, rgba(117, 65, 231, .4), transparent 42%), linear-gradient(115deg, rgba(21, 47, 81, .98), rgba(13, 29, 54, .98)); box-shadow: inset 0 1px 0 rgba(147, 232, 255, .16), 0 10px 24px rgba(2, 7, 20, .36); }
.profile-user > b { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid rgba(92, 217, 253, .7); border-radius: 50%; background: linear-gradient(135deg, #1d608f, #6548c8); box-shadow: 0 0 17px rgba(61, 189, 255, .25); color: white; font-size: 17px; }
.profile-user > span { min-width: 0; }
.profile-user strong, .profile-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-user strong { color: #f3f7ff; font-size: 17px; }
.profile-user small { margin-top: 5px; color: var(--layout-muted); font-size: 13px; }
.profile-panel { margin: 12px 0; padding: 16px; border: 1px solid rgba(66, 122, 175, .48); border-radius: 15px; background: linear-gradient(145deg, rgba(24, 41, 69, .89), rgba(13, 26, 47, .95)); box-shadow: inset 0 1px 0 rgba(165, 221, 255, .08); }
.profile-panel > span { display: block; margin-bottom: 8px; color: #8ba9d1; font-size: 12px; }
.profile-panel strong { color: #f0f6ff; font-size: 15px; }
.profile-panel p { margin: 0; color: #b2c6e4; font-size: 14px; line-height: 1.5; }
.profile-page .secondary { width: 100%; min-height: 50px; margin: 12px 0; border: 1px solid rgba(84, 142, 201, .55); border-radius: 13px; background: linear-gradient(145deg, rgba(22, 38, 63, .95), rgba(11, 22, 40, .98)); color: #c6d8f7; font: 700 15px/1 inherit; }
.profile-page .secondary:hover { border-color: #43cef2; color: #fff; box-shadow: 0 0 17px rgba(33, 193, 247, .17); }
.profile-page .signout { margin-top: 16px; }
.profile-dashboard-entry { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; min-height: 68px; gap: 12px; margin: 12px 0; padding: 10px 14px; border: 1px solid rgba(95, 180, 249, .7); border-radius: 15px; background: radial-gradient(circle at 92% 18%, rgba(109, 82, 234, .36), transparent 42%), linear-gradient(135deg, rgba(21, 57, 96, .96), rgba(10, 25, 48, .99)); box-shadow: inset 0 1px 0 rgba(179, 237, 255, .17), 0 10px 23px rgba(0, 5, 19, .28); color: #f1f8ff; text-decoration: none; }
.profile-dashboard-entry:hover { border-color: #54e2ff; box-shadow: inset 0 1px 0 rgba(211, 250, 255, .25), 0 0 22px rgba(36, 203, 250, .2); }
.profile-dashboard-entry:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.profile-dashboard-entry > span:nth-child(2) { min-width: 0; }
.profile-dashboard-entry strong, .profile-dashboard-entry small { display: block; }
.profile-dashboard-entry strong { color: #f6fbff; font-size: 15px; line-height: 1.25; }
.profile-dashboard-entry small { margin-top: 4px; color: #acc4e6; font-size: 12px; line-height: 1.25; }
.profile-dashboard-entry > b { color: #70eaff; font-size: 21px; line-height: 1; }
.profile-dashboard-icon { position: relative; display: grid; place-items: center; width: 45px; height: 45px; overflow: hidden; border: 1px solid rgba(103, 220, 255, .75); border-radius: 13px; background: linear-gradient(135deg, rgba(28, 180, 225, .4), rgba(99, 59, 201, .64)); box-shadow: inset 0 1px rgba(255, 255, 255, .26), 0 0 16px rgba(42, 208, 255, .26); }
.profile-dashboard-icon::before { width: 16px; height: 21px; border: 2px solid #d9fbff; border-radius: 3px; content: ''; box-shadow: 0 0 8px #35d8ff; }
.profile-dashboard-icon::after { position: absolute; bottom: 10px; left: 17px; width: 3px; height: 3px; border-radius: 50%; background: #e9fcff; box-shadow: 6px -6px #e9fcff, 12px -1px #e9fcff, 6px 5px #e9fcff; content: ''; }
.profile-dashboard-icon i { position: absolute; width: 26px; height: 1px; background: rgba(201, 251, 255, .48); transform: rotate(-38deg); }
.profile-dashboard-icon i:nth-child(1) { top: 9px; left: -4px; }.profile-dashboard-icon i:nth-child(2) { top: 17px; right: -8px; }.profile-dashboard-icon i:nth-child(3) { bottom: 7px; left: -4px; }

/* Entry, system and modal surfaces also retain the established treatment. */
.entry-lead { margin: 4px 0 26px; }
.entry-lead > span { color: #32d7f2; font-size: 13px; font-weight: 800; letter-spacing: .05em; }
.entry-lead h1 { margin: 12px 0 7px; color: var(--layout-text); font-size: 34px; }
.entry-lead p { margin: 0; color: var(--layout-muted); font-size: 16px; line-height: 1.5; }
.manual-form, .resume-card, .state-card { padding: 18px; border: 1px solid rgba(63, 150, 212, .46); border-radius: 18px; background: linear-gradient(145deg, rgba(24, 43, 72, .96), rgba(10, 22, 41, .98)); box-shadow: inset 0 1px 0 rgba(164, 224, 255, .1), 0 13px 30px rgba(1, 7, 20, .4); }
.manual-form label, .modal-card label { display: grid; gap: 7px; margin: 13px 0; color: #9ab4d9; font-size: 13px; }
.manual-form input, .manual-form select, .modal-card input, .modal-card select { min-width: 0; box-sizing: border-box; width: 100%; min-height: 45px; padding: 0 13px; border: 1px solid rgba(83, 131, 181, .5); border-radius: 11px; background: #15243c; color: #eff6ff; font: inherit; }
.scan-primary, .entry-page .primary { width: 100%; min-height: 54px; border: 0; border-radius: 13px; background: linear-gradient(100deg, #ed1829, #f02432); color: white; font: 800 16px/1 inherit; box-shadow: 0 8px 20px rgba(224, 20, 43, .24); }
.camera-help { display: block; width: 100%; margin: 14px 0; border: 0; background: transparent; color: #8da9d3; font: 650 13px/1 inherit; }
.divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; color: #7794bd; font-size: 13px; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: rgba(90, 133, 179, .38); }
.resume-card h1 { margin: 8px 0; color: #f4f7ff; font-size: 29px; }
.resume-card p { color: #b5cae7; line-height: 1.5; }
.resume-card .primary, .resume-card .secondary { width: 100%; min-height: 50px; margin-top: 12px; border-radius: 13px; }
.modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2, 7, 19, .75); backdrop-filter: blur(8px); }
.modal-card { position: relative; max-width: 440px; padding: 24px; }
.modal-card h2 { margin: 7px 0 8px; color: #f3f7ff; }
.modal-card p { margin: 0; color: #b4c7e3; line-height: 1.45; }
.modal-card .primary { width: 100%; min-height: 48px; margin-top: 12px; border: 0; border-radius: 12px; background: linear-gradient(100deg, #ed1b2b, #ee3d4a); color: white; font: 800 15px/1 inherit; }
.modal-close { position: absolute; top: 11px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 9px; background: rgba(117, 143, 179, .18); color: #d9e7fa; font-size: 23px; line-height: 1; }
.state-card { color: var(--layout-text); }
.state-card h1 { margin-top: 0; }
.state-card p { color: var(--layout-muted); }
.empty-copy { padding: 18px; color: var(--layout-muted); text-align: center; }

/* A narrow phone cannot fit the full event name and progress on one row. */
@media (max-width: 500px) {
  #topbar {
    display: grid !important; grid-template-columns: minmax(0, 1fr); align-content: center;
    min-height: 78px; padding: 12px 16px !important; gap: 8px;
  }
  #brand {
    width: 100%; max-width: none !important; overflow: visible; text-overflow: clip; white-space: nowrap;
    color: #10d9f1; font-size: clamp(14px, 4.45vw, 17px) !important; line-height: 1.1;
  }
  #topStatus:not([hidden]) { width: 100%; justify-content: flex-start; gap: 9px; }
  #progressTrack { flex: 1 1 auto; width: auto; max-width: none; }
  #tabbar { min-height: 68px; padding: 6px 10px calc(7px + env(safe-area-inset-bottom)) !important; }
  #tabbar button span { font-size: 12px !important; }
}

/* Tower names and slogans must remain readable on narrow phones. */
.tower-card {
  min-height: 90px;
  align-items: center;
}
.tower-card strong,
.tower-card small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}
.tower-card strong {
  font-size: clamp(15px, 4.35vw, 18px);
  line-height: 1.18;
}
.tower-card small {
  margin-top: 4px;
  font-size: clamp(11px, 3.4vw, 13px);
  line-height: 1.28;
}
.tower-card > b { align-self: center; font-size: 17px; }

/* Compact the main-tower card so the full tower list stays within the first screen. */
@media (max-width: 500px) {
  #view { padding-top: 18px; }
  .home-greeting { margin-bottom: 14px; }
  .home-greeting h1 { margin-bottom: 5px; font-size: clamp(29px, 8vw, 35px); }
  .home-greeting p { font-size: 14px; line-height: 1.4; }
  .main-tower {
    min-height: 248px; height: 248px; margin-bottom: 14px; padding: 15px 17px;
    border-radius: 19px;
  }
  .main-tower::before { inset: 11px 16px auto; height: 4px; }
  .main-tower .tower-chip { margin-top: 15px; font-size: 12px; }
  .main-tower-copy { max-width: 56%; }
  .main-tower h2 { max-width: 100%; margin: 5px 0 6px; font-size: clamp(24px, 6.5vw, 28px); line-height: 1.03; }
  .main-tower p { max-width: 100%; overflow: visible; white-space: nowrap; font-size: 12px; line-height: 1.32; letter-spacing: -.055em; }
  .main-tower-art { top: 38px; right: 10px; width: 35%; max-height: 118px; }
  .main-tower button {
    position: absolute; left: 17px; bottom: 16px; width: 56%; min-height: 45px; margin: 0;
    border-radius: 13px; font-size: 15px;
  }
  .main-tower .main-actions.locked-actions {
    position: absolute; left: 17px; right: 17px; bottom: 16px; width: auto; min-height: 45px; margin: 0;
    gap: 8px;
  }
  .main-tower .main-actions.locked-actions button {
    position: static; flex: 1 1 0; width: auto; min-width: 0; min-height: 45px; margin: 0;
    padding-inline: 8px; font-size: 13px;
  }
  .home-page .section-title { margin: 15px 0 9px; font-size: 22px; }
  .tower-list { gap: 10px; }
}

/* WCAG 2.1 AA, typography, and interaction baseline. */
#app, #app button, #app input, #app select, #app textarea {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app h1, #app h2, #app h3, #brand, .tower-card strong, .profile-user strong, .rank-row strong {
  font-family: 'Montserrat', 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app :where(p, small, label, span, time, button, input, select, textarea, strong, b) {
  font-size: max(12px, 1em);
}
#app :where(button, input, select, textarea) { min-height: 44px; }
#app button { touch-action: manipulation; }
#app :where(button, input, select, textarea):focus-visible {
  outline: 3px solid #ff5a61 !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 90, 97, .22) !important;
}
@media (hover: hover) {
  #app button:not(:disabled):hover { filter: brightness(1.06); }
}
#app button:not(:disabled):active { transform: translateY(1px); }
#app button:disabled, #app button[aria-busy='true'] {
  background: #4b566d !important;
  border-color: #64738f !important;
  color: #ffffff !important;
  opacity: 1;
  cursor: not-allowed;
}
#app button[aria-busy='true'] { pointer-events: none; }

/* Primary actions keep the approved red surface with white text. */
#app .primary, #app .scan-primary {
  background: #d71920 !important;
  color: #ffffff !important;
  border: 1px solid #d71920 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 18px rgba(215, 25, 32, .22) !important;
}
@media (hover: hover) {
  #app .primary:not(:disabled):hover, #app .scan-primary:not(:disabled):hover { background: #af141a !important; border-color: #af141a !important; }
}
#app .secondary, #app .camera-help {
  background: transparent !important;
  border: 1px solid #77839a !important;
  color: #dfe9fa !important;
}

/* Muted text uses the documented minimum contrast token on dark surfaces. */
#app .instruction, #app .home-greeting p, #app .tower-card small, #app .main-tower p,
#app .profile-panel > span, #app .profile-panel p, #app .rank-row small, #app .leaderboard-title p,
#app .entry-lead p, #app .resume-card p, #app .modal-card p, #app .camera-help, #app .divider {
  color: #9bb1d2 !important;
}
#app .main-tower .tower-chip { color: #ff5a61; }
#app .leaderboard-title > span, #app .agent-record span, #app .result-panel > span { letter-spacing: .05em; }

/* Explicit spacing after labels when controls are no longer nested inside them. */
.manual-form > label + :is(input, select), .modal-card > label + :is(input, select) { margin-bottom: 11px; }

/* Home reward entry: it is only rendered after at least one reward threshold is reached. */
.reward-orbit-button {
  position: fixed;
  z-index: 29;
  right: calc(50% - min(215px, 50vw) + 17px);
  bottom: calc(89px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 1px solid rgba(104, 239, 255, .88);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(110, 242, 255, .6), rgba(29, 100, 186, .88) 42%, rgba(34, 28, 101, .96) 72%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -10px 16px rgba(5, 14, 47, .42), 0 0 0 4px rgba(18, 211, 244, .1), 0 9px 24px rgba(0, 6, 27, .7), 0 0 24px rgba(16, 216, 242, .44);
  color: #fff;
  isolation: isolate;
  transition: transform .2s ease, filter .2s ease;
  animation: reward-float 2.5s ease-in-out infinite;
}
.reward-orbit-button::before {
  position: absolute;
  z-index: -2;
  inset: -8px;
  content: '';
  border: 1px solid rgba(111, 231, 255, .36);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(14, 217, 244, .22);
  animation: reward-aura 2.5s ease-in-out infinite;
}
.reward-orbit-button::after {
  position: absolute;
  z-index: -1;
  inset: 8px;
  content: '';
  border: 1px solid rgba(239, 247, 255, .29);
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, .19), transparent 42%);
}
.reward-orbit-button:hover { filter: brightness(1.12); }
.reward-orbit-button:active { transform: translateY(1px) scale(.97); }
.reward-orbit-ring {
  position: absolute;
  inset: -5px;
  border: 1px dashed rgba(147, 249, 255, .9);
  border-radius: 50%;
  animation: reward-orbit 5s linear infinite;
}
.reward-orbit-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffea85;
  box-shadow: 0 0 10px #ffe263;
}
.reward-orbit-dot-a { top: 0; right: 11px; animation: reward-dot-a 2.8s ease-in-out infinite; }
.reward-orbit-dot-b { bottom: 6px; left: 1px; background: #ff6d82; box-shadow: 0 0 10px #ff4c63; animation: reward-dot-b 2.8s ease-in-out infinite; }
.reward-gift {
  position: relative;
  display: block;
  width: 28px;
  height: 22px;
  margin-top: -5px;
  border: 1px solid rgba(255, 255, 255, .96);
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(135deg, #fc5566, #df1d3d 50%, #9d143b);
  box-shadow: inset 0 1px rgba(255, 255, 255, .65), 0 0 11px rgba(255, 69, 93, .72);
}
.reward-gift::before {
  position: absolute;
  top: -6px;
  left: -2px;
  width: 30px;
  height: 6px;
  content: '';
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 3px;
  background: linear-gradient(90deg, #ffad39, #ffe97a, #ffad39);
  box-shadow: 0 0 8px rgba(255, 220, 93, .62);
}
.reward-gift::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  content: '';
  background: linear-gradient(#fff7a6, #ffc639);
  transform: translateX(-50%);
}
.reward-gift i::before, .reward-gift i::after {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 8px;
  content: '';
  border: 2px solid #fff4a8;
  border-radius: 10px 10px 2px 10px;
  box-shadow: 0 0 7px rgba(255, 229, 104, .7);
}
.reward-gift i::before { left: 4px; transform: rotate(-26deg); }
.reward-gift i::after { right: 4px; transform: scaleX(-1) rotate(-26deg); }
.reward-orbit-label {
  position: absolute;
  bottom: 5px;
  left: 50%;
  color: #eefdff;
  font-size: 12px !important;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
  text-shadow: 0 1px 3px #06122b;
  transform: translateX(-50%);
}
.reward-orbit-count {
  position: absolute;
  top: -6px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 1px solid rgba(255, 249, 184, .85);
  border-radius: 99px;
  background: #d71920;
  box-shadow: 0 0 13px rgba(255, 54, 72, .75);
  color: white;
  font-size: 12px !important;
  font-weight: 850;
  line-height: 1;
}
@keyframes reward-float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes reward-aura { 0%, 100% { opacity: .35; transform: scale(.96); } 50% { opacity: .95; transform: scale(1.08); } }
@keyframes reward-orbit { to { transform: rotate(360deg); } }
@keyframes reward-dot-a { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-6px, 5px); } }
@keyframes reward-dot-b { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(7px, -6px); } }

/* Reward dialog retains the H5's layered sci-fi treatment rather than a flat list. */
.reward-modal { z-index: 100; padding: 16px; }
.reward-dialog {
  width: min(100%, 410px);
  max-height: min(720px, calc(100dvh - 32px));
  padding: 23px 17px 18px;
  overflow: auto;
  border-color: rgba(68, 216, 243, .64);
  background: radial-gradient(circle at 92% 0%, rgba(120, 75, 232, .28), transparent 34%), linear-gradient(145deg, rgba(26, 44, 77, .98), rgba(8, 18, 35, .99));
  box-shadow: inset 0 1px 0 rgba(176, 240, 255, .18), 0 22px 55px rgba(0, 0, 0, .56), 0 0 34px rgba(17, 193, 244, .13);
}
.reward-dialog .eyebrow { display: block; margin-right: 42px; color: #65d9ff; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.reward-dialog h2 { margin: 7px 0 16px; font-size: 25px; }
.reward-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.reward-progress > span { padding: 12px; border: 1px solid rgba(90, 148, 209, .42); border-radius: 13px; background: linear-gradient(145deg, rgba(32, 58, 95, .88), rgba(14, 31, 55, .92)); box-shadow: inset 0 1px rgba(188, 237, 255, .1); }
.reward-progress b, .reward-progress small { display: block; }
.reward-progress b { color: #f1f8ff; font-size: 20px; line-height: 1.1; }
.reward-progress small { margin-top: 5px; color: #9bb6d9; font-size: 12px; line-height: 1.25; }
.reward-list { display: grid; gap: 10px; }
.reward-item { position: relative; overflow: hidden; padding: 14px; border: 1px solid rgba(72, 136, 196, .48); border-radius: 15px; background: linear-gradient(130deg, rgba(21, 45, 77, .96), rgba(11, 25, 45, .98)); box-shadow: inset 0 1px rgba(171, 230, 255, .09), 0 7px 17px rgba(0, 4, 19, .23); }
.reward-item::after { position: absolute; top: 0; right: 0; width: 90px; height: 90px; content: ''; background: radial-gradient(circle at 100% 0, rgba(68, 215, 246, .15), transparent 68%); pointer-events: none; }
.reward-item.reward-claimable { border-color: rgba(255, 192, 77, .66); background: linear-gradient(130deg, rgba(74, 50, 24, .86), rgba(17, 30, 49, .99)); }
.reward-item.reward-issued { border-color: rgba(57, 212, 167, .62); }
.reward-item.reward-redeemed { opacity: .86; border-color: rgba(125, 158, 190, .48); }
.reward-item.reward-locked { opacity: .68; }
.reward-item-head { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.reward-item-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(125, 233, 255, .66); border-radius: 10px; background: linear-gradient(145deg, rgba(18, 205, 231, .28), rgba(105, 67, 212, .54)); color: #effeff; font-size: 18px !important; text-shadow: 0 0 9px #31dcff; }
.reward-item-head b, .reward-item-head small { display: block; min-width: 0; }
.reward-item-head b { overflow: hidden; color: #f2f7ff; font-size: 15px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.reward-item-head small { margin-top: 3px; color: #a8bfdd; font-size: 12px; line-height: 1.2; }
.reward-item-head em { padding: 5px 7px; border: 1px solid rgba(114, 163, 210, .38); border-radius: 99px; background: rgba(4, 14, 30, .45); color: #bfd0e9; font-size: 12px; font-style: normal; font-weight: 800; white-space: nowrap; }
.reward-claimable .reward-item-head em { border-color: rgba(255, 204, 106, .5); color: #ffd46b; }
.reward-issued .reward-item-head em { border-color: rgba(75, 228, 177, .45); color: #70edbb; }
.reward-redeemed .reward-item-head em { color: #b8c5d4; }
.reward-item > p { margin: 11px 0 0; color: #b7c9e3; font-size: 13px; line-height: 1.45; }
.reward-claim { width: 100%; min-height: 45px; margin-top: 13px; border: 1px solid #e8343f; border-radius: 11px; background: linear-gradient(105deg, #d71920, #f0444c); box-shadow: inset 0 1px rgba(255, 255, 255, .24), 0 8px 15px rgba(215, 25, 32, .18); color: white; font: 800 14px/1 inherit; }
.reward-code { margin-top: 12px; padding: 12px; border: 1px dashed rgba(88, 232, 188, .66); border-radius: 11px; background: rgba(10, 46, 43, .62); }
.reward-code span, .reward-code strong, .reward-code small { display: block; }
.reward-code-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reward-code span { color: #98d8c6; font-size: 12px; font-weight: 700; }
.reward-code strong { margin: 0; overflow-wrap: anywhere; color: #effff8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: .08em; white-space: nowrap; }
.reward-barcode { display: grid; min-height: 80px; margin: 10px 0 9px; padding: 8px 9px; place-items: center; overflow: hidden; border: 1px solid rgba(187, 251, 239, .8); border-radius: 8px; background: #f9fffc; box-shadow: inset 0 0 0 2px rgba(18, 50, 60, .08), 0 0 15px rgba(79, 239, 191, .15); }
.reward-barcode .bc-svg { display: block; width: 100%; max-width: 100%; height: 64px; }
.reward-code small, .reward-redeemed, .reward-locked { color: #a6c3d2; font-size: 12px; line-height: 1.35; }
.reward-redeemed, .reward-locked { margin-top: 12px; padding: 9px 10px; border-radius: 9px; background: rgba(7, 16, 31, .45); }
.reward-redeemed { color: #8fe4be; }
@media (prefers-reduced-motion: reduce) {
  .reward-orbit-button, .reward-orbit-button::before, .reward-orbit-ring, .reward-orbit-dot { animation: none !important; }
}
