:root {
  color-scheme: light;
  --bg: #eaf7ff;
  --bg-2: #fff8e8;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(244, 250, 255, 0.96);
  --line: rgba(48, 104, 156, 0.2);
  --ink: #17324d;
  --muted: #61788e;
  --cyan: #3a8bd8;
  --orange: #f4a641;
  --red: #e65a6f;
  --violet: #8c6bc9;
  --green: #42a97e;
  --shadow: 0 20px 55px rgba(71, 121, 155, 0.18);
  --display: "Arial Rounded MT Bold", "Microsoft JhengHei", sans-serif;
  --body: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 199, 99, 0.28), transparent 28rem),
    radial-gradient(circle at 88% 82%, rgba(86, 193, 211, 0.22), transparent 30rem),
    linear-gradient(140deg, var(--bg), #f8fcff 58%, var(--bg-2));
  overflow-x: hidden;
}

button, input { font: inherit; }
button { border: 0; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, input:focus-visible, .drop-zone:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

.signal-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(58, 139, 216, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 139, 216, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 48px;
}

.screen { animation: enter 300ms ease both; }

@keyframes enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-shell { min-height: 100dvh; padding-top: 14px; padding-bottom: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--cyan), #59c2cf);
  border-radius: 10px;
  font-weight: 1000;
  box-shadow: 0 8px 20px rgba(58, 139, 216, 0.25);
}

.brand strong { font-family: var(--display); letter-spacing: 0.02em; }

.status-strip { display: flex; align-items: center; gap: 8px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 11px;
  color: var(--muted);
  background: #f1f8fd;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill strong { color: var(--cyan); }

.hero,
.briefing,
.result-card,
.identity-screen {
  min-height: calc(100dvh - 48px);
  padding: clamp(28px, 7vw, 82px);
  border-radius: 30px;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(30px, 6vw, 90px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 1000;
  letter-spacing: 0.2em;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); }
h1 { margin-bottom: 18px; font-size: clamp(2.7rem, 8vw, 6rem); line-height: 0.98; letter-spacing: -0.06em; }
h1 span { display: block; color: var(--orange); }
h2 { margin-bottom: 12px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -0.04em; }
h3 { margin-bottom: 8px; }
p { line-height: 1.7; }
.lead { color: #405e77; font-size: 1.08rem; }
.muted { color: var(--muted); }

.hero-cards {
  position: relative;
  min-height: 390px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.hero-cards::before {
  content: "";
  position: absolute;
  width: 270px;
  height: 270px;
  border: 1px solid rgba(39, 216, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(39, 216, 255, 0.035), 0 0 0 52px rgba(154, 124, 255, 0.035);
}

.hero-card {
  position: absolute;
  width: 190px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  background: linear-gradient(155deg, #634275, #291841 70%);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  transform: rotate(-11deg) translate(-54px, 10px);
}

.hero-card:nth-child(2) { transform: rotate(10deg) translate(54px, -6px); background: linear-gradient(155deg, #6e3158, #291538 72%); }
.hero-card:nth-child(3) { z-index: 2; transform: rotate(1deg) translateY(-28px); background: linear-gradient(155deg, #79502d, #33213b 72%); }

.card-orb {
  display: grid;
  width: 104px;
  height: 104px;
  margin: 14px auto 24px;
  place-items: center;
  color: var(--cyan);
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 28px currentColor, inset 0 0 24px rgba(255,255,255,0.12);
  font-size: 3rem;
}

.hero-card strong { display: block; text-align: center; letter-spacing: 0.08em; }
.hero-card small { display: block; margin-top: 7px; color: var(--muted); text-align: center; }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.primary-button, .secondary-button, .ghost-button {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 1000;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
}
.primary-button { color: #22132d; background: linear-gradient(135deg, var(--cyan), #b8f28c); box-shadow: 0 0 24px rgba(114, 242, 195, 0.24); }
.secondary-button { color: #22132d; background: linear-gradient(135deg, var(--orange), #ffd28d); }
.ghost-button { color: var(--ink); background: rgba(255,255,255,0.08); border: 1px solid var(--line); }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .ghost-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.briefing { max-width: 850px; margin: 0 auto; }
.brief-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 28px 0; }
.brief-item { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.045); }
.brief-item strong { display: block; color: var(--cyan); margin-bottom: 5px; }

.identity-screen { max-width: 960px; margin: 0 auto; }
.identity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 32px 0; }
.identity-card { min-height: 270px; padding: 20px; color: var(--ink); text-align: center; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(155deg, rgba(255,255,255,0.1), rgba(24,12,40,0.72)); box-shadow: 0 18px 35px rgba(0,0,0,0.25); transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.identity-card:hover, .identity-card.selected { border-color: var(--identity-accent); box-shadow: 0 0 28px color-mix(in srgb, var(--identity-accent) 28%, transparent); transform: translateY(-5px); }
.identity-card strong { display: block; margin-bottom: 8px; font-size: 1.15rem; }
.identity-card small { display: block; color: var(--muted); line-height: 1.55; }
.identity-avatar { position: relative; display: grid; width: 132px; height: 150px; margin: 0 auto 18px; place-items: center; color: var(--identity-accent); border: 2px solid var(--identity-accent); border-radius: 48% 52% 42% 58%; background: radial-gradient(circle at 38% 28%, rgba(255,255,255,0.85), transparent 13%), linear-gradient(145deg, color-mix(in srgb, var(--identity-accent) 32%, #4a235f), #1a122c 70%); box-shadow: 0 0 24px color-mix(in srgb, var(--identity-accent) 30%, transparent), inset -14px -18px 0 rgba(0,0,0,0.18), inset 12px 12px 0 rgba(255,255,255,0.07); transform: perspective(300px) rotateY(-8deg); }
.identity-avatar::before { content: ""; position: absolute; top: 43px; width: 50px; height: 28px; border: 2px solid currentColor; border-bottom: 0; border-radius: 50% 50% 0 0; opacity: 0.8; }
.identity-avatar::after { content: ""; position: absolute; bottom: 25px; width: 58px; height: 8px; border-radius: 99px; background: currentColor; opacity: 0.55; }
.identity-avatar span { position: relative; z-index: 1; margin-top: 2px; font-family: ui-monospace, monospace; font-size: 2.3rem; font-weight: 1000; text-shadow: 0 0 15px currentColor; }

.battle-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.battle-main { min-width: 0; }
.battle-panel { padding: clamp(18px, 4vw, 32px); border-radius: 24px; }
.battle-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.battle-heading h2 { margin-bottom: 4px; font-size: clamp(1.45rem, 3vw, 2.35rem); }
.round-label { color: var(--muted); font-size: 0.9rem; }
.progress-line { height: 7px; margin-bottom: 22px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,0.1); }
.progress-line span { display: block; width: var(--progress); height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); border-radius: inherit; transition: width 320ms ease; }

.encounter {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.monster-zone {
  position: relative;
  min-height: 290px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 107, 154, 0.38);
  border-radius: 20px;
  background: radial-gradient(circle, rgba(255, 107, 154, 0.19), transparent 52%), linear-gradient(145deg, rgba(255, 107, 154, 0.12), rgba(24, 12, 40, 0.45));
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.monster-zone::before, .monster-zone::after { content: ""; position: absolute; border: 1px solid rgba(255, 107, 154, 0.22); border-radius: 50%; }
.monster-zone::before { width: 230px; height: 230px; }
.monster-zone::after { width: 170px; height: 170px; }
.monster-zone.drag-over, .monster-zone.armed { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 32px rgba(114, 242, 195, 0.28); transform: scale(1.01); }
.monster-zone.hit { animation: hit 450ms ease; }
.monster-zone.counter { animation: counter 450ms ease; }
@keyframes hit { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-9px) rotate(-2deg); } 75% { transform: translateX(9px) rotate(2deg); } }
@keyframes counter { 0%,100% { filter: none; } 50% { filter: drop-shadow(0 0 20px var(--red)); transform: scale(1.03); } }

.monster-zone.hit .monster-core { animation: core-hit 600ms cubic-bezier(.2,.8,.2,1); }
.monster-zone.counter .monster-core { animation: core-counter 620ms cubic-bezier(.2,.8,.2,1); }
@keyframes core-hit { 0% { transform: scale(1); } 45% { transform: scale(0.72) rotate(-8deg); filter: brightness(2); } 100% { transform: scale(1); } }
@keyframes core-counter { 0% { transform: translateX(0); } 35% { transform: translateX(-14px) rotate(-6deg); } 70% { transform: translateX(12px) rotate(5deg); } 100% { transform: translateX(0); } }
.combat-burst { position: absolute; z-index: 4; top: 50%; left: 50%; padding: 8px 12px; border: 1px solid currentColor; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 0.72rem; font-weight: 1000; letter-spacing: 0.12em; pointer-events: none; transform: translate(-50%, -50%); animation: burst 700ms ease both; }
.combat-burst.attack { color: var(--green); background: rgba(184,242,140,0.16); box-shadow: 0 0 22px rgba(184,242,140,0.45); }
.combat-burst.counter { color: var(--red); background: rgba(255,107,154,0.16); box-shadow: 0 0 22px rgba(255,107,154,0.45); }
@keyframes burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-12deg); } 35% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(4deg); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }
.battle-wrong { animation: player-hit 520ms ease; }
@keyframes player-hit { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
.safety-value.damaged { animation: shield-hit 560ms ease; }
@keyframes shield-hit { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px) rotate(-3deg); } 75% { transform: translateX(8px) rotate(3deg); } }

.monster-core { position: relative; z-index: 1; display: grid; width: 150px; height: 150px; place-items: center; color: var(--orange); border: 2px solid currentColor; border-radius: 38% 62% 54% 46%; background: linear-gradient(145deg, rgba(255, 177, 92, 0.32), rgba(48, 19, 57, 0.9)); box-shadow: 0 0 28px rgba(255, 177, 92, 0.45), inset 0 0 22px rgba(255,255,255,0.12), inset -16px -18px 0 rgba(17, 7, 27, 0.26); font-size: 4.2rem; font-weight: 1000; transform: perspective(500px) rotateY(-8deg); }
.monster-core::before, .monster-core::after { content: ""; position: absolute; top: 38px; width: 12px; height: 22px; border-radius: 50%; background: #22132d; box-shadow: 0 0 0 3px currentColor; }
.monster-core::before { left: 38px; }
.monster-core::after { right: 38px; }
.monster-name { position: absolute; bottom: 18px; z-index: 2; color: #ffd8a0; font-weight: 1000; letter-spacing: 0.08em; }
.weakness { position: absolute; top: 16px; z-index: 2; color: var(--red); font-size: 0.75rem; font-weight: 1000; letter-spacing: 0.15em; }

.situation-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.045); }
.situation-card h3 { color: var(--cyan); }
.situation-card p:last-child { margin-bottom: 0; }

.drop-hint { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }
.action-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.action-card { position: relative; min-height: 176px; padding: 14px; color: var(--ink); text-align: left; border: 1px solid rgba(114, 242, 195, 0.3); border-radius: 16px; background: linear-gradient(155deg, #49306d, #251638 75%); box-shadow: 0 12px 26px rgba(0,0,0,0.23), inset -8px -10px 0 rgba(15, 7, 25, 0.18); transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; touch-action: none; transform: perspective(700px) rotateX(1deg); }
.action-card::before { content: "ACTION"; display: block; margin-bottom: 22px; color: var(--cyan); font-size: 0.64rem; font-weight: 1000; letter-spacing: 0.16em; }
.action-card:hover, .action-card.armed { border-color: var(--cyan); box-shadow: 0 0 24px rgba(114, 242, 195, 0.25); transform: perspective(700px) translateY(-5px) rotateX(1deg); }
.action-card.armed { outline: 2px solid var(--cyan); outline-offset: 2px; }
.action-card.correct { border-color: var(--green); box-shadow: 0 0 26px rgba(97,229,177,0.22); }
.action-card.wrong { border-color: var(--red); opacity: 0.62; }
.action-key { display: inline-grid; width: 30px; height: 30px; margin-bottom: 12px; place-items: center; color: var(--bg); background: var(--orange); border-radius: 9px; font-weight: 1000; }
.action-text { display: block; line-height: 1.55; }

.side-stack { display: grid; align-content: start; gap: 12px; }
.side-card { padding: 18px; border-radius: 18px; }
.side-card h3 { margin-bottom: 12px; font-size: 1rem; }
.safety-value { display: flex; gap: 8px; margin: 12px 0 6px; }
.shield { display: grid; width: 38px; height: 44px; place-items: center; color: var(--cyan); border: 1px solid currentColor; clip-path: polygon(50% 0, 93% 17%, 84% 75%, 50% 100%, 16% 75%, 7% 17%); font-size: 0.75rem; font-weight: 1000; background: rgba(114, 242, 195, 0.1); }
.shield.used { color: #466273; background: rgba(255,255,255,0.03); }
.topic-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--orange); border: 1px solid rgba(255,138,42,0.35); border-radius: 999px; font-size: 0.8rem; font-weight: 1000; }
.feedback { margin-top: 18px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,0.06); }
.feedback.correct { border-color: rgba(97,229,177,0.55); background: rgba(97,229,177,0.08); }
.feedback.wrong { border-color: rgba(255, 107, 154, 0.55); background: rgba(255, 107, 154, 0.08); }
.feedback h3 { margin-bottom: 6px; }
.feedback.correct h3 { color: var(--green); }
.feedback.wrong h3 { color: #ff9aa7; }
.feedback p { margin-bottom: 8px; }
.source-link { color: var(--cyan); font-size: 0.86rem; }

.result-card { max-width: 820px; margin: 0 auto; text-align: center; }
.result-icon { display: grid; width: 108px; height: 108px; margin: 12px auto 24px; place-items: center; color: var(--cyan); border: 1px solid currentColor; border-radius: 50%; box-shadow: 0 0 30px rgba(114, 242, 195, 0.28); font-size: 3rem; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 28px 0; }
.result-stat { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.045); }
.result-stat strong { display: block; color: var(--cyan); font-size: 1.5rem; }
.field { display: grid; gap: 7px; max-width: 520px; margin: 16px auto; text-align: left; }
.field label { color: var(--muted); font-weight: 900; }
.field input { min-height: 46px; padding: 10px 12px; color: var(--ink); background: rgba(0,0,0,0.18); border: 1px solid var(--line); border-radius: 10px; }
.passcode { margin: 16px auto; padding: 14px; max-width: 520px; color: var(--orange); border: 1px dashed rgba(255,138,42,0.55); border-radius: 12px; font-family: ui-monospace, monospace; letter-spacing: 0.08em; }
.error { min-height: 70vh; display: grid; place-items: center; text-align: center; }

/* Bright safety arena ---------------------------------------------------- */
.topbar,
.panel {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero,
.briefing,
.result-card,
.identity-screen {
  min-height: calc(100dvh - 28px);
  background-image: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(239,248,255,0.94));
}

h1 span { color: #ef8a38; }
.eyebrow { color: #2f7ec7; }
.primary-button { color: #fff; background: linear-gradient(135deg, #347fd0, #4eb6cc); box-shadow: 0 10px 24px rgba(52, 127, 208, 0.22); }
.secondary-button { color: #5b3510; background: linear-gradient(135deg, #ffc76d, #ffad54); box-shadow: 0 10px 22px rgba(238, 157, 59, 0.2); }
.ghost-button { color: var(--ink); background: #f3f8fc; }

.hero-showcase {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid #cfe2f1;
  border-radius: 34px;
  background:
    radial-gradient(ellipse at 50% 88%, rgba(82, 153, 200, 0.18), transparent 46%),
    linear-gradient(#dff4ff 0 66%, #f7dfad 66% 72%, #e6c98b 72%);
  box-shadow: inset 0 -18px 30px rgba(128, 94, 39, 0.1), 0 24px 45px rgba(61, 112, 148, 0.18);
}

.hero-showcase::before {
  content: "";
  position: absolute;
  inset: 20px 24px auto;
  height: 82px;
  border-radius: 24px;
  background: rgba(255,255,255,0.45);
  clip-path: polygon(0 52%, 10% 18%, 17% 48%, 27% 8%, 38% 44%, 49% 14%, 60% 50%, 70% 18%, 81% 44%, 91% 10%, 100% 48%, 100% 100%, 0 100%);
}

.hero-character,
.identity-avatar,
.battle-character {
  display: block;
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position-y: center;
  filter: drop-shadow(0 14px 10px rgba(42, 69, 90, 0.18));
}

.avatar-male { background-position-x: 5%; }
.avatar-female { background-position-x: 50%; }
.avatar-neutral { background-position-x: 95%; }

.hero-character { position: absolute; left: 4%; bottom: 37px; width: 205px; height: 300px; }
.hero-monster,
.monster-sprite {
  display: block;
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position-y: center;
  filter: drop-shadow(0 14px 10px rgba(42, 69, 90, 0.18));
}

.monster-slime { background-position-x: 0%; }
.monster-ghost { background-position-x: 33.333%; }
.monster-load { background-position-x: 66.667%; }
.monster-machine { background-position-x: 100%; }
.hero-monster { position: absolute; right: 4%; bottom: 46px; width: 146px; height: 195px; }
.hero-versus { position: absolute; top: 112px; left: 50%; color: #d75e67; font-family: var(--display); font-size: 2.2rem; transform: translateX(-50%) rotate(-5deg); }
.hero-action-card { position: absolute; z-index: 3; left: 50%; bottom: 35px; width: 150px; min-height: 190px; padding: 18px 14px; color: #224e73; text-align: center; border: 7px solid #74aee0; border-radius: 18px; background: linear-gradient(#fafdff, #ddecf8); box-shadow: 0 18px 24px rgba(36, 78, 112, 0.2), inset 0 0 0 2px #fff; transform: translateX(-50%) rotate(-3deg); }
.hero-action-card::before { content: "✦"; display: grid; width: 72px; height: 72px; margin: 8px auto 16px; place-items: center; color: #fff; border-radius: 50%; background: linear-gradient(145deg, #ffbc59, #f07a3c); font-size: 2rem; }
.hero-action-card span { display: block; margin-bottom: 6px; color: #4b83ae; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; }

.brief-item,
.result-stat,
.situation-card,
.feedback { background: #f6fbff; }

.identity-screen { max-width: 1040px; }
.identity-card { color: var(--ink); border-color: #cfe0ed; background: linear-gradient(155deg, #fff, #eef7fd); box-shadow: 0 16px 30px rgba(71, 121, 155, 0.13); }
.identity-card:hover,
.identity-card.selected { background: #fff; box-shadow: 0 14px 34px color-mix(in srgb, var(--identity-accent) 22%, transparent); }
.identity-avatar { width: 180px; height: 230px; margin: 0 auto 8px; color: transparent; border: 0; border-radius: 0; background-color: transparent; box-shadow: none; transform: none; }
.identity-avatar::before,
.identity-avatar::after { display: none; }

.battle-shell { grid-template-columns: minmax(0, 1fr); }
.battle-panel { position: relative; overflow: visible; background: rgba(255,255,255,0.96); }
.side-stack { display: none; }
.side-card { min-height: 94px; background: rgba(255,255,255,0.9); }
.side-card h3 { color: #2f6fa5; }

.progress-line { background: #e6eff6; }
.progress-line span { background: linear-gradient(90deg, #3b8cd5, #58c398); }
.topic-chip { background: #fff9e8; }

.encounter {
  position: relative;
  grid-template-columns: minmax(160px, 1fr) minmax(96px, 0.36fr) minmax(180px, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 300px;
  align-items: stretch;
  gap: 8px 16px;
  padding: 12px 18px 0;
  overflow: hidden;
  border: 1px solid #c9deec;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 25%, rgba(255,255,255,0.9), transparent 34%),
    linear-gradient(#dff4ff 0 68%, #f0dfb8 68% 74%, #dbc08a 74%);
  box-shadow: inset 0 -14px 24px rgba(108, 80, 37, 0.08);
}

.encounter::before {
  content: "";
  position: absolute;
  inset: 18px 24px auto;
  height: 52px;
  border-radius: 18px;
  background: rgba(255,255,255,0.38);
  clip-path: polygon(0 55%, 9% 18%, 17% 53%, 26% 6%, 37% 49%, 48% 12%, 58% 52%, 69% 14%, 80% 48%, 91% 9%, 100% 51%, 100% 100%, 0 100%);
}

.player-zone,
.monster-zone { position: relative; z-index: 1; min-height: 270px; display: grid; align-content: end; justify-items: center; overflow: visible; border: 0; border-radius: 0; background: none; box-shadow: none; }
.player-zone { grid-column: 1; grid-row: 2; }
.monster-zone { grid-column: 3; grid-row: 2; }
.player-zone::before,
.player-zone::after,
.monster-zone::before,
.monster-zone::after { display: none; }
.battle-character { width: 175px; height: 245px; }
.monster-sprite { width: 135px; height: 180px; margin-bottom: 32px; }
.combat-name,
.monster-name { position: absolute; bottom: 8px; z-index: 5; padding: 5px 11px; color: #fff; border-radius: 999px; background: rgba(37, 77, 107, 0.86); font-size: 0.76rem; font-weight: 900; letter-spacing: 0.04em; }
.monster-name { color: #fff; }
.weakness { top: 16px; padding: 5px 9px; color: #b23d55; border-radius: 999px; background: rgba(255,255,255,0.88); letter-spacing: 0.08em; }
.monster-zone.drag-over { border-radius: 20px; box-shadow: inset 0 0 0 4px rgba(58,139,216,0.6), 0 0 28px rgba(58,139,216,0.2); }

.arena-center { position: relative; z-index: 3; grid-column: 2; grid-row: 2; display: grid; align-content: center; justify-items: center; padding: 0; pointer-events: none; }
.versus-mark { color: #d65f69; font-family: var(--display); font-size: clamp(2.35rem, 4vw, 3.4rem); line-height: 1; text-shadow: 0 5px 14px rgba(214, 95, 105, 0.2); transform: rotate(-5deg); }
.situation-card { position: relative; z-index: 4; grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; width: 100%; max-height: none; padding: 10px 14px; overflow: visible; border-color: rgba(70, 121, 161, 0.22); background: rgba(255,255,255,0.9); box-shadow: 0 10px 20px rgba(53, 97, 129, 0.1); }
.situation-card h3 { margin: 0; color: #2f7ec7; font-size: 0.92rem; white-space: nowrap; }
.situation-card p { margin: 0; font-size: 0.86rem; line-height: 1.45; }
.situation-instruction { color: var(--muted); font-size: 0.76rem !important; white-space: nowrap; }

.combat-projectile { position: absolute; z-index: 8; top: 39%; display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; font-size: 1.6rem; }
.combat-projectile.to-monster { color: #fff; background: #4bb888; box-shadow: 0 0 24px #66d5a6; animation: projectile-right 650ms ease both; }
.combat-projectile.to-player { color: #fff; background: #e65a6f; box-shadow: 0 0 24px #f28898; animation: projectile-left 650ms ease both; }
@keyframes projectile-right { from { opacity: 0; transform: translateX(-170px) scale(.4); } 40% { opacity: 1; } to { opacity: 0; transform: translateX(170px) scale(1.25); } }
@keyframes projectile-left { from { opacity: 0; transform: translateX(170px) scale(.4); } 40% { opacity: 1; } to { opacity: 0; transform: translateX(-170px) scale(1.25); } }
.player-zone.attack .battle-character { animation: player-attack 1050ms cubic-bezier(.2,.8,.2,1); }
.player-zone.hit .battle-character { animation: player-damaged 1050ms cubic-bezier(.2,.8,.2,1); }
@keyframes player-attack { 0%,100% { transform: translateX(0) scale(1); } 22% { transform: translateX(-12px) rotate(-3deg) scale(.98); } 48% { transform: translateX(46px) rotate(5deg) scale(1.09); filter: drop-shadow(0 0 20px var(--effect-color)); } 70% { transform: translateX(18px) scale(1.03); } }
@keyframes player-damaged { 0%,100% { transform: translateX(0) rotate(0); filter: none; } 28%,58% { transform: translateX(-26px) rotate(-7deg) scale(.94); filter: brightness(1.35) drop-shadow(0 0 22px #e65a6f); } 43%,72% { transform: translateX(18px) rotate(5deg); filter: saturate(.55) drop-shadow(0 0 16px #fff); } }
.monster-zone.hit .monster-sprite { animation: monster-damaged 1150ms cubic-bezier(.2,.8,.2,1); }
.monster-zone.counter .monster-sprite { animation: monster-counter 1050ms cubic-bezier(.2,.8,.2,1); }
@keyframes monster-damaged { 0%,100% { transform: translateX(0) rotate(0) scale(1); filter: none; } 38% { transform: translateX(28px) rotate(12deg) scale(.78); filter: brightness(1.8) saturate(.3) drop-shadow(0 0 26px var(--effect-color)); } 54% { transform: translateX(-16px) rotate(-8deg) scale(1.12); } 72% { transform: translateX(9px) rotate(5deg) scale(.94); } }
@keyframes monster-counter { 0%,100% { transform: translateX(0) rotate(0) scale(1); } 25% { transform: translateX(18px) rotate(5deg) scale(.96); } 52% { transform: translateX(-46px) rotate(-7deg) scale(1.14); filter: drop-shadow(0 0 24px var(--effect-color)); } 72% { transform: translateX(-18px) scale(1.05); } }
.combat-burst { top: 38%; color: #fff; border: 0; font-family: var(--display); letter-spacing: 0.04em; }
.combat-burst.attack { color: #fff; background: var(--effect-color, #42a97e); box-shadow: 0 8px 28px color-mix(in srgb, var(--effect-color, #42a97e) 45%, transparent); animation-duration: 1150ms; }
.combat-burst.counter { color: #fff; background: var(--effect-color, #e65a6f); box-shadow: 0 8px 28px color-mix(in srgb, var(--effect-color, #e65a6f) 45%, transparent); animation-duration: 1150ms; }

.battle-panel.battle-correct::after,
.battle-panel.battle-wrong::after {
  content: "";
  position: absolute;
  z-index: 40;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--effect-color) 58%, white), transparent 64%);
  mix-blend-mode: screen;
  animation: arena-flash 1150ms ease-out both;
}

.battle-panel.battle-wrong::after { background: radial-gradient(circle at 30% 48%, color-mix(in srgb, var(--effect-color) 68%, white), transparent 62%); }

@keyframes arena-flash {
  0%, 100% { opacity: 0; }
  18% { opacity: .18; }
  38% { opacity: .78; }
  48% { opacity: .12; }
  58% { opacity: .58; }
  72% { opacity: 0; }
}

.element-effect {
  --source-x: 22%;
  --target-x: 78%;
  position: absolute;
  z-index: 35;
  inset: 48px 0 0;
  overflow: hidden;
  pointer-events: none;
}

.element-effect.to-player { --source-x: 78%; --target-x: 22%; }

.effect-core,
.effect-field,
.effect-title,
.effect-particles i { position: absolute; left: var(--source-x); top: 58%; }

.effect-core {
  z-index: 3;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  color: #fff;
  border: 3px solid rgba(255,255,255,.84);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff, var(--effect-color) 38%, color-mix(in srgb, var(--effect-color) 66%, #14324f));
  box-shadow: 0 0 18px #fff, 0 0 42px var(--effect-color);
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 1000;
  transform: translate(-50%, -50%);
  animation: element-flight 1150ms cubic-bezier(.16,.78,.18,1) both;
}

.effect-field {
  z-index: 2;
  left: var(--target-x);
  width: 92px;
  height: 92px;
  border: 5px solid var(--effect-color);
  border-radius: 50%;
  box-shadow: 0 0 24px #fff, 0 0 48px var(--effect-color), inset 0 0 28px var(--effect-color);
  transform: translate(-50%, -50%) scale(.15);
  animation: element-impact 1150ms ease-out both;
}

.effect-field::before,
.effect-field::after {
  content: "";
  position: absolute;
  inset: -22px;
  border: 3px solid color-mix(in srgb, var(--effect-color) 72%, white);
  border-radius: inherit;
}

.effect-field::after { inset: -42px; border-width: 2px; }

.effect-title {
  z-index: 5;
  left: var(--target-x);
  top: 16%;
  padding: 6px 12px;
  color: #fff;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: var(--effect-color);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--effect-color) 48%, transparent);
  font-family: var(--display);
  font-size: .82rem;
  letter-spacing: .08em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: effect-title-pop 1150ms ease both;
}

.effect-particles i {
  z-index: 2;
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--effect-color);
  box-shadow: 0 0 10px #fff, 0 0 18px var(--effect-color);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: particle-flight 1050ms cubic-bezier(.2,.72,.24,1) var(--delay) both;
}

@keyframes element-flight {
  0% { left: var(--source-x); opacity: 0; transform: translate(-50%, -50%) scale(.22) rotate(-24deg); }
  14% { opacity: 1; }
  62% { left: var(--target-x); opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(9deg); }
  78% { left: var(--target-x); opacity: .9; transform: translate(-50%, -50%) scale(.7) rotate(-8deg); }
  100% { left: var(--target-x); opacity: 0; transform: translate(-50%, -50%) scale(2.15); }
}

@keyframes element-impact {
  0%, 45% { opacity: 0; transform: translate(-50%, -50%) scale(.12); }
  58% { opacity: 1; transform: translate(-50%, -50%) scale(.72); }
  74% { opacity: .92; transform: translate(-50%, -50%) scale(1.42); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.45); }
}

@keyframes effect-title-pop {
  0%, 42% { opacity: 0; transform: translate(-50%, -10%) scale(.5); }
  58%, 82% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(.9); }
}

@keyframes particle-flight {
  0% { left: var(--source-x); top: 58%; opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  22% { opacity: 1; }
  68% { left: var(--target-x); top: var(--particle-y); opacity: 1; transform: translate(calc(-50% + var(--offset-x)), -50%) scale(1.15); }
  100% { left: var(--target-x); top: var(--particle-y); opacity: 0; transform: translate(calc(-50% + var(--offset-x)), -50%) scale(.1); }
}

.effect-gale .effect-core { width: 104px; height: 54px; border: 0; border-radius: 999px 36px 999px 36px; background: linear-gradient(90deg, transparent, var(--effect-color), #fff); font-size: 3.2rem; }
.effect-gale .effect-particles i { width: 64px; height: 4px; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--effect-color), #fff); }
.effect-thunder .effect-core { left: var(--target-x); top: 8%; width: 88px; height: 174px; color: transparent; border: 0; border-radius: 0; background: linear-gradient(#fff, var(--effect-color)); clip-path: polygon(52% 0, 82% 0, 62% 38%, 90% 38%, 28% 100%, 43% 55%, 14% 55%); animation-name: thunder-strike; }
.effect-thunder .effect-particles i { width: 18px; height: 6px; border-radius: 1px; transform: rotate(calc(var(--i) * 24deg)); }
.effect-rain .effect-core { left: var(--target-x); top: 30%; width: 96px; height: 48px; border-radius: 60px; font-size: 1.7rem; animation-name: rain-cloud; }
.effect-rain .effect-particles i { left: calc(var(--target-x) + var(--offset-x)); top: 22%; width: 6px; height: 28px; border-radius: 99px; background: linear-gradient(#fff, var(--effect-color)); animation-name: rain-fall; }
.effect-electric .effect-core { border-radius: 38% 62% 44% 56%; animation-timing-function: steps(7, end); }
.effect-electric .effect-particles i { border-radius: 2px; clip-path: polygon(0 42%, 43% 42%, 55% 0, 100% 0, 68% 58%, 34% 58%, 20% 100%); }
.effect-flame .effect-core { border-radius: 56% 44% 62% 38%; background: radial-gradient(circle at 40% 55%, #fff, #ffd05c 22%, var(--effect-color) 58%, #b83b24); }
.effect-flame .effect-particles i { border-radius: 65% 35% 58% 42%; }
.effect-frost .effect-core { border-radius: 20%; transform: translate(-50%, -50%) rotate(45deg); }
.effect-frost .effect-particles i { border-radius: 0; clip-path: polygon(50% 0, 64% 34%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 34%); }
.effect-pulse .effect-core { color: var(--effect-color); border-width: 7px; background: rgba(255,255,255,.78); box-shadow: 0 0 18px #fff, 0 0 48px var(--effect-color), inset 0 0 24px var(--effect-color); }
.effect-pulse .effect-particles i { background: transparent; border: 3px solid var(--effect-color); }
.effect-light .effect-core { width: 118px; height: 34px; border: 0; border-radius: 999px; background: linear-gradient(90deg, transparent, #fff 45%, var(--effect-color)); }
.effect-light .effect-particles i { width: 34px; height: 3px; border-radius: 99px; }
.effect-variant-2 .effect-core { filter: saturate(1.25) brightness(1.08); }
.effect-variant-3 .effect-field { border-style: double; border-width: 8px; }

@keyframes thunder-strike {
  0%, 32% { opacity: 0; transform: translate(-50%, -92%) scaleY(.18); }
  40% { opacity: 1; transform: translate(-50%, -10%) scaleY(1.2); filter: brightness(2); }
  46% { opacity: .18; }
  53% { opacity: 1; transform: translate(-50%, -4%) scaleY(1); }
  78%, 100% { opacity: 0; transform: translate(-50%, 12%) scaleY(.72); }
}

@keyframes rain-cloud {
  0%, 18% { opacity: 0; transform: translate(-50%, -80%) scale(.45); }
  32%, 76% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -25%) scale(.82); }
}

@keyframes rain-fall {
  0%, 20% { opacity: 0; transform: translate(-50%, -40px) rotate(12deg); }
  38% { opacity: 1; }
  82% { top: 82%; opacity: 1; transform: translate(-50%, 0) rotate(12deg); }
  100% { top: 88%; opacity: 0; transform: translate(-50%, 18px) rotate(12deg); }
}

.drop-hint { display: none; }
.action-list { position: relative; z-index: 10; grid-template-columns: repeat(3, 180px); justify-content: center; align-items: end; gap: 18px; max-width: 660px; margin: -74px auto 0; perspective: 900px; }
.action-card { --card-rotation: 0deg; --card-offset: 0px; display: flex; width: 180px; height: 260px; min-height: 0; padding: 0; overflow: hidden; flex-direction: column; color: var(--ink); border: 5px solid #72a8d2; background: linear-gradient(155deg, #fff, #eaf4fb 75%); box-shadow: 0 14px 24px rgba(38, 80, 112, 0.17), inset 0 0 0 2px #fff; transform-origin: 50% 100%; transform: perspective(700px) translateY(var(--card-offset)) rotate(var(--card-rotation)); }
.action-card::before { display: none; }
.action-card:nth-child(1) { --card-rotation: -2deg; --card-offset: 4px; }
.action-card:nth-child(3) { --card-rotation: 2deg; --card-offset: 4px; }
.action-card:hover { border-color: #f0a346; background: #fffaf0; box-shadow: 0 10px 28px rgba(240,163,70,.28); transform: perspective(700px) translateY(calc(var(--card-offset) - 3px)) rotate(var(--card-rotation)) scale(1.025); }
.action-card.armed { z-index: 20; border-color: #f0a346; background: #fffaf0; box-shadow: 0 12px 32px rgba(240,163,70,.34); transform: perspective(700px) translateY(var(--card-offset)) rotate(0) scale(1.09); }
.card-label { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 7px; padding: 5px 9px; color: #4a82ad; background: #f5faff; font-size: 0.68rem; font-weight: 1000; letter-spacing: 0.08em; }
.action-key { width: 25px; height: 25px; margin: 0; color: #fff; background: linear-gradient(145deg, #f3ad4f, #e67d3f); border-radius: 7px; }
.card-effect-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--card-effect); font-size: .66rem; letter-spacing: .06em; }
.card-effect-tag span { display: inline-grid; width: 19px; height: 19px; place-items: center; color: #fff; border-radius: 50%; background: var(--card-effect); box-shadow: 0 0 12px color-mix(in srgb, var(--card-effect) 45%, transparent); font-size: .72rem; }
.action-card.armed { border-color: var(--card-effect); box-shadow: 0 12px 34px color-mix(in srgb, var(--card-effect) 38%, transparent); }
.card-illustration { display: block; height: 118px; flex: 0 0 118px; border-block: 2px solid rgba(72, 119, 158, 0.28); background-repeat: no-repeat; background-size: 300% 500%; }
.art-topic-0 { background-image: url("assets/card-art/hazard-spotting-anime-v2.webp"); }
.art-topic-1 { background-image: url("assets/card-art/ppe-anime-v2.webp"); }
.art-topic-2 { background-image: url("assets/card-art/manual-handling-anime-v2.webp"); }
.art-topic-3 { background-image: url("assets/card-art/machinery-anime-v2.webp"); }
.art-col-A { background-position-x: 0%; }
.art-col-B { background-position-x: 50%; }
.art-col-C { background-position-x: 100%; }
.art-row-1 { background-position-y: 0%; }
.art-row-2 { background-position-y: 25%; }
.art-row-3 { background-position-y: 50%; }
.art-row-4 { background-position-y: 75%; }
.art-row-5 { background-position-y: 100%; }
.action-text { display: grid; flex: 1; align-content: center; padding: 9px 11px 11px; font-size: 0.8rem; line-height: 1.4; }
.safety-value .shield { background: rgba(58, 139, 216, 0.09); }
.shield.used { color: #aab9c4; }
.feedback.correct { background: #effaf5; }
.feedback.wrong { background: #fff1f3; }
.field input { color: var(--ink); background: #fff; }
.passcode { background: #fffaf0; }

/* Four-stage monster introductions and illustrated outcomes ---------------- */
.stage-intro-screen,
.outcome-screen {
  min-height: calc(100dvh - 14px);
}

.stage-intro-panel,
.outcome-panel {
  position: relative;
  min-height: calc(100dvh - 88px);
  overflow: hidden;
  border-radius: 28px;
}

.stage-intro-panel {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(360px, 1.08fr);
  align-items: center;
  gap: clamp(18px, 4vw, 54px);
  padding: clamp(24px, 5vw, 64px);
  background:
    radial-gradient(circle at 78% 48%, color-mix(in srgb, var(--stage-accent) 26%, transparent), transparent 24rem),
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(232,247,255,.96));
}
.stage-intro-screen,
.outcome-screen { min-height: calc(100dvh - 20px); }
.stage-intro-panel,
.outcome-panel { min-height: calc(100dvh - 80px); }

.stage-intro-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--stage-accent) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--stage-accent) 8%, transparent) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, transparent, #000 58%, transparent);
}

.intro-skip {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 20px;
  min-height: 38px;
  padding: 7px 13px;
  color: #35688f;
  border: 1px solid #c6ddea;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  font-size: .82rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(55,105,141,.12);
}

.stage-intro-copy {
  position: relative;
  z-index: 2;
}

.stage-number {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 11px;
  color: color-mix(in srgb, var(--stage-accent) 72%, #24577a);
  border: 1px solid color-mix(in srgb, var(--stage-accent) 45%, #d9e7f1);
  border-radius: 999px;
  background: color-mix(in srgb, var(--stage-accent) 12%, #fff);
  font-weight: 1000;
}

.stage-intro-copy h2 {
  margin-bottom: 22px;
  color: #17324d;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 1;
}

.typed-copy {
  min-height: 152px;
  padding: 16px 18px;
  border: 1px solid #d0e2ef;
  border-left: 5px solid var(--stage-accent);
  border-radius: 16px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 14px 30px rgba(57,108,145,.1);
}

.typed-copy p {
  min-height: 1.7em;
  margin-bottom: 8px;
  color: #405f78;
  font-weight: 750;
  line-height: 1.65;
}

.typed-copy p:last-child { margin-bottom: 0; }
.typed-copy p.is-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -.08em;
  background: var(--stage-accent);
  animation: typing-cursor 650ms steps(1) infinite;
}

@keyframes typing-cursor { 50% { opacity: 0; } }

.intro-actions { margin-top: 20px; }
.intro-actions .primary-button { min-width: 170px; }
.intro-actions .primary-button.is-ready { animation: ready-pulse 700ms ease both; }
@keyframes ready-pulse { 45% { transform: scale(1.045); box-shadow: 0 0 0 9px color-mix(in srgb, var(--stage-accent) 20%, transparent); } }

.stage-intro-visual {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: min(58vh, 460px);
  place-items: end center;
  padding: 24px 24px 22px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--stage-accent) 35%, #c7deed);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 52%, rgba(255,255,255,.98), transparent 32%),
    linear-gradient(#dff4ff 0 68%, #f7dfad 68% 74%, #e4c37f 74%);
  box-shadow: inset 0 -22px 34px rgba(105,78,35,.12), 0 20px 45px rgba(58,108,143,.18);
}

.stage-intro-visual::before {
  content: "";
  position: absolute;
  inset: 24px 26px auto;
  height: 82px;
  border-radius: 28px;
  background: rgba(255,255,255,.5);
  clip-path: polygon(0 50%, 10% 14%, 21% 48%, 32% 8%, 44% 52%, 57% 18%, 69% 48%, 82% 12%, 100% 48%, 100% 100%, 0 100%);
}

.stage-intro-visual::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 48px;
  height: 32px;
  border-radius: 50%;
  background: rgba(69,88,94,.18);
  filter: blur(10px);
}

.stage-monster {
  position: relative;
  z-index: 2;
  display: block;
  width: auto;
  height: min(46vh, 335px);
  aspect-ratio: 3 / 4;
  margin-bottom: 30px;
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position-y: center;
  filter: drop-shadow(0 18px 13px rgba(42,69,90,.25));
  animation: boss-reveal 820ms cubic-bezier(.18,.8,.2,1) both, boss-float 2.8s 900ms ease-in-out infinite;
}

@keyframes boss-reveal {
  from { opacity: 0; transform: translateY(55px) scale(.72); filter: blur(8px) drop-shadow(0 18px 13px rgba(42,69,90,.25)); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0) drop-shadow(0 18px 13px rgba(42,69,90,.25)); }
}
@keyframes boss-float { 50% { transform: translateY(-8px) rotate(1deg); } }

.boss-warning {
  position: absolute;
  z-index: 4;
  top: 20px;
  left: 20px;
  padding: 7px 11px;
  color: #c64f62;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  font-size: .75rem;
  font-weight: 1000;
  letter-spacing: .08em;
}

.stage-intro-visual strong,
.stage-intro-visual > span:last-child {
  position: absolute;
  z-index: 4;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.stage-intro-visual strong { bottom: 22px; padding: 6px 14px; color: #fff; border-radius: 999px; background: #315d79; }
.stage-intro-visual > span:last-child { bottom: 0; color: #547286; font-size: .76rem; font-weight: 800; }

.outcome-panel { background: #dff3fc; }
.outcome-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.outcome-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16,45,68,.92) 0%, rgba(20,54,78,.78) 39%, rgba(20,54,78,.18) 66%, transparent 100%);
}
.failure-screen .outcome-shade { background: linear-gradient(90deg, rgba(31,45,62,.94), rgba(43,58,76,.78) 45%, rgba(43,58,76,.12) 76%); }
.outcome-copy {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(48%, 560px);
  min-height: calc(100dvh - 88px);
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(26px, 5vw, 66px);
  color: #fff;
  text-shadow: 0 2px 12px rgba(10,34,51,.3);
}
.outcome-copy .eyebrow { color: #bdeaff; }
.outcome-copy h2 { margin-bottom: 14px; color: #fff; font-size: clamp(2.2rem, 4.5vw, 4.4rem); line-height: 1.03; }
.outcome-copy > p:not(.eyebrow) { max-width: 470px; margin-bottom: 14px; color: #eef9ff; font-size: 1.02rem; }
.outcome-badge {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 7px 12px;
  color: #153850;
  border-radius: 999px;
  background: #a9f0ba;
  box-shadow: 0 8px 24px rgba(49,195,114,.26);
  font-family: var(--display);
  font-size: .78rem;
  font-weight: 1000;
  letter-spacing: .12em;
}
.outcome-badge.failure { color: #fff; background: #e26675; }
.stage-score { display: flex; align-items: center; gap: 12px; margin: 4px 0 4px; }
.stage-score strong { font-size: 1.75rem; }
.stage-score span { color: #d8edf7; font-size: .8rem; font-weight: 900; }
.outcome-copy .button-row { width: 100%; }
.outcome-copy .ghost-button { color: #fff; border-color: rgba(255,255,255,.48); background: rgba(255,255,255,.12); }
.failure-tip {
  display: grid;
  gap: 5px;
  max-width: 520px;
  margin: 4px 0 2px;
  padding: 12px 14px;
  color: #27465e;
  text-shadow: none;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 14px;
  background: rgba(255,255,255,.88);
}
.failure-tip span { font-size: .86rem; line-height: 1.5; }
.failure-tip .source-link { font-size: .74rem; }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .hero-showcase { min-height: 390px; }
  .battle-shell { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .encounter { grid-template-columns: minmax(130px, 1fr) minmax(80px, .32fr) minmax(150px, 1fr); }
  .battle-character { width: 150px; height: 215px; }
  .monster-sprite { width: 124px; height: 165px; }
  .situation-card { grid-template-columns: auto minmax(0, 1fr); }
  .situation-instruction { grid-column: 2; white-space: normal; }
  .stage-intro-panel { grid-template-columns: minmax(0, .9fr) minmax(300px, 1.1fr); padding: 30px; }
  .stage-intro-visual { min-height: 420px; }
  .outcome-copy { width: 58%; }
}

@media (min-width: 881px) and (min-height: 700px) {
  .app-shell { padding-top: 14px; padding-bottom: 0; }
  .topbar { margin-bottom: 7px; padding-block: 7px; }
  .battle-shell { min-height: calc(100dvh - 86px); }
  .battle-panel { padding: 12px 20px; overflow: visible; }
  .battle-heading { margin-bottom: 10px; }
  .progress-line { margin-bottom: 12px; }
  .encounter { gap: 14px; margin-bottom: 12px; }
  .player-zone, .monster-zone { min-height: 255px; }
  .monster-core { width: 118px; height: 118px; font-size: 3.2rem; }
  .monster-core::before, .monster-core::after { top: 30px; width: 10px; height: 18px; }
  .monster-core::before { left: 28px; }
  .monster-core::after { right: 28px; }
  .action-card { min-height: 0; padding: 0; }
  .feedback { margin-top: 8px; padding: 10px 14px; }
}

@media (min-width: 621px) and (max-height: 760px) {
  .app-shell { width: min(1240px, calc(100% - 16px)); padding-top: 8px; }
  .hero,
  .briefing,
  .complete-screen {
    height: calc(100dvh - 16px);
    min-height: 0;
    max-width: none;
    overflow: hidden;
    border-radius: 24px;
  }
  .hero {
    grid-template-columns: minmax(0, .94fr) minmax(340px, 1.06fr);
    gap: clamp(20px, 4vw, 52px);
    padding: 22px clamp(28px, 5vw, 58px);
  }
  .hero h1 { margin-bottom: 12px; font-size: clamp(3rem, 7vw, 5rem); }
  .hero .lead { font-size: .94rem; line-height: 1.5; }
  .hero .button-row { margin-top: 14px; }
  .hero-showcase { height: 100%; min-height: 0; max-height: 500px; }
  .briefing {
    display: grid;
    grid-template-rows: repeat(6, auto);
    align-content: center;
    padding: 20px clamp(34px, 7vw, 72px) 18px;
  }
  .briefing .eyebrow { margin-bottom: 6px; }
  .briefing h2 { margin-bottom: 6px; font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.05; }
  .briefing .lead { margin-bottom: 0; font-size: .92rem; line-height: 1.45; }
  .briefing .brief-grid { min-height: 0; gap: 8px; margin: 10px 0; }
  .briefing .brief-item { padding: 9px 13px; }
  .briefing .brief-item strong { margin-bottom: 2px; font-size: .9rem; }
  .briefing .brief-item span { font-size: .78rem; }
  .briefing > .muted { margin-bottom: 0; font-size: .8rem; line-height: 1.4; }
  .briefing > .button-row { margin-top: 10px; }
  .briefing > .button-row > * { min-height: 42px; padding-block: 8px; }
  .identity-screen {
    display: grid;
    height: calc(100dvh - 16px);
    min-height: 0;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    padding: 18px clamp(26px, 5vw, 54px) 16px;
    overflow: hidden;
    border-radius: 24px;
  }
  .identity-screen .eyebrow { margin-bottom: 7px; }
  .identity-screen h2 { margin-bottom: 7px; font-size: clamp(2rem, 4vw, 2.5rem); line-height: 1.05; }
  .identity-screen .lead { margin-bottom: 0; font-size: .94rem; line-height: 1.45; }
  .identity-grid { min-height: 0; gap: 14px; margin: 12px 0; }
  .identity-card { height: 100%; min-height: 0; padding: 10px 14px; overflow: hidden; }
  .identity-avatar { width: clamp(116px, 14vw, 148px); height: clamp(150px, 31vh, 190px); margin-bottom: 4px; }
  .identity-card strong { margin-bottom: 3px; font-size: 1.02rem; }
  .identity-card small { font-size: .78rem; line-height: 1.35; }
  .identity-screen > .button-row { margin-top: 0; }
  .identity-screen > .button-row > * { min-height: 42px; padding-block: 8px; }
  .complete-screen {
    display: grid;
    grid-template-columns: minmax(250px, .82fr) minmax(360px, 1.18fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px 24px;
    padding: 10px 18px 14px;
    text-align: left;
  }
  .complete-screen > .topbar { grid-column: 1 / -1; margin-bottom: 0; }
  .complete-summary,
  .complete-entry { min-height: 0; }
  .complete-summary { display: flex; flex-direction: column; justify-content: center; }
  .complete-summary .result-icon { width: 58px; height: 58px; margin: 0 0 8px; font-size: 1.7rem; }
  .complete-summary .eyebrow { margin-bottom: 5px; }
  .complete-summary h2 { margin-bottom: 6px; font-size: clamp(1.8rem, 3.5vw, 2.5rem); }
  .complete-summary .lead { margin-bottom: 4px; font-size: .82rem; line-height: 1.4; }
  .complete-summary .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 8px 0 0; }
  .complete-summary .result-stat { padding: 7px 9px; text-align: center; }
  .complete-summary .result-stat strong { font-size: 1.2rem; }
  .complete-summary .result-stat span { font-size: .7rem; }
  .complete-entry { display: flex; flex-direction: column; justify-content: center; }
  .complete-entry .passcode-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
  .complete-entry .passcode-panel > h3,
  .complete-entry .passcode-panel > p,
  .complete-entry .passcode-panel > .button-row,
  .complete-entry .passcode-panel > .passcode { grid-column: 1 / -1; }
  .complete-entry .passcode-panel h3 { margin-bottom: 0; }
  .complete-entry .passcode-panel > p { margin-bottom: 0; font-size: .76rem; line-height: 1.35; }
  .complete-entry .field { gap: 3px; margin: 0; }
  .complete-entry .field label { font-size: .72rem; }
  .complete-entry .field input { min-height: 36px; padding-block: 6px; }
  .complete-entry .passcode-panel .button-row { margin-top: 2px; }
  .complete-entry .passcode-panel .button-row > * { min-height: 38px; padding-block: 7px; }
  .complete-entry > .muted { margin: 6px 0 0; font-size: .72rem; }
  .complete-entry > .button-row { justify-content: flex-start !important; margin-top: 6px; }
  .complete-entry > .button-row > * { min-height: 38px; padding-block: 7px; }
  .topbar { margin-bottom: 8px; padding: 7px 12px; border-radius: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .status-pill { min-height: 30px; padding: 5px 9px; font-size: 0.8rem; }
  .battle-panel { padding: 10px 18px; border-radius: 20px; }
  .battle-heading { align-items: center; margin-bottom: 6px; }
  .battle-heading > div { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
  .battle-heading h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
  .topic-chip { padding: 5px 8px; }
  .round-label { font-size: 0.78rem; }
  .progress-line { height: 6px; margin-bottom: 8px; }
  .encounter { min-height: 252px; height: 252px; gap: 6px 12px; margin-bottom: 0; padding: 8px 14px 0; border-radius: 20px; }
  .encounter::before { inset: 8px 18px auto; height: 42px; }
  .situation-card { gap: 6px 12px; padding: 7px 11px; border-radius: 13px; }
  .situation-card p { font-size: 0.78rem; line-height: 1.35; }
  .situation-instruction { font-size: 0.7rem !important; }
  .player-zone,
  .monster-zone { min-height: 184px; }
  .battle-character { width: 145px; height: 202px; }
  .monster-sprite { width: 110px; height: 148px; margin-bottom: 26px; }
  .combat-name,
  .monster-name { bottom: 4px; padding: 4px 9px; font-size: 0.68rem; }
  .weakness { top: 8px; }
  .action-list { grid-template-columns: repeat(3, 156px); gap: 14px; max-width: 560px; margin: -70px auto 0; }
  .action-card { width: 156px; height: 224px; border-width: 4px; }
  .card-label { min-height: 30px; padding: 4px 7px; font-size: 0.6rem; }
  .action-key { width: 23px; height: 23px; }
  .card-illustration { height: 96px; flex-basis: 96px; }
  .action-text { padding: 7px 9px 9px; font-size: 0.72rem; line-height: 1.35; }
  .answer-launch { display: none; }
  .battle-correct .encounter,
  .battle-wrong .encounter { min-height: 210px; height: 210px; }
  .battle-correct .player-zone,
  .battle-correct .monster-zone,
  .battle-wrong .player-zone,
  .battle-wrong .monster-zone { min-height: 142px; }
  .battle-correct .battle-character,
  .battle-wrong .battle-character { width: 125px; height: 174px; }
  .battle-correct .monster-sprite,
  .battle-wrong .monster-sprite { width: 98px; height: 130px; margin-bottom: 24px; }
  .feedback { margin-top: 8px; padding: 10px 14px; }
  .feedback h3 { margin-bottom: 4px; font-size: 1rem; }
  .feedback p { margin-bottom: 4px; font-size: 0.78rem; line-height: 1.35; }
  .feedback .source-link { font-size: 0.74rem; }
  .feedback .button-row { margin-top: 8px; }
  .feedback .primary-button,
  .feedback .secondary-button { min-height: 38px; padding: 8px 12px; }
  .stage-intro-panel,
  .outcome-panel { min-height: calc(100dvh - 70px); }
  .stage-intro-panel { gap: 24px; padding: 20px 32px; }
  .stage-intro-copy h2 { margin-bottom: 14px; font-size: clamp(2.1rem, 4vw, 3.4rem); }
  .typed-copy { min-height: 128px; padding: 11px 14px; }
  .typed-copy p { margin-bottom: 4px; font-size: .84rem; line-height: 1.45; }
  .intro-actions { margin-top: 12px; }
  .stage-intro-visual { min-height: 390px; }
  .stage-monster { height: 270px; }
  .outcome-copy { min-height: calc(100dvh - 70px); padding: 28px 42px; }
  .outcome-copy h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
  .outcome-copy .button-row { margin-top: 10px; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 16px, 560px); padding-top: 9px; padding-bottom: 9px; }
  .topbar { align-items: flex-start; padding: 10px; }
  .status-strip { flex-wrap: wrap; justify-content: flex-end; }
  .status-pill:first-child { display: none; }
  .hero, .briefing, .result-card, .identity-screen { min-height: calc(100dvh - 30px); padding: 28px 20px; border-radius: 22px; }
  .hero-showcase { min-height: 330px; }
  .hero-character { left: -10px; bottom: 24px; width: 150px; height: 220px; }
  .hero-monster { right: 0; bottom: 34px; width: 109px; height: 145px; }
  .hero-action-card { bottom: 22px; width: 116px; min-height: 158px; padding: 10px 8px; border-width: 5px; }
  .hero-action-card::before { width: 52px; height: 52px; margin-bottom: 10px; }
  .hero-versus { top: 78px; }
  .brief-grid, .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .identity-grid { grid-template-columns: 1fr; margin: 22px 0; }
  .identity-card { min-height: 164px; display: grid; grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; gap: 5px 12px; padding: 12px; text-align: left; }
  .identity-avatar { grid-column: 1; grid-row: 1 / span 2; width: 96px; height: 132px; margin: 0; }
  .identity-card strong { grid-column: 2; grid-row: 1; align-self: end; }
  .identity-card small { grid-column: 2; grid-row: 2; align-self: start; }
  .identity-avatar::before { top: 29px; width: 32px; height: 18px; }
  .identity-avatar::after { bottom: 17px; width: 38px; }
  .identity-avatar span { font-size: 1.5rem; }
  .encounter { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto minmax(205px, 1fr); gap: 6px; padding-inline: 8px; }
  .situation-card { grid-column: 1 / -1; grid-row: 1; display: block; }
  .situation-card h3 { margin-bottom: 5px; }
  .situation-card p + p { margin-top: 6px; }
  .situation-instruction { white-space: normal; }
  .player-zone { grid-column: 1; grid-row: 2; }
  .monster-zone { grid-column: 2; grid-row: 2; }
  .player-zone, .monster-zone { min-height: 205px; }
  .battle-character { width: 130px; height: 190px; }
  .monster-sprite { width: 109px; height: 145px; margin-bottom: 28px; }
  .arena-center { grid-column: 1 / -1; grid-row: 2; padding: 0; }
  .versus-mark { position: static; font-size: 2.15rem; }
  .combat-projectile { top: 40%; }
  .element-effect { inset: 150px 0 0; }
  .effect-title { top: 10%; }
  .situation-card { max-height: none; }
  .action-list { display: flex; justify-content: flex-start; gap: 12px; max-width: none; margin: -18px -8px 0; padding: 22px 18px 14px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; }
  .action-card { width: min(70vw, 230px); height: 330px; min-height: 0; flex: 0 0 min(70vw, 230px); scroll-snap-align: center; touch-action: pan-x; }
  .action-card.armed { transform: perspective(700px) translateY(var(--card-offset)) rotate(0) scale(1.04); }
  .card-illustration { height: 164px; flex-basis: 164px; }
  .action-text { padding: 13px 15px 15px; font-size: 0.95rem; }
  .side-stack { grid-template-columns: 1fr; }
  .button-row > * { flex: 1 1 100%; }
  .stage-intro-screen,
  .outcome-screen { min-height: calc(100dvh - 9px); }
  .stage-intro-panel,
  .outcome-panel { min-height: calc(100dvh - 86px); border-radius: 22px; }
  .stage-intro-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(170px, .72fr);
    gap: 10px;
    padding: 50px 18px 14px;
  }
  .intro-skip { top: 10px; right: 12px; }
  .stage-number { margin-bottom: 7px; padding-block: 4px; font-size: .75rem; }
  .stage-intro-copy h2 { margin-bottom: 10px; font-size: clamp(2rem, 11vw, 3rem); }
  .typed-copy { min-height: 128px; padding: 10px 12px; }
  .typed-copy p { margin-bottom: 3px; font-size: .79rem; line-height: 1.4; }
  .intro-actions { margin-top: 9px; }
  .intro-actions .primary-button { width: 100%; min-height: 42px; padding-block: 8px; }
  .stage-intro-visual { min-height: 190px; padding: 8px; border-radius: 19px; }
  .stage-intro-visual::before { inset: 8px 12px auto; height: 40px; }
  .stage-intro-visual::after { bottom: 30px; }
  .stage-monster { width: auto; height: 175px; margin-bottom: 12px; }
  .boss-warning { top: 8px; left: 8px; padding: 4px 8px; font-size: .62rem; }
  .stage-intro-visual strong { bottom: 8px; padding: 4px 10px; font-size: .72rem; }
  .stage-intro-visual > span:last-child { display: none; }
  .outcome-shade,
  .failure-screen .outcome-shade { background: linear-gradient(0deg, rgba(17,45,65,.96) 0%, rgba(21,53,76,.78) 52%, rgba(21,53,76,.08) 100%); }
  .outcome-art { object-position: 58% center; }
  .outcome-copy {
    width: 100%;
    min-height: calc(100dvh - 86px);
    justify-content: flex-end;
    padding: 20px 18px;
  }
  .outcome-copy h2 { margin-bottom: 8px; font-size: clamp(1.8rem, 9vw, 2.7rem); }
  .outcome-copy > p:not(.eyebrow) { margin-bottom: 7px; font-size: .84rem; line-height: 1.45; }
  .outcome-badge { margin-bottom: 8px; padding: 5px 9px; font-size: .66rem; }
  .outcome-copy .eyebrow { margin-bottom: 6px; }
  .stage-score { margin: 0; }
  .stage-score strong { font-size: 1.4rem; }
  .outcome-copy .button-row { margin-top: 8px; }
  .outcome-copy .primary-button,
  .outcome-copy .ghost-button { min-height: 40px; padding-block: 7px; }
  .failure-tip { margin: 0; padding: 8px 10px; }
  .failure-tip span { font-size: .74rem; line-height: 1.35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Option A: bright premium anime card battle ----------------------------- */
:root {
  --bg: #e8f5ff;
  --bg-2: #fff1d5;
  --panel: rgba(250, 253, 255, 0.96);
  --panel-2: rgba(235, 247, 255, 0.96);
  --line: rgba(24, 92, 169, 0.24);
  --ink: #102f54;
  --muted: #55728e;
  --cyan: #1679df;
  --orange: #f27b24;
  --red: #df355b;
  --violet: #705ce4;
  --green: #17a978;
  --shadow: 0 18px 45px rgba(17, 78, 137, 0.18), 0 2px 0 rgba(255,255,255,.9) inset;
  --display: "Bahnschrift Condensed", "Arial Narrow", "Microsoft JhengHei", sans-serif;
  --body: "Segoe UI", "Microsoft JhengHei", sans-serif;
}

html { background: #dcefff; }

body {
  background:
    linear-gradient(118deg, rgba(255,255,255,.9) 0 14%, transparent 14% 78%, rgba(255,182,68,.18) 78% 100%),
    radial-gradient(circle at 78% 9%, rgba(255,255,255,.98) 0 5%, rgba(255,211,101,.48) 6%, transparent 22%),
    linear-gradient(150deg, #dff3ff 0%, #f8fcff 48%, #fff2d4 100%);
}

.signal-grid {
  opacity: .62;
  background-image:
    linear-gradient(rgba(17,105,190,.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17,105,190,.075) 1px, transparent 1px),
    linear-gradient(130deg, transparent 0 47%, rgba(242,123,36,.07) 48% 49%, transparent 50% 100%);
  background-size: 38px 38px, 38px 38px, 190px 190px;
}

.topbar,
.panel {
  border: 2px solid rgba(29, 111, 196, .25);
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(238,248,255,.96));
  box-shadow: var(--shadow);
}

.topbar {
  position: relative;
  overflow: hidden;
  border-left: 6px solid var(--orange);
  border-radius: 9px 18px 18px 9px;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -28px;
  width: 150px;
  height: 54px;
  background: linear-gradient(90deg, transparent, rgba(32,126,217,.12));
  transform: skewX(-28deg);
  pointer-events: none;
}

.brand-mark {
  border-radius: 5px 13px 5px 13px;
  background: linear-gradient(145deg, #27a6ff, #075bb8 62%, #053f89);
  box-shadow: 0 0 0 2px #fff, 0 7px 16px rgba(8,83,160,.3);
}

.brand strong { color: #0e3764; font-family: var(--display); font-size: 1.06rem; letter-spacing: .06em; }

.status-pill {
  color: #526e87;
  border-color: rgba(22,121,223,.22);
  border-radius: 5px 13px 5px 13px;
  background: linear-gradient(180deg, #fff, #eaf5ff);
  box-shadow: inset 0 -2px 0 rgba(22,121,223,.08);
}

.status-pill strong { color: #096bcf; }

.hero,
.briefing,
.result-card,
.identity-screen {
  border-radius: 18px 36px 18px 36px;
  background-image:
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(230,245,255,.95)),
    repeating-linear-gradient(135deg, transparent 0 28px, rgba(24,112,201,.04) 29px 30px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #126fca;
  font-family: var(--display);
  letter-spacing: .18em;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 5px;
  background: linear-gradient(90deg, var(--orange), #ffc35a);
  clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
}

h1, h2, h3 { color: #0e3158; }
h1 { text-shadow: 0 3px 0 #fff, 0 8px 18px rgba(21,81,137,.16); }
h1 span { color: var(--orange); text-shadow: 0 3px 0 #fff, 0 8px 18px rgba(223,91,25,.18); }

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 5px 14px 5px 14px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #1689ed, #0758b4 72%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 10px 20px rgba(11,90,174,.28);
}

.secondary-button {
  color: #fff;
  background: linear-gradient(135deg, #ffab37, #ec641f 72%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.34), 0 10px 20px rgba(226,92,24,.24);
}

.ghost-button { border-color: rgba(22,105,190,.24); background: #eef7ff; }

.hero-showcase {
  isolation: isolate;
  border: 3px solid #176fce;
  border-radius: 14px 34px 14px 34px;
  background:
    radial-gradient(circle at 82% 28%, rgba(255,255,255,.94), transparent 17%),
    linear-gradient(165deg, transparent 0 60%, rgba(19,83,148,.12) 60% 61%, transparent 61% 65%, rgba(242,123,36,.17) 65% 67%, transparent 67%),
    linear-gradient(#79cfff 0 59%, #d8eff8 59% 62%, #f4c870 62% 69%, #c7923f 69%);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.7), inset 0 -24px 44px rgba(102,61,13,.17), 0 22px 42px rgba(23,91,151,.22);
}

.hero-showcase::before {
  inset: 18px 22px auto;
  height: 95px;
  opacity: .68;
  background: rgba(255,255,255,.42);
  clip-path: polygon(0 64%, 12% 25%, 22% 58%, 35% 14%, 48% 56%, 62% 22%, 74% 62%, 87% 18%, 100% 58%, 100% 100%, 0 100%);
}

.hero-showcase::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 18%;
  left: 50%;
  width: 74%;
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 50%;
  box-shadow: 0 0 0 16px rgba(17,122,220,.08), 0 0 48px rgba(17,122,220,.25);
  transform: translateX(-50%);
  pointer-events: none;
}

.hero-character,
.identity-avatar,
.battle-character {
  z-index: 2;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center bottom;
  filter: drop-shadow(0 15px 9px rgba(11,48,83,.25));
}

.avatar-male { background-image: url("assets/anime/characters/xiaohua-male-anime-v2.webp"); background-position: center bottom; }
.avatar-female { background-image: url("assets/anime/characters/xiaohua-female-anime-v2.webp"); background-position: center bottom; }
.avatar-neutral { background-image: url("assets/anime/characters/xiaoan-neutral-anime-v2.webp"); background-position: center bottom; }

.hero-monster,
.monster-sprite,
.stage-monster {
  z-index: 2;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  filter: drop-shadow(0 17px 12px rgba(35,45,80,.26));
}

.monster-slime { background-image: url("assets/anime/monsters/visual-blind-spot-v1.webp"); background-position: center; }
.monster-ghost { background-image: url("assets/anime/monsters/ppe-gap-v1.webp"); background-position: center; }
.monster-load { background-image: url("assets/anime/monsters/load-pressure-v1.webp"); background-position: center; }
.monster-machine { background-image: url("assets/anime/monsters/pinch-machine-v1.webp"); background-position: center; }

.hero-versus,
.versus-mark {
  z-index: 4;
  color: #fff;
  font-style: italic;
  font-weight: 1000;
  text-shadow: -2px -2px 0 #e14356, 2px -2px 0 #e14356, -2px 2px 0 #e14356, 2px 2px 0 #e14356, 0 8px 18px rgba(183,39,62,.28);
}

.hero-action-card {
  color: #143f6a;
  border-color: #1573ce;
  border-radius: 7px 18px 7px 18px;
  background: linear-gradient(160deg, #fff, #d7eeff 68%, #b8dcf7);
  box-shadow: 0 0 0 3px #fff, 0 17px 28px rgba(13,70,127,.27);
}

.hero-action-card::before { background: linear-gradient(145deg, #ffb53d, #ed5d1f); box-shadow: 0 0 0 5px rgba(255,255,255,.65), 0 0 22px rgba(239,100,27,.38); }
.hero-action-card span { color: #0d68c0; }

.brief-item,
.result-stat,
.situation-card,
.feedback {
  border: 1px solid rgba(24,108,195,.24);
  border-left: 5px solid #247ed6;
  border-radius: 6px 16px 6px 16px;
  background: linear-gradient(135deg, #fff, #edf7ff);
  box-shadow: inset 0 1px 0 #fff, 0 8px 18px rgba(31,99,158,.08);
}

.brief-item strong { color: #0d71d0; }

.identity-card {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(27,112,199,.28);
  border-radius: 8px 22px 8px 22px;
  background:
    radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--identity-accent) 13%, transparent), transparent 42%),
    linear-gradient(155deg, #fff, #e9f5ff);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.75), 0 14px 28px rgba(28,94,151,.14);
}

.identity-card::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--identity-accent), #fff 48%, var(--orange));
}

.identity-card:hover,
.identity-card.selected {
  border-color: var(--identity-accent);
  background:
    radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--identity-accent) 20%, transparent), transparent 45%),
    linear-gradient(155deg, #fff, #e9f5ff);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.78), 0 0 0 3px color-mix(in srgb, var(--identity-accent) 20%, transparent), 0 18px 34px color-mix(in srgb, var(--identity-accent) 26%, transparent);
}

.identity-card strong { color: #0b3d6e; font-family: var(--display); font-size: 1.3rem; letter-spacing: .08em; }
.identity-avatar { background-size: contain; background-position: center bottom; }

.battle-panel {
  border-radius: 12px 26px 12px 26px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(228,244,255,.96)),
    repeating-linear-gradient(135deg, transparent 0 34px, rgba(20,109,199,.04) 35px 36px);
  box-shadow: 0 18px 44px rgba(17,81,142,.2), inset 0 0 0 3px rgba(255,255,255,.78);
}

.topic-chip {
  border-radius: 5px 13px 5px 13px;
  background: #fff8e9;
  box-shadow: inset 4px 0 0 currentColor;
}

.progress-line { border: 1px solid rgba(20,103,185,.15); background: #dceeff; }
.progress-line span { background: linear-gradient(90deg, #0878df, #4ec6ff 54%, #ff9a32); box-shadow: 0 0 12px rgba(31,143,228,.5); }

.encounter {
  border: 3px solid #1b76ce;
  border-radius: 10px 25px 10px 25px;
  background:
    radial-gradient(circle at 50% 14%, rgba(255,255,255,.96), transparent 30%),
    linear-gradient(165deg, transparent 0 62%, rgba(20,92,163,.11) 62% 63%, transparent 63% 67%, rgba(239,113,29,.18) 67% 69%, transparent 69%),
    linear-gradient(#8ed8ff 0 66%, #e5f3f7 66% 69%, #f4d283 69% 76%, #c9974e 76%);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.72), inset 0 -18px 32px rgba(91,57,15,.13);
}

.encounter::before {
  opacity: .64;
  background: rgba(255,255,255,.44);
  clip-path: polygon(0 66%, 10% 25%, 20% 56%, 31% 15%, 42% 56%, 53% 21%, 64% 58%, 76% 18%, 87% 56%, 100% 24%, 100% 100%, 0 100%);
}

.situation-card {
  border-top: 4px solid var(--orange);
  border-left-width: 1px;
  background: rgba(250,253,255,.94);
}

.situation-card h3 { color: #096dca; font-family: var(--display); letter-spacing: .08em; }
.combat-name, .monster-name { border: 1px solid rgba(255,255,255,.7); border-radius: 4px 12px 4px 12px; background: linear-gradient(135deg, #145fa3, #0c3156); box-shadow: 0 6px 14px rgba(10,49,88,.22); }
.weakness { color: #d62e50; border: 1px solid rgba(215,45,80,.25); border-radius: 4px 12px 4px 12px; background: rgba(255,249,250,.94); box-shadow: 0 7px 16px rgba(139,34,59,.12); }

.action-card {
  border-color: #176ec2;
  border-radius: 6px 16px 6px 16px;
  background: linear-gradient(155deg, #fff, #e8f4ff 72%, #cce4f6);
  box-shadow: 0 0 0 2px rgba(255,255,255,.95), 0 13px 25px rgba(12,66,119,.23), inset 0 -5px 0 rgba(11,88,163,.08);
}

.action-card:hover,
.action-card.armed {
  background: linear-gradient(155deg, #fff, #fff4e7 72%, #ffd08f);
}

.card-label {
  color: #fff;
  background: linear-gradient(110deg, #0a4e94, #1381db 70%, #42b9ee);
  text-shadow: 0 1px 2px rgba(5,37,70,.4);
}

.card-effect-tag { color: #fff; }
.action-key { background: linear-gradient(145deg, #ffb13b, #ee5e1d); box-shadow: 0 0 0 2px rgba(255,255,255,.38); }
.card-illustration { border-block-color: rgba(9,73,132,.38); filter: saturate(1.1) contrast(1.04); }
.action-text { color: #173b5f; background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(230,243,253,.96)); }

.feedback.correct { border-left-color: var(--green); background: linear-gradient(135deg, #f5fff9, #e2f8ed); }
.feedback.wrong { border-left-color: var(--red); background: linear-gradient(135deg, #fff7f8, #ffe7eb); }

.stage-intro-panel {
  border-radius: 14px 32px 14px 32px;
  background:
    radial-gradient(circle at 76% 48%, color-mix(in srgb, var(--stage-accent) 34%, transparent), transparent 28rem),
    linear-gradient(145deg, rgba(255,255,255,.99), rgba(218,240,255,.97));
  box-shadow: 0 20px 48px rgba(18,82,143,.2), inset 0 0 0 3px rgba(255,255,255,.75);
}

.stage-number,
.intro-skip,
.boss-warning { border-radius: 4px 12px 4px 12px; }

.typed-copy {
  border-radius: 7px 17px 7px 17px;
  background: rgba(255,255,255,.9);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 13px 28px rgba(36,96,146,.12);
}

.stage-intro-visual {
  border: 3px solid color-mix(in srgb, var(--stage-accent) 62%, #1472c9);
  border-radius: 12px 28px 12px 28px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.98), transparent 28%),
    linear-gradient(160deg, transparent 0 64%, rgba(28,104,176,.12) 64% 66%, transparent 66%),
    linear-gradient(#83d2ff 0 67%, #f3dfaa 67% 74%, #cb984d 74%);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.68), inset 0 -22px 34px rgba(96,61,17,.14), 0 20px 42px rgba(23,90,151,.2);
}

.stage-intro-visual strong { border-radius: 4px 12px 4px 12px; background: linear-gradient(135deg, #1169bb, #0d365d); }

.outcome-panel {
  border: 3px solid #1c78d0;
  border-radius: 12px 28px 12px 28px;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.5), 0 20px 48px rgba(15,68,122,.24);
}

.outcome-badge { border-radius: 4px 13px 4px 13px; background: linear-gradient(135deg, #43ec9f, #16a675); }
.outcome-badge.failure { background: linear-gradient(135deg, #ff6b68, #c72b55); }
.failure-tip { border-radius: 6px 16px 6px 16px; }
.result-icon { border-width: 3px; background: rgba(255,255,255,.72); box-shadow: 0 0 0 6px rgba(22,121,223,.09), 0 0 30px rgba(22,121,223,.22); }
.passcode { border-radius: 5px 14px 5px 14px; }

@media (max-width: 620px) {
  .app-shell { padding-bottom: 0; }
  .topbar { align-items: center; gap: 6px; padding: 7px 8px; border-left-width: 4px; }
  .brand { gap: 6px; }
  .brand-mark { width: 30px; height: 30px; flex: 0 0 30px; }
  .brand strong { font-size: .78rem; letter-spacing: .02em; white-space: nowrap; }
  .status-strip { flex-wrap: nowrap; gap: 4px; }
  .status-pill { min-height: 28px; padding: 4px 6px; font-size: .7rem; }
  .hero, .briefing, .result-card, .identity-screen { border-radius: 12px 24px 12px 24px; }
  .identity-card { border-radius: 7px 17px 7px 17px; }
  .identity-avatar { background-size: contain; background-position: center bottom; }
  .battle-panel { border-radius: 9px 20px 9px 20px; }
  .encounter { border-width: 2px; border-radius: 8px 19px 8px 19px; }
  .action-card { border-radius: 6px 15px 6px 15px; }
  .stage-intro-panel, .outcome-panel { border-radius: 10px 22px 10px 22px; }
  .stage-intro-screen, .outcome-screen { min-height: calc(100dvh - 10px); }
}

/* A-1 Flightline Arena --------------------------------------------------- */
:root {
  --bg: #071f3b;
  --bg-2: #0b4e87;
  --panel: rgba(5, 35, 67, .88);
  --panel-2: rgba(8, 61, 108, .82);
  --line: rgba(92, 210, 255, .5);
  --ink: #f7fcff;
  --muted: #b9d5e9;
  --cyan: #63c7ff;
  --orange: #ff7a1a;
  --red: #ff5574;
  --violet: #a583ff;
  --green: #48d99b;
  --shadow: 0 22px 58px rgba(1, 18, 38, .36), inset 0 1px 0 rgba(255,255,255,.14);
  --display: "Bahnschrift Condensed", "Arial Narrow", "Microsoft JhengHei", sans-serif;
  --body: "Segoe UI", "Microsoft JhengHei", sans-serif;
}

html { background: #071f3b; }

body {
  color: var(--ink);
  background:
    linear-gradient(108deg, rgba(3,26,53,.9) 0 23%, rgba(4,42,76,.48) 50%, rgba(2,24,48,.84) 100%),
    url("assets/backgrounds/a1-flightline-hangar-v1.webp") center / cover fixed;
}

.signal-grid {
  opacity: .72;
  background-image:
    linear-gradient(rgba(99,199,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,199,255,.08) 1px, transparent 1px),
    linear-gradient(120deg, transparent 0 48%, rgba(255,122,26,.08) 49%, transparent 50%);
  background-size: 44px 44px, 44px 44px, 260px 260px;
  mask-image: linear-gradient(to bottom, #000, rgba(0,0,0,.36) 76%, transparent);
}

.app-shell {
  width: min(1280px, calc(100% - 20px));
  min-height: 100dvh;
  padding: 10px 0;
}

.topbar,
.panel {
  color: var(--ink);
  border: 1px solid rgba(99,199,255,.48);
  background:
    linear-gradient(145deg, rgba(5,37,71,.94), rgba(7,71,122,.82)),
    linear-gradient(90deg, transparent, rgba(99,199,255,.1));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(1.2);
}

.topbar {
  min-height: 52px;
  margin-bottom: 8px;
  padding: 8px 14px;
  overflow: hidden;
  border: 1px solid rgba(99,199,255,.54);
  border-left: 5px solid var(--orange);
  border-radius: 2px 18px 2px 18px;
}

.topbar::before {
  content: "A-1 // FLIGHTLINE";
  position: absolute;
  left: 58px;
  bottom: 3px;
  color: rgba(145,218,255,.5);
  font: 700 .52rem ui-monospace, monospace;
  letter-spacing: .16em;
}

.brand-mark {
  border-radius: 2px 12px 2px 12px;
  background: linear-gradient(145deg, #55d5ff, #075fbe 66%, #07366c);
  box-shadow: 0 0 0 2px rgba(255,255,255,.82), 0 0 22px rgba(71,196,255,.48);
}

.brand strong { color: #fff; font-family: var(--display); letter-spacing: .08em; }
.status-strip { position: relative; z-index: 2; }
.status-pill {
  min-height: 32px;
  color: #b9d5e9;
  border: 1px solid rgba(99,199,255,.36);
  border-radius: 2px 11px 2px 11px;
  background: linear-gradient(180deg, rgba(13,84,143,.8), rgba(4,40,77,.9));
  box-shadow: inset 3px 0 0 rgba(99,199,255,.38);
}
.status-pill strong { color: #fff; text-shadow: 0 0 10px rgba(99,199,255,.5); }

h1, h2, h3 { color: #fff; }
h1 { text-shadow: 0 3px 0 rgba(4,48,91,.85), 0 14px 38px rgba(1,18,38,.4); }
h1 span { color: #ff8e32; text-shadow: 0 2px 0 #9b3f06, 0 0 24px rgba(255,122,26,.36); }
.lead { color: #d6ecfa; }
.muted { color: var(--muted); }
.eyebrow { color: #8cddff; }
.eyebrow::before { background: linear-gradient(90deg, var(--orange), #ffc55c); }

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  color: #fff;
  border-radius: 2px 14px 2px 14px;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}

.primary-button {
  background: linear-gradient(135deg, #ff9c34, #ef5f0c 72%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.32), 0 10px 24px rgba(238,90,10,.3);
}
.secondary-button { background: linear-gradient(135deg, #39b7ee, #075fbe 72%); }
.ghost-button { color: #dff4ff; border: 1px solid rgba(99,199,255,.4); background: rgba(6,53,96,.72); }

.hero,
.briefing,
.identity-screen,
.result-card {
  max-width: none;
  min-height: calc(100dvh - 20px);
  overflow: hidden;
  border-radius: 4px 30px 4px 30px;
  background:
    linear-gradient(105deg, rgba(3,28,56,.95) 0 36%, rgba(5,52,91,.6) 67%, rgba(3,25,51,.88) 100%),
    url("assets/backgrounds/a1-flightline-hangar-v1.webp") center / cover;
}

.hero {
  position: relative;
  grid-template-columns: minmax(330px,.82fr) minmax(500px,1.18fr);
  gap: clamp(18px, 3vw, 46px);
  padding: clamp(28px, 5vw, 64px);
}

.hero::before,
.identity-screen::before,
.briefing::before,
.complete-screen::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 0;
  border: 1px solid rgba(99,199,255,.2);
  clip-path: polygon(0 0, 34% 0, 37% 4px, 63% 4px, 66% 0, 100% 0, 100% 100%, 0 100%);
  pointer-events: none;
}

.hero > *,
.identity-screen > *,
.briefing > *,
.complete-screen > * { position: relative; z-index: 1; }

.hero h1 { font-size: clamp(3.6rem, 7vw, 6.4rem); }
.hero .lead { max-width: 570px; }
.hero .muted { color: #9fc7df; font-family: ui-monospace, monospace; letter-spacing: .05em; }

.hero-showcase {
  min-height: 440px;
  border: 1px solid rgba(99,199,255,.66);
  border-radius: 2px 26px 2px 26px;
  background:
    linear-gradient(180deg, rgba(5,58,102,.08) 0 58%, rgba(2,24,49,.28) 100%),
    url("assets/backgrounds/a1-flightline-hangar-v1.webp") center / cover;
  box-shadow: inset 0 0 0 4px rgba(4,50,90,.24), 0 20px 45px rgba(1,17,35,.32);
}

.hero-showcase::before {
  inset: 14px 18px auto;
  height: 50px;
  opacity: 1;
  background: linear-gradient(90deg, rgba(5,45,84,.92), rgba(6,85,143,.62), transparent);
  clip-path: polygon(0 0, 78% 0, 72% 100%, 0 100%);
}

.hero-showcase::after {
  top: 13%;
  width: 52%;
  border-color: rgba(99,199,255,.62);
  box-shadow: 0 0 0 12px rgba(13,130,203,.12), 0 0 52px rgba(83,202,255,.34), inset 0 0 32px rgba(83,202,255,.16);
}

.arena-callout {
  position: absolute;
  z-index: 6;
  top: 29px;
  left: 35px;
  color: #fff;
  font: 900 .7rem ui-monospace, monospace;
  letter-spacing: .16em;
}

.hero-character { left: 2%; bottom: 40px; width: 210px; height: 315px; }
.hero-monster { right: 3%; bottom: 66px; width: 170px; height: 220px; }
.hero-versus { top: 45%; font-size: clamp(2.8rem,5vw,4.4rem); }
.hero-action-card { bottom: 56px; width: 134px; min-height: 182px; border-color: #63c7ff; border-radius: 2px 16px 2px 16px; }

.hero-route {
  position: absolute;
  z-index: 8;
  right: 18px;
  bottom: 14px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid rgba(99,199,255,.42);
  background: rgba(3,31,60,.84);
  backdrop-filter: blur(8px);
}
.hero-route span { display: grid; width: 25px; height: 22px; place-items: center; color: #85ccef; border: 1px solid currentColor; font: 900 .64rem ui-monospace, monospace; }
.hero-route span.active { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 0 14px rgba(255,122,26,.52); }
.hero-route i { width: min(5vw,58px); height: 2px; background: linear-gradient(90deg, #278fd0, #63c7ff); }

/* Mission briefing: tactical route plus live arena preview. */
.briefing {
  display: grid;
  grid-template-columns: minmax(410px,.9fr) minmax(470px,1.1fr);
  grid-template-rows: minmax(0,1fr);
  align-items: center;
  gap: clamp(24px,4vw,62px);
  padding: clamp(28px,5vw,62px);
}

.briefing-copy { min-width: 0; }
.briefing-copy h2 { margin-bottom: 8px; font-size: clamp(2.5rem,4.7vw,4.4rem); line-height: 1; }
.briefing-copy .lead { margin-bottom: 14px; font-size: .98rem; line-height: 1.55; }
.brief-grid { position: relative; grid-template-columns: 1fr; gap: 7px; margin: 14px 0; }
.brief-grid::before { content: ""; position: absolute; top: 18px; bottom: 18px; left: 23px; width: 2px; background: linear-gradient(#ff8b30, #63c7ff 46%, #48d99b); }
.brief-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 11px;
  min-height: 57px;
  padding: 7px 12px 7px 0;
  color: #fff;
  border: 1px solid rgba(99,199,255,.28);
  border-left: 0;
  border-radius: 0 14px 0 14px;
  background: linear-gradient(90deg, rgba(5,49,90,.96), rgba(7,84,137,.66));
  box-shadow: inset 3px 0 0 rgba(99,199,255,.34), 0 8px 18px rgba(1,18,38,.14);
}
.brief-item b { position: relative; z-index: 2; display: grid; width: 38px; height: 38px; margin-left: 5px; place-items: center; color: #fff; border: 2px solid #63c7ff; background: #075fbe; clip-path: polygon(50% 0, 94% 25%, 86% 76%, 50% 100%, 14% 76%, 6% 25%); font: 900 .72rem ui-monospace, monospace; }
.brief-item:first-child b { border-color: #ffb05a; background: #ee6c15; box-shadow: 0 0 18px rgba(255,122,26,.42); }
.brief-item strong { margin: 0; color: #fff; font-family: var(--display); font-size: 1rem; letter-spacing: .06em; }
.brief-item small { display: block; margin-top: 2px; color: #b6d7eb; font-size: .72rem; }
.brief-rule { display: flex; gap: 9px; margin: 12px 0 0; padding: 9px 11px; color: #cce8f7; border-left: 4px solid var(--orange); background: rgba(4,41,76,.76); font-size: .76rem; line-height: 1.4; }
.brief-rule strong { flex: 0 0 auto; color: #ffb25f; }
.briefing-copy .button-row { margin-top: 13px; }

.briefing-arena {
  position: relative;
  min-height: min(76vh, 500px);
  overflow: hidden;
  border: 1px solid rgba(99,199,255,.64);
  border-radius: 2px 26px 2px 26px;
  background:
    linear-gradient(180deg, rgba(5,56,99,.08) 0 62%, rgba(2,24,49,.32) 100%),
    url("assets/backgrounds/stage-1-hazard-apron-v1.webp") center / cover;
  box-shadow: inset 0 0 0 4px rgba(4,50,90,.24), 0 20px 45px rgba(1,17,35,.32);
}
.briefing-arena::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(99,199,255,.3); pointer-events: none; }
.briefing-seal { position: absolute; top: 44%; left: 50%; width: 220px; aspect-ratio: 1; border: 2px solid rgba(99,199,255,.65); border-radius: 50%; box-shadow: 0 0 0 14px rgba(50,169,231,.11), 0 0 54px rgba(56,190,249,.34), inset 0 0 34px rgba(56,190,249,.16); transform: translate(-50%,-50%); animation: a1-seal 8s linear infinite; }
.briefing-seal::before { content: ""; position: absolute; inset: 18px; border: 1px dashed rgba(255,255,255,.74); border-radius: 50%; }
@keyframes a1-seal { to { transform: translate(-50%,-50%) rotate(360deg); } }
.briefing-character,
.briefing-monster { position: absolute; z-index: 2; display: block; bottom: 48px; background-repeat: no-repeat; background-size: contain; background-position: center bottom; filter: drop-shadow(0 18px 12px rgba(1,19,38,.36)); }
.briefing-character { left: 2%; width: 235px; height: 340px; }
.briefing-monster { right: 4%; width: 180px; height: 230px; }
.briefing-vs { position: absolute; z-index: 4; top: 44%; left: 50%; color: #fff; font-family: var(--display); font-size: 4rem; font-style: italic; font-weight: 1000; text-shadow: -2px -2px #e24658, 2px 2px #e24658, 0 10px 25px rgba(157,25,48,.4); transform: translate(-50%,-50%) rotate(-6deg); }
.briefing-stage-tag { position: absolute; z-index: 4; top: 20px; left: 20px; padding: 8px 12px; color: #fff; border-left: 4px solid var(--orange); background: rgba(4,39,74,.88); font: 900 .7rem ui-monospace, monospace; letter-spacing: .12em; }
.briefing-cards { position: absolute; z-index: 5; right: 22px; bottom: 18px; display: flex; gap: 6px; }
.briefing-cards i { display: grid; width: 38px; height: 54px; place-items: center; color: #fff; border: 2px solid #63c7ff; background: linear-gradient(155deg,#1a8bd1,#07365e); box-shadow: 0 7px 12px rgba(1,20,39,.34); font: 900 .72rem ui-monospace, monospace; transform-origin: bottom; }
.briefing-cards i:first-child { transform: rotate(-9deg); }
.briefing-cards i:last-child { transform: rotate(9deg); }
.briefing-player-name { position: absolute; z-index: 4; left: 64px; bottom: 23px; padding: 5px 12px; color: #fff; background: #063f70; border: 1px solid rgba(99,199,255,.48); }

/* Character loadout modules. */
.identity-screen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr) auto;
  align-content: center;
  padding: clamp(24px,4vw,48px);
  background:
    linear-gradient(180deg, rgba(3,29,57,.92), rgba(4,44,79,.76)),
    url("assets/backgrounds/stage-2-ppe-hangar-v1.webp") center / cover;
}
.identity-screen .lead { max-width: 760px; margin-bottom: 0; }
.identity-grid { min-height: 0; gap: 16px; margin: 18px 0 14px; }
.identity-card {
  display: grid;
  min-height: 0;
  padding: 12px 16px 14px;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(99,199,255,.42);
  border-radius: 2px 22px 2px 22px;
  background: linear-gradient(155deg, rgba(8,64,109,.88), rgba(3,31,61,.94));
  box-shadow: inset 0 0 0 3px rgba(99,199,255,.06), 0 16px 30px rgba(1,18,38,.24);
}
.identity-card::before { height: 5px; background: linear-gradient(90deg,var(--identity-accent),#63c7ff 55%,var(--orange)); }
.identity-card:hover,
.identity-card.selected { border-color: var(--identity-accent); background: linear-gradient(155deg, rgba(9,83,140,.92), rgba(4,37,70,.96)); box-shadow: inset 0 0 0 3px rgba(99,199,255,.09), 0 0 0 3px color-mix(in srgb,var(--identity-accent) 20%,transparent), 0 18px 36px rgba(1,18,38,.36); }
.identity-card strong { color: #fff; font-size: 1.24rem; }
.identity-card small { color: #c3dfef; font-size: .8rem; }
.identity-avatar { width: min(13vw,160px); height: min(36vh,215px); margin-bottom: 4px; background-position: center bottom; }
.identity-screen > .button-row { margin-top: 0; }

/* Per-stage scene backgrounds. */
.stage-intro-panel {
  border-color: color-mix(in srgb,var(--stage-accent) 58%,#63c7ff);
  background:
    linear-gradient(100deg, rgba(3,29,57,.96) 0 46%, rgba(3,45,79,.48) 68%, rgba(2,26,52,.72) 100%),
    var(--stage-bg) center / cover;
}
.stage-intro-panel::before { opacity: .7; }
.stage-intro-copy h2 { color: #fff; text-shadow: 0 4px 18px rgba(1,18,38,.45); }
.stage-number { color: #fff; border-color: color-mix(in srgb,var(--stage-accent) 66%,#fff); background: color-mix(in srgb,var(--stage-accent) 42%,rgba(4,42,76,.88)); }
.typed-copy { color: #fff; border-color: rgba(99,199,255,.42); background: rgba(3,37,70,.87); box-shadow: 0 16px 32px rgba(1,18,38,.28); }
.typed-copy p { color: #d8edf8; }
.intro-skip { color: #fff; border-color: rgba(99,199,255,.4); background: rgba(3,39,73,.88); }
.stage-intro-visual { border-color: color-mix(in srgb,var(--stage-accent) 72%,#63c7ff); background: radial-gradient(circle at 50% 50%, rgba(99,199,255,.18), rgba(4,36,68,.18) 40%, rgba(2,25,50,.5)); box-shadow: inset 0 0 0 4px rgba(99,199,255,.08), 0 20px 42px rgba(1,18,38,.3); }
.stage-intro-visual::before { opacity: .55; background: repeating-linear-gradient(90deg,transparent 0 24px,rgba(99,199,255,.14) 25px 26px); clip-path: none; }
.stage-intro-visual > span:last-child { color: #d7edf8; }

.battle-panel {
  color: #fff;
  border-color: rgba(99,199,255,.56);
  background: linear-gradient(145deg, rgba(3,31,60,.96), rgba(5,60,102,.9));
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(99,199,255,.06);
}
.battle-heading h2 { color: #fff; }
.battle-heading .round-label { color: #b7d6e8; }
.topic-chip { color: #fff !important; border-color: color-mix(in srgb,var(--stage-accent) 70%,#fff) !important; background: color-mix(in srgb,var(--stage-accent) 35%,rgba(4,42,76,.92)); }
.progress-line { border-color: rgba(99,199,255,.22); background: rgba(2,25,50,.72); }
.progress-line span { background: linear-gradient(90deg,var(--orange),#ffd05d 24%,#63c7ff 58%,#48d99b); }
.encounter {
  border-color: rgba(99,199,255,.72);
  background:
    linear-gradient(180deg, rgba(6,57,99,.08) 0 64%, rgba(2,25,50,.25) 100%),
    var(--stage-bg) center / cover;
  box-shadow: inset 0 0 0 3px rgba(3,42,77,.2), inset 0 -24px 38px rgba(1,18,38,.18);
}
.encounter::before { opacity: .38; background: linear-gradient(90deg,transparent,rgba(99,199,255,.38),transparent); clip-path: polygon(0 48%,42% 48%,46% 0,54% 0,58% 48%,100% 48%,100% 100%,0 100%); }
.situation-card { color: #fff; border: 1px solid rgba(99,199,255,.54); border-top: 3px solid var(--orange); background: linear-gradient(100deg, rgba(3,39,74,.96), rgba(4,64,109,.88)); box-shadow: 0 10px 22px rgba(1,18,38,.28); }
.situation-card h3 { color: #8ddcff; }
.situation-card p { color: #fff; }
.situation-instruction { color: #bad8e9 !important; }
.combat-name,
.monster-name { border-color: rgba(99,199,255,.68); border-radius: 2px 11px 2px 11px; background: linear-gradient(135deg,#0c6bb3,#062d54); }
.weakness { color: #fff; border-color: rgba(255,85,116,.62); border-radius: 2px 11px 2px 11px; background: linear-gradient(135deg,#d62e54,#8d1732); }
.versus-mark { font-size: clamp(3rem,5vw,4.7rem); }

.action-card { border-color: #63c7ff; background: linear-gradient(155deg,#fff,#dff2ff 72%,#bddcf1); box-shadow: 0 0 0 2px rgba(255,255,255,.9),0 16px 28px rgba(1,20,41,.4),inset 0 -5px 0 rgba(5,91,154,.1); }
.action-card:hover,
.action-card.armed { background: linear-gradient(155deg,#fff,#fff2df 72%,#ffc780); }
.card-label { background: linear-gradient(110deg,#063f79,#087ac8 68%,#45bee9); }
.feedback { color: #173b5f; }
.feedback h3 { color: #0c3156; }
.feedback .muted { color: #55728e; }
.feedback .source-link { color: #075fbe; }

.outcome-panel { border-color: rgba(99,199,255,.72); }
.complete-screen {
  background:
    linear-gradient(105deg, rgba(3,28,56,.95), rgba(6,64,106,.74)),
    url("assets/backgrounds/stage-4-equipment-shop-v1.webp") center / cover;
}
.result-stat { color: #fff; border-color: rgba(99,199,255,.34); background: rgba(4,45,82,.84); }
.result-stat strong { color: #6fd8ff; }
.passcode-panel { padding: 16px; border: 1px solid rgba(99,199,255,.34); background: rgba(3,35,67,.82); }
.field label { color: #c8e3f2; }
.field input { color: #17324d; border-color: rgba(99,199,255,.5); background: #f7fcff; }
.passcode { color: #ff9b3d; background: rgba(3,32,61,.92); }

@media (min-width: 621px) and (max-height: 760px) {
  .app-shell { padding: 6px 0 0; }
  .hero,
  .briefing,
  .identity-screen,
  .complete-screen { height: calc(100dvh - 20px); min-height: 0; }
  .hero { grid-template-columns: minmax(300px,.78fr) minmax(450px,1.22fr); padding: 22px clamp(28px,4vw,50px); }
  .hero-showcase { height: 100%; max-height: 500px; }
  .briefing { grid-template-columns: minmax(390px,.9fr) minmax(440px,1.1fr); gap: 24px; padding: 20px 32px; }
  .briefing-copy h2 { font-size: clamp(2.2rem,4vw,3.3rem); }
  .briefing-copy .lead { font-size: .86rem; line-height: 1.45; }
  .brief-grid { gap: 5px; margin: 9px 0; }
  .brief-item { min-height: 48px; padding-block: 4px; }
  .brief-item b { width: 34px; height: 34px; }
  .brief-item small { font-size: .66rem; }
  .brief-rule { margin-top: 8px; padding: 7px 9px; font-size: .7rem; }
  .briefing-copy .button-row { margin-top: 9px; }
  .briefing-copy .button-row > * { min-height: 40px; padding-block: 7px; }
  .briefing-arena { min-height: 0; height: 100%; max-height: 510px; }
  .briefing-character { width: 200px; height: 300px; }
  .briefing-monster { width: 155px; height: 205px; }
  .identity-screen { padding: 18px 34px 14px; }
  .identity-grid { margin: 10px 0; }
  .identity-card { height: 100%; }
  .identity-avatar { width: clamp(135px,15vw,180px); height: clamp(170px,37vh,220px); }
  .identity-card small { font-size: .74rem; }
  .battle-panel { padding: 10px 18px; }
  .encounter { height: 252px; }
  .stage-intro-panel,
  .outcome-panel { min-height: calc(100dvh - 80px); }
}

@media (max-width: 880px) {
  .hero { grid-template-columns: minmax(260px,.82fr) minmax(350px,1.18fr); gap: 16px; padding-inline: 24px; }
  .briefing { grid-template-columns: minmax(280px,.88fr) minmax(320px,1.12fr); gap: 14px; padding-inline: 20px; }
  .briefing-character { left: -3%; width: 190px; height: 285px; }
  .briefing-monster { right: 1%; width: 145px; height: 195px; }
}

@media (max-width: 620px) {
  body { background-position: 58% center; }
  .app-shell { width: calc(100% - 12px); padding: 6px 0; }
  .topbar { min-height: 46px; margin-bottom: 6px; padding: 6px 7px; border-left-width: 4px; }
  .topbar::before { display: none; }
  .stage-intro-screen,
  .outcome-screen { min-height: calc(100dvh - 12px); }
  .brand strong { font-size: .74rem; }
  .status-pill { min-height: 27px; padding: 3px 5px; font-size: .66rem; }
  .hero,
  .briefing,
  .identity-screen,
  .result-card { min-height: calc(100dvh - 12px); border-radius: 2px 22px 2px 22px; }
  .hero { display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(220px,1fr); gap: 12px; padding: 24px 18px 12px; }
  .hero h1 { margin-bottom: 9px; font-size: clamp(3rem,17vw,4.4rem); }
  .hero .lead { font-size: .86rem; line-height: 1.45; }
  .hero .button-row { margin-top: 10px; }
  .hero .muted { margin-top: 8px !important; font-size: .68rem; }
  .hero-showcase { min-height: 260px; height: 100%; }
  .arena-callout { top: 21px; left: 24px; font-size: .58rem; }
  .hero-character { left: -9px; bottom: 36px; width: 142px; height: 210px; }
  .hero-monster { right: -1px; bottom: 51px; width: 105px; height: 140px; }
  .hero-versus { top: 43%; font-size: 2.55rem; }
  .hero-action-card { bottom: 44px; width: 89px; min-height: 120px; padding: 7px 5px; border-width: 4px; }
  .hero-action-card::before { width: 42px; height: 42px; margin: 2px auto 7px; }
  .hero-action-card span { font-size: .54rem; }
  .hero-action-card strong { font-size: .7rem; }
  .hero-route { right: 8px; bottom: 8px; left: 8px; min-height: 29px; }
  .hero-route i { width: 18px; }

  .briefing { display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(210px,.78fr); gap: 9px; padding: 22px 16px 12px; }
  .briefing-copy h2 { margin-bottom: 5px; font-size: 2.1rem; }
  .briefing-copy .lead { margin-bottom: 7px; font-size: .76rem; line-height: 1.4; }
  .brief-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin: 7px 0; }
  .brief-grid::before { display: none; }
  .brief-item { grid-template-columns: 30px 1fr; gap: 6px; min-height: 48px; padding: 5px 6px 5px 0; }
  .brief-item b { width: 28px; height: 30px; margin-left: 2px; font-size: .58rem; }
  .brief-item strong { font-size: .78rem; }
  .brief-item small { display: none; }
  .brief-rule { margin-top: 6px; padding: 5px 7px; font-size: .65rem; }
  .briefing-copy .button-row { margin-top: 7px; }
  .briefing-copy .button-row > * { min-height: 38px; padding: 6px 9px; font-size: .75rem; }
  .briefing-arena { min-height: 210px; height: 100%; }
  .briefing-seal { width: 120px; }
  .briefing-character { left: 0; bottom: 23px; width: 120px; height: 175px; }
  .briefing-monster { right: 3px; bottom: 36px; width: 92px; height: 118px; }
  .briefing-vs { top: 48%; font-size: 2.4rem; }
  .briefing-stage-tag { top: 8px; left: 8px; padding: 5px 7px; font-size: .54rem; }
  .briefing-cards { right: 8px; bottom: 7px; }
  .briefing-cards i { width: 25px; height: 36px; font-size: .56rem; }
  .briefing-player-name { left: 37px; bottom: 6px; padding: 3px 7px; font-size: .66rem; }

  .identity-screen { padding: 20px 14px 12px; }
  .identity-screen h2 { margin-bottom: 4px; font-size: 2.05rem; }
  .identity-screen .lead { font-size: .75rem; line-height: 1.4; }
  .identity-grid { gap: 8px; margin: 9px 0; }
  .identity-card { grid-template-columns: 90px minmax(0,1fr); min-height: 122px; padding: 7px 9px; }
  .identity-avatar { width: 82px; height: 108px; }
  .identity-card strong { font-size: 1rem; }
  .identity-card small { font-size: .7rem; line-height: 1.35; }
  .identity-screen > .button-row > * { min-height: 38px; padding-block: 7px; }

  .stage-intro-panel { background: linear-gradient(180deg,rgba(3,29,57,.9),rgba(3,45,79,.35)),var(--stage-bg) center / cover; }
  .stage-intro-copy { padding: 9px; border: 1px solid rgba(99,199,255,.34); background: rgba(3,35,66,.75); backdrop-filter: blur(7px); }
  .stage-intro-visual { background: radial-gradient(circle,rgba(99,199,255,.22),rgba(2,25,50,.42)); }
  .encounter { background: linear-gradient(180deg,rgba(6,57,99,.06),rgba(2,25,50,.2)),var(--stage-bg) center / cover; }
  .situation-card { background: rgba(3,39,74,.93); }
  .complete-screen { overflow: visible; }
}

/* A-1 tactical card launch deck ----------------------------------------- */
.battle-panel .encounter {
  grid-template-rows: minmax(0, 1fr);
  padding-top: 10px;
}

.battle-panel .player-zone,
.battle-panel .monster-zone,
.battle-panel .arena-center { grid-row: 1; }

.card-command-row {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(180px, .78fr) minmax(520px, 2.15fr) minmax(180px, .78fr);
  align-items: end;
  gap: 14px;
  margin-top: 10px;
}

.card-command-row::before {
  content: "";
  position: absolute;
  right: 14%;
  bottom: 7px;
  left: 14%;
  z-index: -1;
  height: 2px;
  background: linear-gradient(90deg, transparent, #2d9ddd 18%, #63c7ff 50%, #2d9ddd 82%, transparent);
  box-shadow: 0 0 16px rgba(99,199,255,.7);
}

.combat-info {
  position: relative;
  min-width: 0;
  min-height: 184px;
  padding: 16px 15px 14px;
  overflow: hidden;
  color: #eaf8ff;
  border: 1px solid rgba(99,199,255,.56);
  background:
    linear-gradient(145deg, rgba(7,67,115,.94), rgba(3,30,58,.97)),
    repeating-linear-gradient(135deg, transparent 0 20px, rgba(99,199,255,.06) 21px 22px);
  box-shadow: inset 0 0 0 3px rgba(99,199,255,.06), 0 12px 26px rgba(1,18,38,.32);
  clip-path: polygon(0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}

.combat-info::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--console-accent), rgba(255,255,255,.78), transparent 78%);
  box-shadow: 0 0 14px var(--console-accent);
}

.situation-console { --console-accent: #ff8128; }
.attack-console { --console-accent: #63c7ff; }
.console-code {
  display: block;
  margin-bottom: 7px;
  color: var(--console-accent);
  font: 900 .58rem ui-monospace, monospace;
  letter-spacing: .16em;
}
.combat-info h3 {
  margin-bottom: 8px;
  color: #fff;
  font-family: var(--display);
  font-size: 1.04rem;
  letter-spacing: .05em;
}
.combat-info p { margin: 0; color: #cbe5f4; font-size: .77rem; line-height: 1.55; }

.control-step {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding: 6px 7px;
  border: 1px solid rgba(99,199,255,.22);
  background: rgba(3,34,65,.62);
}
.control-step b {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  border: 1px solid #63c7ff;
  background: linear-gradient(145deg,#1699df,#07528e);
  box-shadow: 0 0 14px rgba(99,199,255,.3);
  font: 1000 .78rem ui-monospace, monospace;
}
.control-step span { color: #d9edf8; font-size: .7rem; font-weight: 800; line-height: 1.35; }
.armed-status { margin-top: 8px !important; color: #ffb25f !important; font-size: .67rem !important; }

.card-command-row .action-list {
  display: grid;
  grid-template-columns: repeat(3, 179px);
  align-items: end;
  justify-content: center;
  gap: 12px;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  perspective: 1100px;
}

.battle-panel .action-card {
  --card-rotation: 0deg;
  --card-lift: 0px;
  position: relative;
  display: flex;
  width: 179px;
  height: 250px;
  aspect-ratio: 63 / 88;
  min-width: 0;
  padding: 5px;
  overflow: hidden;
  flex-direction: column;
  color: #fff;
  border: 2px solid color-mix(in srgb, var(--card-effect) 68%, #63c7ff);
  border-radius: 0;
  background:
    linear-gradient(155deg, rgba(14,109,172,.96), rgba(3,34,65,.99) 54%, rgba(2,21,43,.99)),
    repeating-linear-gradient(135deg, transparent 0 16px, rgba(99,199,255,.08) 17px 18px);
  box-shadow:
    0 0 0 2px rgba(4,32,60,.94),
    0 0 0 3px color-mix(in srgb, var(--card-effect) 46%, transparent),
    0 15px 26px rgba(1,17,35,.42),
    inset 0 1px 0 rgba(255,255,255,.26);
  clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
  transform-origin: 50% 100%;
  transform: translateY(var(--card-lift)) rotate(var(--card-rotation));
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), filter 180ms ease, box-shadow 180ms ease;
}

.battle-panel .action-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 6;
  display: block;
  margin: 0;
  border: 1px solid rgba(255,255,255,.22);
  clip-path: inherit;
  pointer-events: none;
}

.battle-panel .action-card::after {
  content: "";
  position: absolute;
  z-index: 7;
  top: -32%;
  left: -76%;
  width: 44%;
  height: 166%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  transform: rotate(18deg);
  transition: left 420ms ease;
}

.battle-panel .action-card:nth-child(1) { --card-rotation: -1.4deg; }
.battle-panel .action-card:nth-child(3) { --card-rotation: 1.4deg; }
.battle-panel .action-card:hover::after,
.battle-panel .action-card.armed::after { left: 132%; }
.battle-panel .action-card:hover {
  --card-lift: -7px;
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px rgba(4,32,60,.94), 0 0 0 4px var(--card-effect), 0 0 28px color-mix(in srgb,var(--card-effect) 46%,transparent), 0 18px 30px rgba(1,17,35,.44);
}
.battle-panel .action-card.armed {
  --card-rotation: 0deg;
  --card-lift: 0px;
  z-index: 20;
  filter: brightness(1.1) saturate(1.12);
  box-shadow: 0 0 0 2px rgba(4,32,60,.94), 0 0 0 5px var(--card-effect), 0 0 34px color-mix(in srgb,var(--card-effect) 62%,transparent), 0 22px 34px rgba(1,17,35,.5);
  transform: translateY(0) rotate(0) scale(1.055);
}

.battle-panel .card-label {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) auto;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  color: #fff;
  border-bottom: 1px solid rgba(99,199,255,.38);
  background: linear-gradient(90deg, rgba(5,48,88,.98), color-mix(in srgb,var(--card-effect) 58%,#075f9e));
}
.battle-panel .action-key {
  width: 27px;
  height: 27px;
  margin: 0;
  color: #fff;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 3px 9px 3px 9px;
  background: linear-gradient(145deg,#ffad45,#ec6415);
  box-shadow: 0 0 12px rgba(255,122,26,.46);
}
.card-series {
  overflow: hidden;
  color: rgba(221,244,255,.7);
  font: 900 .49rem ui-monospace, monospace;
  letter-spacing: .09em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.battle-panel .card-effect-tag { color: #fff; font-size: .64rem; }
.battle-panel .card-effect-tag > span { color: #fff; border: 1px solid rgba(255,255,255,.68); background: var(--card-effect); }

.battle-panel .card-illustration {
  position: relative;
  z-index: 2;
  height: 126px;
  flex: 0 0 126px;
  border: 0;
  border-bottom: 2px solid color-mix(in srgb,var(--card-effect) 70%,#63c7ff);
  background-color: #0a4f80;
  filter: saturate(.96) contrast(1.08) brightness(.95);
  box-shadow: inset 0 0 0 2px rgba(2,28,53,.62), inset 0 -22px 24px rgba(2,25,49,.22);
}
.battle-panel .card-illustration::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 65%, rgba(2,28,53,.4)),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(99,199,255,.07) 6px 7px);
  pointer-events: none;
}

.battle-panel .action-text {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 0;
  flex: 1;
  align-content: center;
  gap: 5px;
  padding: 9px 10px 10px;
  color: #eef9ff;
  background:
    linear-gradient(145deg, rgba(6,58,101,.98), rgba(2,29,57,.99)),
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(99,199,255,.05) 15px 16px);
  font-size: .76rem;
  line-height: 1.38;
  text-shadow: 0 1px 2px rgba(1,15,30,.45);
}
.battle-panel .action-text small {
  color: var(--card-effect);
  font: 1000 .52rem ui-monospace, monospace;
  letter-spacing: .13em;
}
.battle-panel .action-text > span { display: block; }

@media (min-width: 621px) and (max-height: 760px) {
  .battle-panel .encounter {
    min-height: 188px;
    height: 188px;
    margin-bottom: 0;
    padding-top: 4px;
  }
  .battle-panel .player-zone,
  .battle-panel .monster-zone { min-height: 176px; }
  .battle-panel .battle-character { width: 124px; height: 174px; }
  .battle-panel .monster-sprite { width: 96px; height: 128px; margin-bottom: 24px; }
  .card-command-row { grid-template-columns: minmax(170px,.75fr) minmax(456px,2.1fr) minmax(170px,.75fr); gap: 10px; margin-top: 7px; }
  .combat-info { min-height: 174px; padding: 12px 11px 10px; }
  .combat-info h3 { margin-bottom: 6px; font-size: .94rem; }
  .combat-info p { font-size: .69rem; line-height: 1.45; }
  .control-step { grid-template-columns: 29px 1fr; gap: 6px; margin-top: 5px; padding: 4px 5px; }
  .control-step b { width: 28px; height: 28px; font-size: .68rem; }
  .control-step span { font-size: .62rem; }
  .armed-status { margin-top: 5px !important; font-size: .59rem !important; }
  .card-command-row .action-list { grid-template-columns: repeat(3, 147px); gap: 9px; }
  .battle-panel .action-card { width: 147px; height: 205px; }
  .battle-panel .card-label { grid-template-columns: 27px minmax(0,1fr) auto; min-height: 31px; padding: 3px 5px; }
  .battle-panel .action-key { width: 24px; height: 24px; font-size: .7rem; }
  .card-series { font-size: .42rem; }
  .battle-panel .card-effect-tag { font-size: .56rem; }
  .battle-panel .card-effect-tag > span { width: 17px; height: 17px; font-size: .62rem; }
  .battle-panel .card-illustration { height: 104px; flex-basis: 104px; }
  .battle-panel .action-text { padding: 6px 7px 7px; font-size: .66rem; line-height: 1.32; }
  .battle-panel .action-text small { font-size: .44rem; }
}

@media (max-width: 880px) and (min-width: 621px) {
  .card-command-row { grid-template-columns: minmax(126px,.7fr) minmax(390px,2.2fr) minmax(126px,.7fr); gap: 7px; }
  .combat-info { padding-inline: 9px; }
  .console-code { font-size: .49rem; }
  .combat-info h3 { font-size: .85rem; }
  .combat-info p { font-size: .62rem; }
  .control-step span { font-size: .56rem; }
  .card-series { display: none; }
}

@media (max-width: 620px) {
  .battle-panel .encounter { grid-template-rows: minmax(205px,1fr); }
  .battle-panel .player-zone,
  .battle-panel .monster-zone,
  .battle-panel .arena-center { grid-row: 1; }
  .card-command-row {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px;
    margin-top: 8px;
  }
  .combat-info { min-height: 118px; padding: 10px 9px 8px; }
  .console-code { margin-bottom: 4px; font-size: .46rem; }
  .combat-info h3 { margin-bottom: 5px; font-size: .84rem; }
  .combat-info p { font-size: .64rem; line-height: 1.4; }
  .control-step { display: flex; gap: 5px; margin-top: 4px; padding: 3px 4px; }
  .control-step b { width: 25px; height: 25px; flex: 0 0 25px; font-size: .6rem; }
  .control-step span { font-size: .56rem; }
  .armed-status { display: none; }
  .card-command-row .action-list {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin: 0 -8px;
    padding: 18px 22px 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .battle-panel .action-card {
    width: min(62vw,214px);
    height: auto;
    aspect-ratio: 63 / 88;
    flex: 0 0 min(62vw,214px);
    scroll-snap-align: center;
    touch-action: pan-x;
  }
  .battle-panel .card-illustration { height: 148px; flex-basis: 148px; }
  .battle-panel .action-text { padding: 10px 12px 12px; font-size: .86rem; }
}

/* Rounded battle controls and mission victory roster ------------------- */
.situation-console,
.attack-console {
  clip-path: none;
}
.situation-console {
  border-radius: 18px 0 0 18px;
}
.attack-console {
  border-radius: 0 18px 18px 0;
}

.battle-panel .action-card {
  border-radius: 16px;
  clip-path: none;
}

.battle-panel .action-card::before {
  border-radius: 12px;
  clip-path: none;
}

.complete-summary { min-width: 0; }
.defeated-roster {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(99,199,255,.34);
  border-radius: 16px;
  background: linear-gradient(145deg,rgba(3,43,80,.9),rgba(2,27,53,.84));
  box-shadow: inset 0 0 0 2px rgba(99,199,255,.05), 0 12px 24px rgba(1,17,35,.24);
}
.defeated-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  text-align: left;
}
.defeated-heading span {
  color: #63c7ff;
  font: 900 .55rem ui-monospace, monospace;
  letter-spacing: .14em;
}
.defeated-heading h3 { margin: 0; color: #fff; font-size: .9rem; }
.defeated-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.defeated-monster {
  position: relative;
  min-width: 0;
  padding: 5px 4px 6px;
  overflow: hidden;
  text-align: center;
  border: 1px solid color-mix(in srgb,var(--monster-accent) 70%,#63c7ff);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%,color-mix(in srgb,var(--monster-accent) 23%,transparent),rgba(2,27,53,.92) 66%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.08), 0 0 15px color-mix(in srgb,var(--monster-accent) 18%,transparent);
}
.defeated-check {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 5px;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  color: #042d36;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 50%;
  background: #6fe0a8;
  box-shadow: 0 0 12px rgba(111,224,168,.48);
  font-size: .68rem;
  font-weight: 1000;
}
.defeated-monster-art {
  display: block;
  width: 68px;
  height: 68px;
  margin: -2px auto -5px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 8px 7px rgba(0,0,0,.34)) saturate(.9);
}
.defeated-monster strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: .64rem;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.defeated-monster small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #9fcde4;
  font-size: .52rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.complete-summary .result-grid-compact {
  grid-template-columns: repeat(2,minmax(0,1fr));
  max-width: 300px;
  margin: 9px 0 0;
}
.mobile-card-nav { display: none; }

@media (min-width: 621px) and (max-height: 760px) {
  .complete-summary .result-icon { width: 46px; height: 46px; margin-bottom: 5px; font-size: 1.35rem; }
  .complete-summary .lead { font-size: .76rem; }
  .defeated-roster { margin-top: 8px; padding: 7px; border-radius: 13px; }
  .defeated-heading { margin-bottom: 5px; }
  .defeated-heading h3 { font-size: .78rem; }
  .defeated-monster { padding: 3px 3px 4px; border-radius: 9px; }
  .defeated-monster-art { width: 55px; height: 55px; margin-bottom: -4px; }
  .defeated-monster strong { font-size: .57rem; }
  .defeated-monster small { display: none; }
  .complete-summary .result-grid-compact { margin-top: 6px; }
}

@media (max-width: 620px) {
  .situation-console { border-radius: 14px 0 0 14px; }
  .attack-console { border-radius: 0 14px 14px 0; }
  .battle-panel .action-card { border-radius: 14px; }
  .battle-panel .action-card::before { border-radius: 10px; }
  .defeated-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .defeated-monster-art { width: 76px; height: 76px; }
  .complete-summary .result-grid-compact { max-width: none; }
}

@media (max-width: 620px) and (orientation: portrait) {
  body { overflow-x: hidden; }
  .battle-shell,
  .battle-main,
  .battle-panel,
  .card-command-row { min-width: 0; max-width: 100%; }
  .card-command-row {
    grid-template-columns: repeat(2,minmax(0,1fr));
    grid-template-rows: auto auto auto;
    align-items: stretch;
    overflow: hidden;
  }
  .situation-console { grid-column: 1; grid-row: 1; }
  .attack-console { grid-column: 2; grid-row: 1; }
  .combat-info { height: 100%; min-height: 126px; }
  .card-command-row .action-list {
    grid-column: 1 / -1;
    grid-row: 2;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px 14px 9px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-inline: 14px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .card-command-row .action-list::-webkit-scrollbar { display: none; }
  .battle-panel .action-card {
    width: min(62vw,214px);
    flex-basis: min(62vw,214px);
  }
  .mobile-card-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 1px;
  }
  .mobile-card-nav button {
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    color: #fff;
    border: 1px solid rgba(99,199,255,.62);
    border-radius: 50%;
    background: linear-gradient(145deg,#137fc5,#064276);
    box-shadow: 0 0 13px rgba(99,199,255,.24);
    font-size: 1.25rem;
  }
  .mobile-card-nav button:disabled { opacity: .34; }
  .mobile-card-nav span { display: flex; align-items: baseline; color: #d8f1ff; font: 900 .72rem ui-monospace,monospace; }
  .mobile-card-nav strong { color: #ffad54; font-size: .94rem; }
  .mobile-card-nav b { font-weight: 900; }
  .mobile-card-nav small { margin-left: 8px; color: #8fc9e8; font-size: .58rem; letter-spacing: .04em; }
}
