:root {
  color-scheme: dark;
  --bg: #050b14;
  --panel: rgba(9, 24, 41, 0.82);
  --panel-strong: rgba(8, 19, 34, 0.96);
  --line: rgba(112, 219, 255, 0.24);
  --cyan: #55ddff;
  --cyan-strong: #05bff7;
  --yellow: #ffd84b;
  --orange: #ff8a3d;
  --red: #ff4e61;
  --green: #6cf6a0;
  --text: #f5fbff;
  --muted: #a8bac8;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  font-family: ui-rounded, "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #02060b;
  color: var(--text);
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  position: relative;
  width: min(100vw, 480px);
  height: 100dvh;
  max-height: 960px;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
  box-shadow: 0 0 70px rgba(23, 161, 216, 0.14);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.is-active {
  display: block;
}

.safe-top {
  padding-top: max(10px, env(safe-area-inset-top));
}

.safe-bottom {
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.menu-screen {
  overflow: hidden;
  background: #07111e;
}

.menu-step {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
}

.menu-step.is-active {
  display: block;
  animation: stepIn 240ms ease-out both;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 8, 15, 0.22) 0%, rgba(3, 11, 21, 0.76) 38%, #07111e 83%),
    url("assets/lab-background.jpg") center 18% / cover no-repeat;
  transform: scale(1.035);
  filter: saturate(1.02) contrast(1.03);
}

.menu-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 24%, rgba(56, 218, 255, 0.18), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(255, 122, 56, 0.18), transparent 30%),
    linear-gradient(180deg, transparent 0 25%, rgba(2, 8, 15, 0.74) 66%, #07111e 100%);
}

.menu-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) 18px 154px;
  scrollbar-width: none;
}

.menu-content::-webkit-scrollbar,
.result-scroll::-webkit-scrollbar {
  display: none;
}

.game-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 20px;
  text-align: center;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.78);
}

.compact-logo {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 0 0 10px;
}

.compact-logo .logo-csku {
  font-size: 38px;
  -webkit-text-stroke-width: 1px;
}

.compact-logo .logo-sub {
  margin-top: 0;
  padding: 5px 10px 4px;
  font-size: 18px;
}

.logo-csku {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(46px, 14vw, 72px);
  line-height: 0.82;
  letter-spacing: 0.04em;
  color: #eefdff;
  -webkit-text-stroke: 2px #1388c2;
  filter: drop-shadow(0 5px 0 #07395f);
}

.logo-sub {
  margin-top: 12px;
  padding: 6px 16px 5px;
  border: 1px solid rgba(97, 224, 255, 0.5);
  border-radius: 7px;
  background: linear-gradient(180deg, #113d64, #09243c);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(21px, 6.5vw, 31px);
  letter-spacing: 0.05em;
  color: var(--yellow);
  box-shadow: inset 0 0 18px rgba(52, 205, 255, 0.15), 0 8px 22px rgba(0, 0, 0, 0.36);
}

.logo-tagline {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #dbf7ff;
}

.glass-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 38, 61, 0.92), rgba(7, 20, 35, 0.9));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

.profile-panel {
  padding: 18px;
}

.profile-step-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 145px;
}

.profile-step .game-logo {
  padding-bottom: 24px;
}

.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 15px;
}

.step-progress span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(118, 214, 244, 0.3);
  border-radius: 50%;
  background: rgba(6, 20, 34, 0.76);
  color: #7e9baa;
  font-size: 10px;
  font-weight: 900;
}

.step-progress span.is-current {
  border-color: var(--yellow);
  background: var(--yellow);
  color: #241900;
  box-shadow: 0 0 18px rgba(255, 216, 75, 0.3);
}

.step-progress i {
  width: 38px;
  height: 2px;
  border-radius: 999px;
  background: rgba(111, 203, 232, 0.2);
}

.step-progress i.is-complete {
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
}

.panel-title-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h1,
.section-heading h2,
.result-heading h2,
.modal-card h2 {
  margin: 0;
}

.panel-title-row h1 {
  font-size: 16px;
}

.profile-panel .panel-title-row h1 {
  margin-top: 3px;
  font-size: 24px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(105, 215, 255, 0.22);
  border-radius: 12px;
  background: rgba(6, 17, 31, 0.72);
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 12px;
}

.form-grid label {
  min-width: 0;
}

.form-grid label span {
  display: block;
  margin: 0 0 6px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.form-wide {
  grid-column: 1 / -1;
}

input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid rgba(101, 211, 247, 0.21);
  border-radius: 12px;
  outline: none;
  background: rgba(2, 10, 19, 0.72);
  color: var(--text);
  caret-color: var(--cyan);
}

input::placeholder {
  color: #718494;
}

input:focus {
  border-color: rgba(82, 221, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(54, 204, 250, 0.12);
}

.nickname-field {
  display: block;
  margin-top: 20px;
}

.nickname-field > span {
  display: block;
  margin: 0 0 7px 3px;
  color: #c4d9e5;
  font-size: 12px;
  font-weight: 850;
}

.nickname-field input {
  height: 58px;
  padding: 0 16px;
  border-color: rgba(96, 220, 255, 0.38);
  border-radius: 16px;
  background: rgba(1, 9, 17, 0.82);
  font-size: 19px;
  font-weight: 850;
}

.profile-note {
  margin: 11px 2px 0;
  color: #88a1b1;
  font-size: 10px;
  line-height: 1.5;
}

.player-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 2px;
  padding: 7px 12px;
  border: 1px solid rgba(91, 218, 255, 0.25);
  border-radius: 999px;
  background: rgba(5, 20, 34, 0.78);
  color: #91adbc;
  font-size: 10px;
  font-weight: 750;
}

.player-chip strong {
  color: var(--yellow);
  font-size: 12px;
}

.player-chip span {
  color: #c8e7f2;
}

.character-section {
  margin-top: 20px;
}

.character-step .menu-content {
  padding-top: max(15px, env(safe-area-inset-top));
}

.character-step .character-section {
  margin-top: 12px;
}

.eyebrow {
  display: block;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-heading h2 {
  margin-top: 3px;
  font-size: 20px;
}

.selection-hint {
  color: var(--muted);
  font-size: 11px;
}

.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 13px;
}

.player-character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 13px;
}

.player-character-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(102, 210, 246, 0.28);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(11, 30, 50, 0.98), rgba(5, 16, 29, 0.98));
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.player-character-card:active {
  transform: scale(0.975);
}

.player-character-card.is-selected {
  border-color: var(--player-accent, var(--yellow));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--player-accent, var(--yellow)) 24%, transparent), 0 14px 34px rgba(0, 0, 0, 0.36);
}

.player-character-card.is-selected::after {
  content: "✓ PASSIVE";
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--player-accent, var(--yellow));
  color: #07111e;
  font-size: 8px;
  font-weight: 950;
}

.player-sprite,
.hud-player-avatar,
.summary-player-avatar {
  background-image: url("assets/player-characters-v1.png");
  background-repeat: no-repeat;
  background-size: 200% 200%;
  background-position: var(--sprite-x, 0%) var(--sprite-y, 0%);
}

.player-sprite {
  aspect-ratio: 1.35 / 1;
  background-color: #081b2b;
  background-size: 200% auto;
}

.player-character-copy {
  min-height: 102px;
  padding: 10px 11px 12px;
}

.player-character-name {
  display: block;
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.15;
}

.player-character-tagline {
  display: block;
  margin-top: 2px;
  color: #92dff5;
  font-size: 9px;
  font-weight: 800;
}

.player-passive {
  display: block;
  margin-top: 7px;
  color: #d7e8ef;
  font-size: 10px;
  line-height: 1.35;
}

.player-passive strong {
  color: var(--player-accent, var(--yellow));
}

.selected-player-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin: 0 auto 4px;
  padding: 7px 10px;
  border: 1px solid rgba(91, 218, 255, 0.25);
  border-radius: 15px;
  background: rgba(5, 20, 34, 0.84);
}

.summary-player-avatar {
  width: 46px;
  height: 46px;
  border: 2px solid var(--player-accent, var(--cyan));
  border-radius: 13px;
}

.selected-player-summary strong,
.selected-player-summary span,
.selected-player-summary small {
  display: block;
}

.selected-player-summary strong {
  font-size: 12px;
}

.selected-player-summary span {
  color: var(--player-accent, var(--yellow));
  font-size: 9px;
  font-weight: 900;
}

.selected-player-summary small {
  margin-top: 2px;
  overflow: hidden;
  color: #9bb6c3;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(102, 210, 246, 0.25);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(11, 30, 50, 0.98), rgba(5, 16, 29, 0.98));
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.character-card:active {
  transform: scale(0.975);
}

.character-card.is-selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 216, 75, 0.16), 0 14px 34px rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 187, 51, 0.16);
}

.character-card.is-hard-mode {
  border-color: rgba(255, 139, 71, 0.72);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 127, 49, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(23, 30, 52, 0.99), rgba(10, 16, 31, 0.99));
  box-shadow: 0 0 0 2px rgba(255, 124, 49, 0.08), 0 14px 34px rgba(0, 0, 0, 0.36), 0 0 26px rgba(255, 110, 38, 0.14);
}

.character-card.is-hard-mode.is-selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 216, 75, 0.22), 0 14px 34px rgba(0, 0, 0, 0.38), 0 0 34px rgba(255, 146, 43, 0.24);
}

.hard-mode-badge {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 210, 108, 0.7);
  border-radius: 999px;
  background: linear-gradient(90deg, #b53a24, #d5791e);
  color: #fff6c5;
  font-size: 8px;
  font-weight: 950;
  box-shadow: 0 5px 16px rgba(61, 8, 0, 0.34);
}

.character-card.is-selected::after {
  content: "✓ เลือกแล้ว";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--yellow);
  color: #1a1400;
  font-size: 9px;
  font-weight: 900;
}

.character-image-wrap {
  position: relative;
  aspect-ratio: 1.38 / 1;
  overflow: hidden;
  background: #0a1f32;
}

.character-image-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 52%;
  background: linear-gradient(transparent, rgba(3, 13, 24, 0.94));
}

.character-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.character-copy {
  position: relative;
  z-index: 1;
  min-height: 98px;
  margin-top: -30px;
  padding: 0 11px 12px;
}

.character-name {
  display: block;
  font-size: 17px;
  font-weight: 900;
}

.character-subject {
  display: block;
  margin-top: 1px;
  color: #8bdff8;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
}

.character-skill {
  display: block;
  margin-top: 7px;
  color: #d4e3ec;
  font-size: 10px;
  line-height: 1.35;
}

.character-skill strong {
  color: var(--yellow);
}

.character-hard-note {
  display: block;
  margin-top: 6px;
  color: #ffbd76;
  font-size: 8px;
  font-weight: 900;
  line-height: 1.35;
}

.fanart-note,
.privacy-note {
  margin: 14px 6px 0;
  color: #8196a6;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.menu-footer {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 10px 18px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 17, 30, 0), rgba(7, 17, 30, 0.92) 28%, #07111e 72%);
}

.menu-error {
  min-height: 18px;
  margin-bottom: 3px;
  color: #ff98a4;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.footer-actions {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
}

.back-button {
  min-height: 62px;
  border: 1px solid rgba(105, 215, 255, 0.26);
  border-radius: 18px;
  background: rgba(7, 25, 42, 0.94);
  color: #b7eafb;
  font-size: 25px;
  font-weight: 900;
  cursor: pointer;
}

.back-button:active {
  transform: scale(0.96);
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  min-height: 62px;
  padding: 10px 18px;
  border: 1px solid rgba(141, 235, 255, 0.72);
  border-radius: 18px;
  background: linear-gradient(180deg, #15bff3, #0877cc);
  color: white;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 10px 28px rgba(0, 138, 218, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.primary-button small {
  margin-top: 1px;
  color: #d8f8ff;
  font-size: 10px;
  font-weight: 700;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.992);
}

.primary-button.compact {
  min-height: 52px;
  font-size: 16px;
}

.secondary-button {
  width: 100%;
  min-height: 49px;
  padding: 11px 15px;
  border: 1px solid rgba(104, 211, 246, 0.28);
  border-radius: 15px;
  background: rgba(10, 30, 49, 0.92);
  color: #eafaff;
  font-size: 14px;
  font-weight: 850;
}

.text-button {
  padding: 12px;
  background: transparent;
  color: #8ecfe3;
  font-size: 13px;
  font-weight: 800;
}

.game-screen {
  background: #050b13;
  touch-action: none;
}

.game-screen,
.game-screen * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  left: 0;
  padding-right: 10px;
  padding-left: 10px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 8, 15, 0.94), rgba(2, 8, 15, 0.58) 76%, transparent);
}

.hud-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 0.62fr 0.78fr 36px;
  align-items: center;
  gap: 7px;
}

.hud-professor {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-player-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 2px solid var(--player-accent, var(--cyan));
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(80, 216, 255, 0.25);
}

.hud-professor div {
  min-width: 0;
}

.hud-professor span,
.hud-professor small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-professor span {
  font-size: 12px;
  font-weight: 900;
}

.hud-professor small {
  color: #8fd8ed;
  font-size: 8px;
  font-weight: 700;
}

.hud-stat-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hud-stat-block span {
  color: #95aab9;
  font-size: 8px;
  font-weight: 800;
}

.hud-stat-block strong {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  line-height: 1.05;
}

.score-block strong {
  color: var(--yellow);
}

.hud-pause {
  width: 34px;
  height: 34px;
  pointer-events: auto;
  font-weight: 950;
}

.stability-wrap {
  margin-top: 7px;
}

.stability-labels {
  display: flex;
  justify-content: space-between;
  margin: 0 2px 4px;
  color: #d9eef6;
  font-size: 9px;
  font-weight: 850;
}

.stability-track {
  height: 10px;
  padding: 2px;
  overflow: hidden;
  border: 1px solid rgba(124, 215, 244, 0.23);
  border-radius: 999px;
  background: rgba(3, 10, 18, 0.82);
}

.stability-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #42e89b, #b9ef5c);
  box-shadow: 0 0 12px rgba(83, 245, 165, 0.35);
  transform-origin: left center;
  transition: background 180ms ease;
}

.hud-bottom-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.combo-pill,
.ability-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 8px;
  border: 1px solid rgba(92, 211, 247, 0.2);
  border-radius: 999px;
  background: rgba(4, 15, 27, 0.68);
  color: #dff8ff;
  font-size: 9px;
  font-weight: 900;
}

.combo-pill.is-hot {
  border-color: rgba(255, 214, 70, 0.52);
  color: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 196, 40, 0.15);
}

.combo-pill.is-overdrive {
  border-color: rgba(255, 226, 85, 0.9);
  background: linear-gradient(90deg, rgba(104, 48, 8, 0.9), rgba(122, 84, 4, 0.86));
  color: #fff5a6;
  box-shadow: 0 0 18px rgba(255, 196, 40, 0.34);
  animation: overdrivePulse 520ms ease-in-out infinite alternate;
}

@keyframes overdrivePulse {
  to { transform: scale(1.035); filter: brightness(1.18); }
}

.ability-pill {
  color: #9eebff;
}

.inventory-pill {
  width: max-content;
  max-width: 100%;
  min-height: 22px;
  margin: 5px auto 0;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid rgba(108, 245, 177, 0.2);
  border-radius: 999px;
  background: rgba(3, 18, 27, 0.76);
  color: #b9f5d7;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-hint {
  position: absolute;
  z-index: 6;
  top: 145px;
  left: 50%;
  width: max-content;
  max-width: 84%;
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(116, 216, 247, 0.18);
  border-radius: 999px;
  background: rgba(3, 12, 22, 0.78);
  color: #def8ff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  transition: opacity 400ms ease, transform 400ms ease;
}

.game-hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, -8px);
}

.event-banner {
  position: absolute;
  z-index: 7;
  top: 178px;
  left: 50%;
  width: max-content;
  max-width: 88%;
  padding: 9px 15px;
  transform: translate(-50%, -10px) scale(0.96);
  border: 1px solid rgba(255, 223, 81, 0.55);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(88, 37, 4, 0.93), rgba(92, 68, 5, 0.93));
  color: #fff4a0;
  font-size: 11px;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.36), 0 0 22px rgba(255, 189, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms ease;
}

.event-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.event-banner.is-wave {
  border-color: rgba(255, 103, 96, 0.7);
  background: linear-gradient(90deg, rgba(93, 13, 25, 0.95), rgba(116, 47, 8, 0.95));
  color: #ffe2d2;
}

.advisor-action {
  position: absolute;
  z-index: 11;
  top: 164px;
  right: 10px;
  left: 10px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  min-height: 88px;
  padding: 8px 14px 8px 8px;
  overflow: hidden;
  border: 2px solid var(--advisor-accent, #8be7ff);
  border-radius: 22px;
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--advisor-accent, #8be7ff) 28%, #07111e), rgba(5, 14, 28, 0.97) 52%),
    #07111e;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.52), 0 0 28px color-mix(in srgb, var(--advisor-accent, #8be7ff) 30%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateX(115%) skewX(-4deg);
}

.advisor-action.is-visible {
  animation: advisorCutIn 1.35s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.advisor-action img {
  width: 68px;
  height: 68px;
  border: 3px solid var(--advisor-accent, #8be7ff);
  border-radius: 17px;
  object-fit: cover;
  object-position: center 24%;
  transform: skewX(4deg);
}

.advisor-action div {
  min-width: 0;
  padding-left: 8px;
  transform: skewX(4deg);
}

.advisor-action span,
.advisor-action strong,
.advisor-action small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advisor-action span {
  color: var(--advisor-accent, #8be7ff);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.advisor-action strong {
  margin-top: 2px;
  color: #ffffff;
  font-size: 19px;
  font-weight: 950;
}

.advisor-action small {
  margin-top: 3px;
  color: #cce4ee;
  font-size: 9px;
  font-weight: 750;
}

@keyframes advisorCutIn {
  0% { opacity: 0; transform: translateX(115%) skewX(-4deg); }
  16%, 78% { opacity: 1; transform: translateX(0) skewX(-4deg); }
  100% { opacity: 0; transform: translateX(-18%) skewX(-4deg); }
}

.joystick {
  position: absolute;
  z-index: 8;
  left: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 132px;
  height: 132px;
  touch-action: none;
  user-select: none;
}

.joystick-ring {
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(129, 221, 249, 0.24);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 61, 90, 0.24), rgba(3, 14, 25, 0.52));
  box-shadow: inset 0 0 24px rgba(71, 205, 246, 0.08);
}

.joystick-knob {
  position: absolute;
  top: 42px;
  left: 42px;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(198, 246, 255, 0.58);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(65, 204, 242, 0.78), rgba(16, 101, 151, 0.88));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.24);
  transform: translate3d(0, 0, 0);
}

.repair-button {
  position: absolute;
  z-index: 8;
  right: 24px;
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 8px));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 108px;
  height: 108px;
  padding: 0;
  border: 3px solid rgba(174, 226, 255, 0.82);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 25%, #8be7ff, #556eea 52%, #492986 100%);
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(67, 97, 220, 0.38), inset 0 4px 0 rgba(255, 255, 255, 0.28);
  touch-action: none;
  -webkit-appearance: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  overscroll-behavior: contain;
}

.repair-button,
.repair-button * {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.advisor-button-avatar {
  width: 48px;
  height: 48px;
  margin-bottom: 2px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  object-fit: cover;
  object-position: center 24%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  -webkit-user-drag: none;
}

.repair-button.is-active {
  transform: scale(0.94);
  filter: brightness(1.16);
}

.repair-button.is-ready {
  animation: repairPulse 850ms ease-in-out infinite alternate;
}

.repair-button:disabled {
  cursor: default;
  filter: grayscale(0.35) brightness(0.68);
  opacity: 0.78;
}

.repair-icon {
  font-size: 23px;
  line-height: 1;
}

.repair-button strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.05em;
}

.repair-button small {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 900;
}

.advisor-meter-track {
  width: 64px;
  height: 5px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(3, 9, 20, 0.58);
}

.advisor-meter-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #75e9ff, #fff078);
  box-shadow: 0 0 8px rgba(117, 233, 255, 0.7);
  transition: width 160ms linear;
}

.quiz-answer:disabled {
  border-color: rgba(130, 144, 155, 0.16);
  background: rgba(50, 59, 67, 0.38);
  color: #6f7f89;
  text-decoration: line-through;
  cursor: default;
  filter: grayscale(1);
}

@keyframes repairPulse {
  to { box-shadow: 0 10px 32px rgba(95, 126, 255, 0.55), 0 0 0 8px rgba(116, 220, 255, 0.1), inset 0 4px 0 rgba(255, 255, 255, 0.3); }
}

.sound-game {
  position: absolute;
  z-index: 8;
  right: 12px;
  bottom: 156px;
  width: 34px;
  height: 34px;
  opacity: 0.8;
}

.modal-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(1, 6, 11, 0.82);
  backdrop-filter: blur(10px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 340px);
  padding: 25px 20px 20px;
  border: 1px solid rgba(96, 214, 250, 0.3);
  border-radius: 25px;
  background: linear-gradient(180deg, #102b46, #071523);
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-top: 5px;
  font-size: 24px;
}

.modal-card p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.modal-card .secondary-button {
  margin-top: 9px;
}

.quiz-overlay {
  z-index: 24;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.quiz-card {
  width: min(100%, 365px);
  padding: 22px 18px 18px;
  border-color: rgba(255, 161, 60, 0.58);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 115, 34, 0.22), transparent 38%),
    linear-gradient(180deg, #142b42, #07121f);
}

.quiz-bomb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 9px;
  border: 1px solid rgba(255, 188, 78, 0.45);
  border-radius: 20px;
  background: rgba(20, 8, 5, 0.55);
  font-size: 34px;
  box-shadow: 0 0 24px rgba(255, 93, 42, 0.18);
  animation: bombTick 700ms ease-in-out infinite alternate;
}

@keyframes bombTick {
  to { transform: scale(1.06) rotate(2deg); filter: brightness(1.22); }
}

.quiz-card h2 {
  margin-top: 4px;
  font-size: 23px;
}

.quiz-card .quiz-question {
  margin: 10px 0 14px;
  color: #eefaff;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.45;
}

.quiz-answers {
  display: grid;
  gap: 9px;
}

.quiz-answer {
  width: 100%;
  min-height: 50px;
  padding: 10px 13px;
  border: 1px solid rgba(102, 216, 248, 0.3);
  border-radius: 14px;
  background: rgba(8, 30, 48, 0.94);
  color: #eafaff;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.quiz-answer::first-letter {
  color: var(--yellow);
}

.quiz-answer:active {
  transform: scale(0.985);
  border-color: var(--yellow);
}

.quiz-answer:focus-visible {
  outline: 3px solid rgba(85, 221, 255, 0.35);
  outline-offset: 2px;
}

.quiz-risk {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 132, 48, 0.1);
  color: #ffc899;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.45;
}

.quiz-overlay.is-university .quiz-card {
  border-color: rgba(180, 139, 255, 0.66);
  background:
    radial-gradient(circle at 50% 0, rgba(165, 111, 255, 0.24), transparent 40%),
    linear-gradient(180deg, #20254d, #0b1024);
}

.quiz-overlay.is-university .quiz-bomb {
  border-color: rgba(189, 155, 255, 0.56);
  box-shadow: 0 0 28px rgba(152, 105, 255, 0.25);
}

.quiz-overlay.is-university .quiz-risk {
  background: rgba(169, 119, 255, 0.12);
  color: #d9c2ff;
}

.result-screen {
  background:
    linear-gradient(rgba(30, 70, 76, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 70, 76, 0.045) 1px, transparent 1px),
    #e8efed;
  background-size: 22px 22px;
  color: #173f49;
}

.result-scroll {
  height: 100%;
  overflow-y: auto;
  padding-right: 16px;
  padding-left: 16px;
}

.result-heading {
  padding: 16px 4px 13px;
  text-align: center;
}

.result-heading .eyebrow {
  color: #257b6d;
}

.result-heading h2 {
  margin-top: 2px;
  font-size: 25px;
}

.result-heading p {
  margin: 5px 0 0;
  color: #61797d;
  font-size: 11px;
}

.share-card-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(23, 63, 73, 0.3);
  border-radius: 24px;
  background: #fffdf8;
  box-shadow: 0 18px 38px rgba(25, 58, 64, 0.18);
  cursor: pointer;
  margin-top: 16px;
}

#shareCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 14px 0 2px;
}

.result-actions .primary-button {
  grid-column: 1 / -1;
}

.result-screen .secondary-button {
  border-color: rgba(23, 63, 73, 0.22);
  background: rgba(255, 253, 248, 0.92);
  color: #173f49;
  box-shadow: 0 6px 16px rgba(25, 58, 64, 0.07);
}

.result-screen .privacy-note {
  color: #6d8183;
}

.capture-overlay {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  cursor: pointer;
}

.capture-overlay[hidden] {
  display: none;
}

.capture-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.capture-instruction {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.84));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  transition: opacity 220ms ease;
}

.capture-overlay.is-clean .capture-instruction {
  opacity: 0;
}

.orientation-overlay {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: none;
  place-items: center;
  padding: 28px;
  background: #030810;
}

.orientation-card {
  text-align: center;
}

.orientation-card h2 {
  margin: 8px 0 4px;
}

.orientation-card p {
  margin: 0;
  color: var(--muted);
}

.phone-rotate {
  font-size: 54px;
  animation: rotatePhone 1.8s ease-in-out infinite;
}

@keyframes rotatePhone {
  50% { transform: rotate(-90deg); }
}

.toast {
  position: absolute;
  z-index: 80;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 18px;
  padding: 11px 14px;
  border: 1px solid rgba(97, 222, 255, 0.25);
  border-radius: 14px;
  background: rgba(4, 18, 31, 0.94);
  color: #eafaff;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (orientation: landscape) {
  .orientation-overlay {
    display: grid;
  }
}

@media (min-width: 700px) {
  .app-shell {
    height: min(94vh, 900px);
    border: 1px solid rgba(90, 215, 255, 0.16);
    border-radius: 34px;
  }
}

@media (max-height: 700px) and (orientation: portrait) {
  .menu-content {
    padding-top: 12px;
  }
  .game-logo {
    padding-top: 4px;
    padding-bottom: 12px;
  }
  .logo-csku {
    font-size: 44px;
  }
  .logo-sub {
    margin-top: 8px;
  }
  .profile-panel {
    padding: 12px;
  }
  .profile-step-content {
    padding-bottom: 126px;
  }
  .profile-step .game-logo {
    padding-bottom: 14px;
  }
  .nickname-field {
    margin-top: 13px;
  }
  .nickname-field input {
    height: 50px;
  }
  .character-section {
    margin-top: 14px;
  }
  .character-step .compact-logo {
    padding-bottom: 5px;
  }
  .character-step .step-progress {
    margin-bottom: 7px;
  }
}
