/* Titan Armor: full-screen camera stage with a dark futuristic HUD (gold, steel and blue energy). */
:root {
  --ink: #eaf6ff; --muted: #9fb3cc; --panel: rgba(6, 12, 26, .78); --line: rgba(126, 249, 255, .28);
  --gold: #ffc24a; --blue: #7ef9ff; --sky: #38bdf8; --steel: #22345c; --red: #ff5a4d; --green: #5ef0a0;
  --hud: 'Orbitron', 'Baloo 2', system-ui, sans-serif; --head: 'Baloo 2', system-ui, sans-serif; --body: 'Nunito', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #04060d; color: var(--ink); font: 700 16px/1.4 var(--body); }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
#cam { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.ta-hud-only { display: none !important; }
body.playing .ta-hud-only { display: flex !important; }
body.playing .ta-hud.ta-hud-only { display: block !important; }

/* ---------- top bar ---------- */
.ta-top {
  position: fixed; z-index: 60; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.ta-top > * { pointer-events: auto; }
.ta-top-right { display: flex; gap: 8px; margin-left: auto; }
.ta-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px;
  border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); color: var(--ink); text-decoration: none;
  font: 800 14px/1 var(--hud); letter-spacing: .04em; text-transform: uppercase; backdrop-filter: blur(8px);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.ta-btn:hover { border-color: var(--gold); color: #fff; }
.ta-btn.off { color: var(--muted); border-color: rgba(255, 90, 77, .6); }
.ta-btn-wide { min-height: 60px; font-size: 16px; }
.ta-mode-chip {
  position: absolute; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 12px; background: linear-gradient(135deg, rgba(34, 52, 92, .92), rgba(10, 18, 38, .92)); border: 1.5px solid var(--gold);
  font: 900 15px/1 var(--hud); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 0 18px rgba(255, 194, 74, .25);
}
body.playing .ta-mode-chip { display: inline-flex; }
@media (max-width: 720px) {
  .ta-btn { padding: 0 11px; min-height: 42px; } .ta-btn b { display: none; } .ta-btn span { font-size: 20px; }
  .ta-mode-chip { top: calc(58px + env(safe-area-inset-top)); font-size: 12px; min-height: 34px; padding: 0 12px; }
}

/* ---------- meters & stats ---------- */
.ta-hud { position: fixed; z-index: 30; inset: 0; pointer-events: none; }
.ta-meters {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: calc(70px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.ta-core {
  --e: 1; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--blue) calc(var(--e) * 360deg), rgba(126, 249, 255, .1) 0);
  box-shadow: 0 0 calc(10px + var(--e) * 24px) rgba(126, 249, 255, calc(.2 + var(--e) * .5));
}
.ta-core::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: radial-gradient(circle, #0b1830, #050a14 70%); border: 2px solid rgba(255, 194, 74, .6); }
.ta-core-in { position: relative; text-align: center; line-height: 1; }
.ta-core-in b { display: block; font: 900 26px/1 var(--hud); color: #fff; text-shadow: 0 0 10px var(--blue); }
.ta-core-in small { font: 800 9px/1 var(--hud); letter-spacing: .18em; color: var(--blue); }
.ta-core.low { animation: ta-blink .5s infinite; }
@keyframes ta-blink { 50% { box-shadow: 0 0 30px rgba(255, 90, 77, .8); } }
.ta-health { width: 190px; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1.5px solid var(--line); }
.ta-health-label { display: block; font: 800 11px/1 var(--hud); letter-spacing: .14em; color: var(--muted); margin-bottom: 6px; }
.ta-health-label b { color: #fff; float: right; }
.ta-health-bar { display: block; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .1); overflow: hidden; }
#health-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--green)); transition: width .25s; }
.ta-health.low #health-fill { background: linear-gradient(90deg, var(--red), #ff9b4d); }
.ta-health.hit { animation: ta-shake .3s; border-color: var(--red); }
@keyframes ta-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ta-stats {
  position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(70px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.ta-stat {
  display: inline-flex; align-items: baseline; gap: 10px; min-width: 150px; justify-content: space-between; padding: 8px 14px;
  border-radius: 10px; background: var(--panel); border: 1.5px solid var(--line); font: 800 11px/1 var(--hud); letter-spacing: .14em; color: var(--muted);
}
.ta-stat[hidden] { display: none; }
.ta-stat b { font-size: 22px; color: #fff; letter-spacing: .02em; }
.ta-score b { color: var(--gold); }
.ta-stat.bump { animation: ta-bump .3s; }
.ta-stat.warn { border-color: var(--red); } .ta-stat.warn b { color: #ffb0a8; }
@keyframes ta-bump { 40% { transform: scale(1.12); } }
@media (max-width: 720px) {
  .ta-meters { top: calc(100px + env(safe-area-inset-top)); }
  .ta-core { width: 74px; height: 74px; } .ta-core-in b { font-size: 18px; } .ta-core-in small { font-size: 7px; }
  .ta-health { width: 120px; padding: 6px 8px; } .ta-health-label { font-size: 9px; }
  .ta-stats { top: calc(100px + env(safe-area-inset-top)); gap: 5px; }
  .ta-stat { min-width: 0; padding: 6px 9px; font-size: 9px; gap: 6px; } .ta-stat b { font-size: 16px; }
}

/* ---------- hint, banner, toast ---------- */
.ta-hint {
  position: fixed; z-index: 35; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; max-width: min(92vw, 640px); padding: 10px 18px; border-radius: 12px; text-align: center;
  background: rgba(4, 10, 24, .82); border: 1.5px solid var(--line); font-size: 17px; pointer-events: none;
}
.ta-hint:empty { display: none; }
.ta-banner {
  position: fixed; z-index: 40; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none;
  text-align: center; font-family: var(--hud); color: #fff; text-shadow: 0 0 18px var(--blue), 0 0 40px var(--sky);
  transition: opacity .25s, transform .35s cubic-bezier(.2, .9, .3, 1.3);
}
.ta-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ta-banner b { display: block; font-size: clamp(40px, 10vw, 110px); font-weight: 900; letter-spacing: .06em; line-height: 1; }
.ta-banner small { display: block; font-size: clamp(16px, 3.4vw, 34px); font-weight: 800; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; text-shadow: 0 0 14px rgba(255, 194, 74, .8); }
.ta-banner.count b { font-size: clamp(70px, 16vw, 160px); }
.ta-toast {
  position: fixed; z-index: 70; left: 50%; top: 26%; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 12px 22px; border-radius: 12px; background: rgba(6, 14, 30, .92); border: 1.5px solid var(--gold); color: #fff;
  font: 800 19px/1.25 var(--head); text-align: center; max-width: 90vw; transition: opacity .2s, transform .2s;
}
.ta-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- power panel ---------- */
.ta-powers {
  position: fixed; z-index: 36; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  gap: 8px; padding: 8px; border-radius: 16px; background: rgba(4, 10, 24, .72); border: 1.5px solid var(--line); backdrop-filter: blur(6px);
  max-width: calc(100vw - 16px); overflow-x: auto;
}
.ta-power {
  --k: 0; position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 76px; padding: 8px 4px 7px;
  border-radius: 12px; border: 1.5px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .05); overflow: hidden;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.ta-power i { font-style: normal; font-size: 26px; line-height: 1; }
.ta-power span { font: 800 10px/1 var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ta-power.on { border-color: var(--blue); background: rgba(126, 249, 255, .18); box-shadow: 0 0 18px rgba(126, 249, 255, .6); transform: translateY(-4px); }
.ta-power.on span { color: #fff; }
.ta-power-charge::after { content: ''; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--k) * 100%); background: linear-gradient(90deg, var(--blue), var(--gold)); }
@media (max-width: 720px) { .ta-power { width: 56px; padding: 6px 2px; } .ta-power i { font-size: 21px; } .ta-power span { font-size: 8px; } .ta-hint { bottom: calc(86px + env(safe-area-inset-bottom)); font-size: 15px; } }

/* ---------- gesture guide ---------- */
.ta-guide {
  position: fixed; z-index: 65; right: max(12px, env(safe-area-inset-right)); top: calc(66px + env(safe-area-inset-top));
  width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 190px); overflow: auto; padding: 14px 16px;
  border-radius: 16px; background: rgba(4, 10, 24, .94); border: 1.5px solid var(--gold); box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}
.ta-guide[hidden] { display: none; }
.ta-guide-head { display: flex; align-items: center; justify-content: space-between; }
.ta-guide h2 { margin: 0; font: 900 16px/1 var(--hud); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.ta-x { width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); }
.ta-guide ol { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.ta-guide li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid transparent; }
.ta-guide li.focus { border-color: var(--blue); background: rgba(126, 249, 255, .12); }
.ta-guide li i { font-style: normal; font-size: 26px; line-height: 1.1; }
.ta-guide li b { display: block; font: 800 15px/1.2 var(--head); color: #fff; }
.ta-guide li span { font-size: 14px; color: var(--muted); }

/* ---------- screens ---------- */
.ta-screen {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 70px 16px 18px; overflow: auto; touch-action: pan-y;
  background: radial-gradient(900px 600px at 15% 0%, rgba(56, 189, 248, .22), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, rgba(255, 194, 74, .16), transparent 60%),
    repeating-linear-gradient(0deg, rgba(126, 249, 255, .04) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(126, 249, 255, .04) 0 1px, transparent 1px 34px), #04060d;
}
.ta-screen[hidden] { display: none; }
.ta-see { background: rgba(3, 6, 14, .62); backdrop-filter: blur(4px); }
.ta-intro-in { width: min(940px, 100%); text-align: center; }
.ta-kicker { margin: 6px 0 0; font: 800 13px/1 var(--hud); letter-spacing: .3em; text-transform: uppercase; color: var(--blue); }
.ta-intro h1, .ta-card h1 { margin: 8px 0; font: 900 clamp(40px, 9vw, 88px)/1 var(--hud); letter-spacing: .06em; text-shadow: 0 0 24px rgba(126, 249, 255, .5); }
.ta-card h1 { font-size: clamp(26px, 5vw, 40px); }
.ta-intro h1 em { font-style: normal; color: var(--gold); text-shadow: 0 0 24px rgba(255, 194, 74, .6); }
.ta-lead { color: var(--muted); font-size: 18px; max-width: 62ch; margin: 6px auto 18px; }
.ta-sub { margin: 18px 0 10px; font: 800 13px/1 var(--hud); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.ta-emblem {
  width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle, #fff 0 12%, var(--blue) 24%, rgba(56, 189, 248, .25) 46%, transparent 70%);
  animation: ta-pulse 2s ease-in-out infinite;
}
.ta-emblem::before { content: ''; position: absolute; inset: 14px; border: 3px solid var(--gold); clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.ta-emblem span { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(126, 249, 255, .7); animation: ta-rot 8s linear infinite; }
.ta-spin span { animation-duration: 1.4s; }
@keyframes ta-pulse { 50% { filter: brightness(1.35); transform: scale(1.04); } }
@keyframes ta-rot { to { transform: rotate(360deg); } }
.ta-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ta-mode {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 12px; border-radius: 16px;
  background: rgba(10, 20, 40, .8); border: 2px solid rgba(255, 255, 255, .12); text-align: center; transition: transform .12s, border-color .12s;
}
.ta-mode i { font-style: normal; font-size: 40px; line-height: 1; }
.ta-mode b { font: 900 16px/1 var(--hud); letter-spacing: .06em; text-transform: uppercase; }
.ta-mode small { color: var(--muted); font-size: 14px; }
.ta-mode-best { font-size: 13px; color: var(--gold); min-height: 1.2em; }
.ta-mode:hover { transform: translateY(-3px); }
.ta-mode.on { border-color: var(--blue); background: linear-gradient(180deg, rgba(56, 189, 248, .25), rgba(10, 20, 40, .85)); box-shadow: 0 0 24px rgba(126, 249, 255, .35); }
.ta-suits { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ta-suit {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px;
  background: rgba(10, 20, 40, .8); border: 2px solid rgba(255, 255, 255, .15); font-weight: 800;
}
.ta-suit::before { content: ''; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); border: 2px solid rgba(255, 255, 255, .5); }
.ta-suit.on { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 194, 74, .4); }
.ta-start {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 72px; margin: 24px 0 8px; padding: 0 36px;
  border: 0; border-radius: 14px; text-decoration: none; color: #1a1000; font: 900 clamp(18px, 3.4vw, 26px)/1 var(--hud); letter-spacing: .08em;
  background: linear-gradient(180deg, #ffe7a3, var(--gold) 45%, #c98a12); box-shadow: 0 0 0 2px rgba(255, 255, 255, .5) inset, 0 8px 0 #7a520c, 0 0 40px rgba(255, 194, 74, .5);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  animation: ta-pulse 2.4s ease-in-out infinite;
}
.ta-start:active { transform: translateY(3px); }
.ta-small { font-size: 13px; color: var(--muted); margin: 6px 0; }
.ta-link { display: inline-block; margin-top: 8px; color: var(--muted); font-weight: 800; }
.ta-card {
  width: min(560px, 100%); text-align: center; padding: 26px 22px; border-radius: 20px; background: rgba(6, 12, 26, .92);
  border: 1.5px solid var(--line); box-shadow: 0 30px 60px rgba(0, 0, 0, .55);
}
.ta-card p { color: var(--muted); }
.ta-card .ta-emblem { width: 90px; height: 90px; }
.ta-big-ic { font-size: 54px; }
.ta-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 12px; }
.ta-actions .ta-start { margin: 0; }
.ta-load { list-style: none; padding: 0; margin: 14px auto; max-width: 320px; text-align: left; display: grid; gap: 6px; }
.ta-load li { padding: 8px 12px 8px 36px; border-radius: 10px; background: rgba(255, 255, 255, .05); color: var(--muted); position: relative; }
.ta-load li::before { content: '○'; position: absolute; left: 12px; }
.ta-load li.on { color: #fff; } .ta-load li.on::before { content: '◌'; color: var(--blue); animation: ta-rot 1s linear infinite; display: inline-block; }
.ta-load li.done { color: var(--green); } .ta-load li.done::before { content: '✓'; }
.ta-progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; max-width: 320px; margin: 0 auto; }
#load-bar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky), var(--blue)); transition: width .3s; }
.ta-over-score b { font: 900 64px/1 var(--hud); color: var(--gold); text-shadow: 0 0 20px rgba(255, 194, 74, .5); }
.ta-new { color: var(--green) !important; font: 800 22px/1.1 var(--head); }
@media (max-width: 720px) {
  .ta-modes { grid-template-columns: 1fr; } .ta-mode { flex-direction: row; text-align: left; flex-wrap: wrap; } .ta-mode i { font-size: 30px; }
  .ta-mode small { flex-basis: 100%; } .ta-lead { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
