:root { --charged-ring-color: #c5f0ff; --charged-glow-color: #91dfff; color-scheme: light; font-family: system-ui, sans-serif; color: #24394a; background: #f7f4ec; }
    * { box-sizing: border-box; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
    html, body { touch-action: manipulation; }
    body { margin: 0; min-height: 100svh; display: grid; place-items: center; padding: calc(128px + env(safe-area-inset-top)) 20px calc(270px + env(safe-area-inset-bottom)); }
    body::before { content: ''; position: fixed; inset: 0; background: url('arena-wash.png') center / cover; opacity: .3; pointer-events: none; }
    main { position: relative; width: 100%; max-width: 440px; text-align: center; }
    .eyebrow { color: #647987; font-size: 10px; letter-spacing: .24em; text-transform: uppercase; margin: 0 0 7px; }
    h1 { font-family: Georgia, 'Times New Roman', serif; font-size: 34px; font-weight: 400; letter-spacing: .025em; margin: 0; color: #263c50; }
    h1::after { content: ''; display: block; width: 66px; height: 2px; margin: 12px auto 0; background: linear-gradient(90deg, transparent, #7d9bac, transparent); }
    .arena { position: relative; isolation: isolate; height: 230px; overflow-x: clip; }
    .arena::before { content: ''; position: absolute; z-index: -1; inset: -8px -20px -28px; background: url('arena-wash.png') center / 100% 100%; opacity: .85; -webkit-mask-image: radial-gradient(ellipse, #000 45%, transparent 75%); mask-image: radial-gradient(ellipse, #000 45%, transparent 75%); }
    .arena::after { content: ''; position: absolute; bottom: -2px; left: 3%; right: 3%; height: 3px; background: linear-gradient(90deg, transparent, #667d8c66 25%, #a4b7bf88 65%, transparent); clip-path: polygon(0 40%, 18% 0, 42% 30%, 60% 0, 100% 35%, 90% 100%, 55% 65%, 30% 100%, 0 80%); }
    .character { position: absolute; bottom: 0; width: 120px; height: 180px; transform: translateX(-50%); pointer-events: none; --facing: 1; }
    #character-0 { left: 20%; }
    #character-1 { left: 80%; }
    .sprite { position: absolute; bottom: -6px; left: -20px; width: 160px; height: 160px; overflow: hidden; clip-path: inset(1.5%); transform-origin: 50% 94%; transform: translate(var(--pose-shift, 0%), calc(var(--pose-lift, 0px) + var(--frame-ground, 0%))) rotate(var(--pose-tilt, 0deg)) scaleX(var(--facing)); }
    .sprite img { display: block; width: 400%; max-width: none; height: 200%; transform: translate(var(--frame-x, 0%), var(--frame-y, 0%)); }
    #character-1 { --facing: -1; }
    .character.hurt .sprite img { filter: brightness(0) saturate(100%) invert(91%) sepia(11%) saturate(660%) hue-rotate(168deg) brightness(102%) contrast(94%); }
    .character.dead .sprite { opacity: .3; }
    #character-1.dead .sprite { animation: enemy-defeat 1.1s ease-out both; }
    #character-1.dead::after { content: ''; position: absolute; pointer-events: none; left: 50%; bottom: 30%; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, #fff3cc 0 5%, #efba6b99 12%, transparent 48%), radial-gradient(circle at 20% 35%, #e9b75a 0 3%, transparent 5%), radial-gradient(circle at 78% 24%, #fff0aa 0 3%, transparent 5%), radial-gradient(circle at 65% 80%, #e3a951 0 3%, transparent 5%); animation: defeat-burst .8s ease-out both; }
    @keyframes enemy-defeat { 0% { opacity: 1; } 18% { opacity: 1; filter: brightness(1.8); } 100% { opacity: 0; translate: 0 15px; rotate: -18deg; scale: .85; } }
    @keyframes defeat-burst { 0% { transform: translate(-50%, 35%) scale(.15); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(-50%, 35%) scale(1.3); opacity: 0; } }
    .charge-burst { display: none; position: absolute; z-index: 3; pointer-events: none; left: 50%; bottom: 15%; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, #f0fcff 0 4%, var(--charged-ring-color) 8%, #91dfff66 22%, transparent 55%), radial-gradient(circle at 12% 30%, var(--charged-ring-color) 0 2%, transparent 4%), radial-gradient(circle at 85% 20%, var(--charged-glow-color) 0 3%, transparent 5%), radial-gradient(circle at 76% 85%, var(--charged-ring-color) 0 2%, transparent 4%), radial-gradient(circle at 22% 80%, var(--charged-glow-color) 0 3%, transparent 5%); }
    .charge-burst::before { content: ''; position: absolute; inset: 12%; border: 2px solid var(--charged-ring-color); border-radius: 50%; box-shadow: 0 0 9px var(--charged-glow-color), inset 0 0 8px #c5f0ff66; }
    .charged-hit .charge-burst { display: block; animation: charged-impact .45s ease-out both; }
    @keyframes charged-impact { 0% { transform: translate(-50%, 35%) scale(.2); opacity: 1; } 25% { opacity: 1; } 100% { transform: translate(-50%, 35%) scale(1.35); opacity: 0; } }
    @media (prefers-reduced-motion: reduce) { .charged-hit .charge-burst { animation: none; transform: translate(-50%, 35%) scale(.8); opacity: .65; } }
    @media (prefers-reduced-motion: reduce) { #character-1.dead .sprite { animation: none; opacity: .2; } #character-1.dead::after { animation: none; display: none; } }
    #character-0.powered .sprite { filter: drop-shadow(0 0 var(--charge-glow) #38bfff) drop-shadow(0 0 calc(var(--charge-glow) * .5) #b9f3ff); }
    #character-0.dodging .sprite { opacity: .5; }
    .fighter-hud { position: absolute; z-index: 2; bottom: 174px; left: clamp(50px, var(--fighter-x), calc(100% - 50px)); width: 92px; transform: translateX(-50%); pointer-events: none; }
    .fighter-hud .meter { height: 6px; box-shadow: 0 1px 3px #f7f4ec; }
    .fighter-hud .hud-stamina { height: 4px; margin-top: 5px; }
    .fighter-hud .hud-stamina::before { background: linear-gradient(90deg, #847245, #d4bc78); }
    .fighter-hud .hud-stamina { position: relative; }
    .damage-number { position: absolute; bottom: 20px; left: 50%; font: 26px Georgia, 'Times New Roman', serif; font-variant-numeric: tabular-nums; color: #943f3e; text-shadow: 0 1px 2px #fffdf5, 1px 0 2px #fffdf5, -1px 0 2px #fffdf5; opacity: 0; transform: translate(-50%, 0); white-space: nowrap; }
    .hud-stamina::after { content: ''; position: absolute; top: 0; bottom: 0; left: var(--dodge-threshold, 50%); width: 1px; background: #faf7ee; }
    .stats { position: fixed; z-index: 10; top: 0; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 40px)); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; background: #f7f4ecf2; box-shadow: 0 8px 16px #f7f4ec; }
    .stats section { min-width: 0; padding: 10px 8px; border-top: 1px solid #9aaab080; border-bottom: 1px solid #9aaab060; background: linear-gradient(180deg, #fffdf480, #e8eff040); }
    .stats section h2 { line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
    h2 { font-family: Georgia, 'Times New Roman', serif; font-size: 17px; font-weight: 400; margin: 0 0 4px; }
    p { font-size: 15px; margin: 8px 0; font-variant-numeric: tabular-nums; }
    .health { margin: 4px 0 8px; font-size: 13px; color: #526573; }
    .health span { font-size: 24px; color: #243f55; }
    .meter { height: 7px; background: #60788726; overflow: hidden; clip-path: polygon(0 15%, 22% 0, 67% 10%, 100% 0, 99% 85%, 74% 100%, 35% 85%, 0 100%); }
    .meter::before { content: ''; display: block; width: var(--fill, 100%); height: 100%; background: linear-gradient(90deg, #2b5b7a, #79b5d1); }
    #health-bar-1::before { background: linear-gradient(90deg, #536779, #9badb8); }
    .controls { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 40px)); padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); text-align: center; background: #f7f4ecf2; box-shadow: 0 -12px 20px #f7f4ec; }
    .combat-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 0; }
    .details, .timer { color: #526573; font-size: 12px; }
    .timer span { color: #214d6a; font-weight: 600; font-size: 15px; }
    .actions { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .charge-control, .dodge-control { min-width: 0; }
    .attack-cooldown { margin-bottom: 9px; font: 11px system-ui, sans-serif; color: #526573; }
    .cooldown-label { display: flex; justify-content: space-between; gap: 5px; margin-bottom: 5px; }
    .cooldown-track { height: 5px; border-radius: 3px; background: #60788726; overflow: hidden; }
    .cooldown-track::before { content: ''; display: block; height: 100%; width: var(--cooldown-fill, 0%); background: #7899a7; }
    .attack-cooldown[data-ready="true"] { color: #4e7452; }
    .attack-cooldown[data-ready="true"] .cooldown-track::before { background: #789b71; }
    #dodge { width: 100%; min-height: 104px; }
    #dodge[data-low-stamina="true"] { background: linear-gradient(145deg, #b8c3ca, #96a8b4); color: #3c5465; border-color: #879ba8; box-shadow: inset 0 0 0 3px #d4dfe433; opacity: 1; }
    #status { min-height: 22px; margin: 12px 0 8px; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; font-style: italic; color: #466579; }
    button { position: relative; font: inherit; font-family: Georgia, 'Times New Roman', serif; font-size: 19px; color: #274d68; background: linear-gradient(145deg, #fffdf6, #e8edf0); border: 1px solid #98abb5; border-radius: 2px; box-shadow: inset 0 0 0 3px #fffdf580, 0 2px 0 #637b881a; min-height: 68px; padding: 10px 12px; cursor: pointer; touch-action: manipulation; }
    button::after { content: ''; position: absolute; height: 2px; bottom: 4px; left: 12%; right: 12%; background: linear-gradient(90deg, transparent, #8aa8b580, transparent); pointer-events: none; }
    button:active { background: #dcebf2; box-shadow: inset 0 0 0 3px #a8cad34d; }
    button:disabled { opacity: .4; cursor: default; }
    #charge { --charge-fill: 0%; --charge-shadow: 0px; --charge-alpha: 0; width: 100%; min-height: 104px; color: #f6fbff; background: linear-gradient(130deg, #385c78, #23475e); border-color: #729cb5; border-radius: 8px; box-shadow: inset 0 0 0 3px #adcbd42b, 0 0 var(--charge-shadow) rgb(49 170 255 / var(--charge-alpha)); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
    #charge::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(0deg, #1686ed, #42baff); clip-path: inset(calc(100% - var(--charge-fill)) 0 0 0); pointer-events: none; }
    #charge::after { inset: -3px; height: auto; border: 2px solid var(--charged-ring-color); border-radius: 10px; background: none; opacity: 0; box-shadow: 0 0 9px var(--charged-glow-color), 0 0 20px #75d5ff99, inset 0 0 8px #c5f0ff66; transition: opacity .15s; }
    #charge.fully-charged::after { opacity: 1; }
    #charge:disabled, #charge[data-busy="true"] { opacity: .65; }
    #charge > span { position: relative; z-index: 1; }
    #charge *, #dodge * { pointer-events: none; }
    #charge, #dodge { -webkit-tap-highlight-color: transparent; }
    .charge-label { display: block; }
    .charge-hint { display: block; font: 11px system-ui, sans-serif; margin-top: 4px; color: #e4f1f9; }
    #charge-timer { font-variant-numeric: tabular-nums; }
    .button-note { display: block; font: 11px system-ui, sans-serif; letter-spacing: .02em; margin-top: 5px; }
    .button-note { color: #526573; }
    #ready { min-width: 160px; }
    #ready-panel { text-align: center; gap: 10px; }
    #reset, #restart-run { font-size: 15px; min-height: 44px; min-width: 132px; padding: 8px 28px; background: #fffdf480; }
    #restart-run { margin-top: 16px; }
    button:focus-visible { outline: 2px solid #26759e; outline-offset: 4px; }
    @media (max-width: 360px) { body { padding: calc(128px + env(safe-area-inset-top)) 12px calc(270px + env(safe-area-inset-bottom)); } h1 { font-size: 30px; } .character { width: 100px; height: 150px; } .sprite { width: 150px; height: 150px; left: -25px; bottom: -6px; } .arena { height: 210px; } .fighter-hud { bottom: 158px; } .stats { width: calc(100% - 24px); gap: 10px; } .controls { width: calc(100% - 24px); } .stats section { padding-inline: 4px; } button { font-size: 17px; padding-inline: 6px; } }

    .health [id^="max-hp"] { font-size: 13px; color: #526573; }
    [hidden] { display: none !important; }
    body { padding-top: calc(240px + env(safe-area-inset-top)); }
    .journey { display: flex; list-style: none; padding: 0; margin: 18px 0 10px; gap: 6px; font-size: 11px; color: #71828b; }
    .journey li { flex: 1; border-bottom: 2px solid #bdc6c6; padding-bottom: 8px; }
    .journey li[data-state="current"] { color: #244b63; border-color: #3e8198; font-weight: 650; }
    .journey li[data-state="complete"] { color: #637345; border-color: #8a9b6e; }
    #encounter-progress { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #687b88; }
    .encounter-overview { grid-column: 1 / -1; text-align: center; }
    .encounter-overview .journey { margin: 10px 0 0; }
    .encounter-header { margin-bottom: 5px; }
    #character-1 { --enemy-size: 152px; }
    #character-1 .sprite { left: 50%; margin-left: calc(var(--enemy-size) * -.5); width: var(--enemy-size); height: var(--enemy-size); bottom: calc(var(--enemy-size) * var(--enemy-ground, .1) * -1); filter: none; }
    #character-1 .sprite img { height: calc(var(--sprite-rows, 2) * 100%); }
    #character-1[data-telegraph="overhead"].windup .sprite { filter: drop-shadow(0 0 4px #d5964980); }
    #character-1[data-telegraph="release"] .sprite { filter: drop-shadow(0 0 5px #e0803880); }
    .arena[data-phase="travel"]::before { animation: scenery-travel 1.8s linear infinite; background-size: 150% 100%; }
    .arena[data-phase="travel"] #character-0 .sprite { animation: journey-step .32s ease-in-out infinite alternate; }
    .arena[data-phase="travel"] #character-1, .arena[data-phase="travel"] .fighter-hud { opacity: 0; }
    @keyframes scenery-travel { from { background-position: 0% center; } to { background-position: 100% center; } }
    @keyframes journey-step { from { margin-bottom: 0; } to { margin-bottom: 5px; } }
    .run-panel { position: relative; margin: 14px 0; padding: 20px 16px; background: #fffdf3ee; border: 1px solid #abb6b0; box-shadow: 0 8px 24px #41586014; }
    .run-panel h2 { font-size: 24px; }
    .run-panel > p { font-size: 13px; color: #687980; line-height: 1.5; }
    #reward-choices { display: grid; gap: 8px; margin-top: 14px; }
    #reward-choices button { min-height: 64px; font-size: 17px; text-align: left; padding: 12px 16px; }
    #reward-choices .reward-choice { color: var(--rarity-color); border-color: var(--rarity-color); border-left-width: 4px; background: linear-gradient(120deg, #fffdf7, var(--rarity-tint)), #fffdf7; }
    #reward-choices .reward-choice:hover, #reward-choices .reward-choice:focus-visible { outline: 2px solid var(--rarity-color); outline-offset: 2px; }
    #reward-choices button span, #reward-choices button small { display: block; font: 12px system-ui, sans-serif; color: #63747c; margin-top: 5px; line-height: 1.4; }
    #total-score { display: block; font: 48px Georgia, serif; color: #29556b; margin: 10px 0 3px; }
    #result-details { white-space: pre-line; }
    body:has(.arena[data-phase="ready"]) .controls .combat-details,
    body:has(.arena[data-phase="ready"]) .controls .actions,
    body:has(.arena[data-phase="reward"]) .controls .combat-details,
    body:has(.arena[data-phase="reward"]) .controls .actions,
    body:has(.arena[data-phase="complete"]) .controls .combat-details,
    body:has(.arena[data-phase="complete"]) .controls .actions,
    body:has(.arena[data-phase="defeat"]) .controls .combat-details,
    body:has(.arena[data-phase="defeat"]) .controls .actions { display: none; }
    .run-panel:not([hidden]) { position: fixed; z-index: 20; top: calc(226px + env(safe-area-inset-top)); bottom: calc(110px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); margin: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; justify-content: center; }
    #ready-panel:not([hidden]) { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); }
    body:has(.arena[data-phase="ready"]) .controls { bottom: calc(200px + env(safe-area-inset-bottom)); padding: 0; background: transparent; box-shadow: none; }
    #reward-choices { flex-shrink: 0; }
    @media (max-height: 640px) { .run-panel:not([hidden]) { justify-content: flex-start; padding-top: 14px; } .run-panel h2 { font-size: 21px; } #reward-choices { margin-top: 8px; gap: 6px; } #reward-choices button { min-height: 58px; } }
    .run-panel:focus { outline: 2px solid #6d94a6; outline-offset: 4px; }
    @media (max-width: 360px) { body { padding-top: calc(236px + env(safe-area-inset-top)); } .journey { font-size: 10px; gap: 4px; } .run-panel { padding: 16px 12px; } }
    @media (prefers-reduced-motion: reduce) { .arena[data-phase="travel"]::before, .arena[data-phase="travel"] #character-0 .sprite { animation: none; } }
.mode-link { font: 12px system-ui, sans-serif; color: #426779; text-underline-offset: 3px; }
