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

:root {
  --bg: #010906;
  --panel: rgba(3, 22, 15, .82);
  --panel-strong: rgba(2, 13, 10, .94);
  --green: #69ff3a;
  --green-2: #18d96f;
  --cyan: #24e8ff;
  --red: #ff3151;
  --gold: #ffd561;
  --text: #ecfff3;
  --muted: #9fc3b0;
  --line: rgba(95, 255, 158, .28);
  --safe-top: max(10px, env(safe-area-inset-top));
  --safe-bottom: max(8px, env(safe-area-inset-bottom));
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: "Chakra Petch", system-ui, sans-serif;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 12, 7, .2), rgba(0, 8, 5, .82)),
    url("assets/img/trivihacker_background.jpg") center / cover no-repeat;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 50% 42%, rgba(28, 255, 116, .08), transparent 32%),
    linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .52));
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .18;
  background: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 3px,
    rgba(72, 255, 139, .08) 4px
  );
  mix-blend-mode: screen;
}

.ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ambient-grid {
  opacity: .26;
  background-image:
    linear-gradient(rgba(30, 255, 125, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 255, 125, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 80%, transparent 100%);
  animation: gridDrift 18s linear infinite;
}

.ambient-particles {
  position: absolute;
  z-index: -1;
  width: min(74vw, 760px);
  opacity: .1;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(55, 255, 120, .35));
}

.ambient-particles-a {
  top: -15%;
  left: -13%;
  animation: particlesFloatA 24s ease-in-out infinite;
}

.ambient-particles-b {
  right: -14%;
  bottom: -18%;
  transform: rotate(180deg);
  animation: particlesFloatB 28s ease-in-out infinite;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  visibility: hidden;
  opacity: 0;
  transform: scale(1.015);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
}

.screen.active {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.icon-button {
  border: 1px solid rgba(75, 255, 137, .38);
  background: rgba(1, 17, 10, .8);
  box-shadow:
    inset 0 0 18px rgba(44, 255, 120, .08),
    0 0 16px rgba(36, 255, 125, .08);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.sound-toggle {
  position: absolute;
  top: var(--safe-top);
  right: max(12px, env(safe-area-inset-right));
  z-index: 50;
  display: grid;
  place-items: center;
  width: clamp(38px, 9vw, 48px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(16px, 4vw, 21px);
}

.start-screen {
  grid-template-rows: 1fr auto;
  padding:
    calc(var(--safe-top) + 36px)
    max(16px, env(safe-area-inset-right))
    var(--safe-bottom)
    max(16px, env(safe-area-inset-left));
}

.start-layout {
  width: min(1160px, 100%);
  height: 100%;
  min-height: 0;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(280px, .72fr);
  align-items: center;
  gap: clamp(18px, 5vw, 70px);
}

.start-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.6vh, 16px);
  text-align: center;
}

.game-logo {
  width: min(620px, 94%);
  max-height: 36vh;
  object-fit: contain;
  filter:
    drop-shadow(0 0 16px rgba(106, 255, 57, .24))
    drop-shadow(0 12px 30px rgba(0, 0, 0, .65));
}

.intro-line {
  width: min(620px, 100%);
  margin: 0;
  color: #d9f8e6;
  font-size: clamp(.92rem, 2.1vw, 1.2rem);
  line-height: 1.28;
  text-shadow: 0 2px 12px #000;
}

.menu-panel {
  width: min(580px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(73, 255, 139, .28);
  background: linear-gradient(180deg, rgba(2, 30, 18, .84), rgba(1, 14, 9, .92));
  box-shadow:
    inset 0 0 30px rgba(38, 255, 119, .05),
    0 16px 40px rgba(0, 0, 0, .32);
  backdrop-filter: blur(13px);
  clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 15px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0 calc(100% - 15px), 0 15px);
}

.menu-stat {
  min-width: 0;
  padding: clamp(8px, 1.4vh, 14px) 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-stat + .menu-stat {
  border-left: 1px solid var(--line);
}

.menu-stat strong {
  color: var(--green);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.05rem, 3vw, 1.55rem);
  text-shadow: 0 0 12px rgba(105, 255, 58, .45);
}

.menu-stat span {
  color: var(--muted);
  font-size: clamp(.66rem, 1.65vw, .82rem);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.menu-actions {
  width: min(500px, 100%);
  display: grid;
  grid-template-columns: 1.22fr .78fr;
  gap: 10px;
}

.cyber-button {
  min-height: clamp(46px, 7vh, 58px);
  padding: 10px 18px;
  border: 1px solid rgba(85, 255, 147, .45);
  background: rgba(3, 28, 17, .9);
  color: var(--text);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.74rem, 2vw, .94rem);
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.cyber-button:hover,
.cyber-button:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.cyber-button:active {
  transform: translateY(1px) scale(.99);
}

.cyber-button.primary {
  color: #021007;
  border-color: rgba(114, 255, 72, .9);
  background:
    linear-gradient(135deg, #b4ff55, #39ee62 58%, #10b85e);
  box-shadow:
    0 0 24px rgba(76, 255, 107, .23),
    inset 0 1px 0 rgba(255, 255, 255, .55);
}

.cyber-button.secondary {
  background:
    linear-gradient(180deg, rgba(8, 42, 29, .88), rgba(2, 19, 12, .94));
  box-shadow: inset 0 0 22px rgba(36, 255, 125, .06);
}

.best-line {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}

.best-line strong {
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
}

.character-stage {
  position: relative;
  align-self: stretch;
  min-height: 0;
  display: grid;
  place-items: end center;
}

.character-stage::before {
  content: "";
  position: absolute;
  inset: 9% 4% 7%;
  border: 1px solid rgba(76, 255, 141, .16);
  background:
    linear-gradient(135deg, rgba(28, 255, 123, .06), transparent 35%),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(69, 255, 136, .035) 32px);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%, 0 22px);
  backdrop-filter: blur(3px);
}

.character-glow {
  position: absolute;
  left: 50%;
  bottom: 5%;
  width: 80%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32, 255, 133, .2), rgba(28, 242, 255, .07) 38%, transparent 68%);
  filter: blur(5px);
}

.hacker-character {
  position: relative;
  z-index: 2;
  width: min(100%, 510px);
  max-height: 79vh;
  object-fit: contain;
  object-position: bottom;
  filter:
    drop-shadow(0 0 18px rgba(20, 255, 137, .18))
    drop-shadow(0 24px 24px rgba(0, 0, 0, .62));
  animation: characterBreath 5s ease-in-out infinite;
}

.terminal-caption {
  position: absolute;
  z-index: 3;
  bottom: 3%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(75, 255, 132, .38);
  background: rgba(0, 13, 8, .84);
  color: #baffce;
  font-family: "Orbitron", sans-serif;
  font-size: .67rem;
  letter-spacing: .12em;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.game-credit,
.mini-credit {
  position: relative;
  z-index: 4;
  text-align: center;
}

.game-credit {
  padding-top: 6px;
}

.game-credit a,
.mini-credit a {
  color: #a6cbb7;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.58rem, 1.6vw, .72rem);
}

.game-credit a:hover,
.mini-credit a:hover {
  color: var(--green);
}

/* GAME */
.game-screen {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: clamp(5px, 1vh, 10px);
  padding:
    calc(var(--safe-top) + 4px)
    max(10px, env(safe-area-inset-right))
    var(--safe-bottom)
    max(10px, env(safe-area-inset-left));
}

.game-hud {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.12fr 1fr .9fr auto;
  gap: clamp(5px, 1.2vw, 10px);
  align-items: stretch;
  padding-right: clamp(42px, 10vw, 54px);
}

.hud-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(5px, 1.1vh, 9px) clamp(7px, 1.5vw, 13px);
  border: 1px solid rgba(68, 255, 135, .24);
  background: rgba(1, 18, 11, .78);
  box-shadow: inset 0 0 22px rgba(42, 255, 123, .045);
  backdrop-filter: blur(10px);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.hud-label {
  color: #8cbfa3;
  font-size: clamp(.52rem, 1.7vw, .68rem);
  line-height: 1;
  letter-spacing: .1em;
}

.hud-block strong {
  margin-top: 2px;
  color: #f0fff5;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.88rem, 3vw, 1.22rem);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.question-counter strong {
  color: var(--cyan);
}

.question-counter small {
  margin-left: 2px;
  color: #88a99a;
  font-size: .56em;
}

.streak-block strong {
  color: var(--gold);
}

.timer-block {
  display: grid;
  place-items: center;
}

.timer-ring {
  --timer-progress: 360deg;
  width: clamp(42px, 11vw, 54px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #03160d 54%, transparent 56%),
    conic-gradient(var(--green) var(--timer-progress), rgba(100, 255, 150, .13) 0);
  border: 1px solid rgba(111, 255, 160, .4);
  box-shadow:
    0 0 18px rgba(44, 255, 117, .12),
    inset 0 0 12px rgba(32, 255, 120, .09);
  transition: background .2s linear, box-shadow .2s ease;
}

.timer-ring span {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.72rem, 2.5vw, .95rem);
  font-weight: 700;
}

.timer-block.warning .timer-ring {
  background:
    radial-gradient(circle, #22050a 54%, transparent 56%),
    conic-gradient(var(--red) var(--timer-progress), rgba(255, 49, 81, .13) 0);
  border-color: rgba(255, 49, 81, .65);
  box-shadow: 0 0 22px rgba(255, 49, 81, .28);
  animation: timerPulse .85s ease-in-out infinite;
}

.progress-track {
  width: min(1120px, 100%);
  height: 5px;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(115, 255, 158, .1);
  border: 1px solid rgba(105, 255, 148, .12);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green-2), var(--green), var(--cyan));
  box-shadow: 0 0 14px rgba(64, 255, 128, .48);
  transition: width .35s ease;
}

.status-row {
  width: min(1120px, 100%);
  min-height: clamp(28px, 4.4vh, 38px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.lives {
  display: flex;
  align-items: center;
  gap: clamp(3px, .8vw, 6px);
  min-width: min-content;
}

.life-icon {
  width: clamp(23px, 6.8vw, 34px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(43, 255, 126, .24));
  animation: shieldIn .25s ease both;
}

.life-icon.broken {
  opacity: .45;
  filter: grayscale(.25) drop-shadow(0 0 6px rgba(255, 48, 76, .15));
}

.special-badge {
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid rgba(255, 213, 97, .52);
  background: rgba(49, 35, 4, .78);
  color: var(--gold);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.5rem, 1.7vw, .68rem);
  letter-spacing: .05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: specialGlow 1.4s ease-in-out infinite;
}

.streak-notice {
  margin-left: auto;
  color: var(--red);
  font-size: clamp(.54rem, 1.6vw, .7rem);
  line-height: 1;
  text-align: right;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
}

.streak-notice.show {
  opacity: 1;
  transform: none;
}

.question-area {
  width: min(1120px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(8px, 1.5vh, 14px);
}

.question-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(17px, 4vw, 42px);
  border: 1px solid rgba(75, 255, 141, .38);
  background:
    linear-gradient(145deg, rgba(4, 35, 21, .86), rgba(1, 13, 9, .94)),
    radial-gradient(circle at center, rgba(36, 255, 124, .08), transparent 50%);
  box-shadow:
    inset 0 0 55px rgba(40, 255, 121, .045),
    0 18px 40px rgba(0, 0, 0, .3);
  backdrop-filter: blur(14px);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.question-card::before,
.question-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.question-card::before {
  inset: 7px;
  border: 1px solid rgba(66, 255, 134, .09);
  clip-path: inherit;
}

.question-card::after {
  left: 8%;
  right: 8%;
  bottom: 11px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: .52;
}

.security-core {
  position: absolute;
  width: min(58vh, 72vw, 540px);
  max-height: 92%;
  object-fit: contain;
  opacity: .11;
  filter: saturate(1.15) drop-shadow(0 0 24px rgba(40, 255, 124, .15));
  animation: rotateCore 32s linear infinite;
}

.question-content {
  position: relative;
  z-index: 2;
  width: min(870px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(9px, 2vh, 20px);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}

.category-chip,
.difficulty-chip {
  padding: 5px 9px;
  font-size: clamp(.52rem, 1.65vw, .7rem);
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid rgba(74, 255, 139, .35);
  background: rgba(0, 15, 9, .74);
}

.category-chip {
  color: var(--green);
}

.difficulty-chip {
  color: var(--cyan);
  border-color: rgba(36, 232, 255, .32);
}

.question-text {
  margin: 0;
  color: #f4fff7;
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(1.08rem, 4.1vw, 2.15rem);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  text-shadow:
    0 2px 12px #000,
    0 0 20px rgba(43, 255, 122, .05);
}

.question-card.length-long .question-text {
  font-size: clamp(.98rem, 3.5vw, 1.8rem);
}

.question-card.length-very-long .question-text {
  font-size: clamp(.88rem, 3vw, 1.55rem);
  line-height: 1.18;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2vw, 14px);
}

.answer-button {
  min-height: clamp(57px, 9.5vh, 78px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px clamp(12px, 2vw, 20px);
  border: 1px solid;
  background: rgba(1, 17, 10, .92);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.78rem, 2.6vw, 1.12rem);
  font-weight: 700;
  letter-spacing: .055em;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
  clip-path: polygon(13px 0, 100% 0, 100% calc(100% - 13px), calc(100% - 13px) 100%, 0 100%, 0 13px);
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.14);
}

.answer-button:active {
  transform: scale(.985);
}

.answer-button:disabled {
  cursor: default;
  opacity: .6;
}

.answer-true {
  color: #bdffcc;
  border-color: rgba(62, 255, 119, .58);
  background:
    linear-gradient(135deg, rgba(7, 65, 31, .94), rgba(2, 24, 15, .95));
  box-shadow: inset 0 0 28px rgba(47, 255, 112, .06);
}

.answer-false {
  color: #ffd4da;
  border-color: rgba(255, 65, 94, .58);
  background:
    linear-gradient(135deg, rgba(75, 11, 24, .94), rgba(24, 3, 10, .95));
  box-shadow: inset 0 0 28px rgba(255, 48, 79, .06);
}

.answer-symbol {
  display: grid;
  place-items: center;
  width: clamp(31px, 7vw, 42px);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1.2em;
}

.answer-button kbd {
  opacity: .55;
  min-width: 22px;
  padding: 3px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: inherit;
  font-size: .65em;
}

.mini-credit {
  line-height: 1;
}

/* RESULT */
.result-screen {
  grid-template-rows: 1fr auto;
  padding:
    calc(var(--safe-top) + 42px)
    max(14px, env(safe-area-inset-right))
    var(--safe-bottom)
    max(14px, env(safe-area-inset-left));
}

.result-panel {
  width: min(760px, 100%);
  height: 100%;
  min-height: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vh, 13px);
  padding: clamp(13px, 3vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(77, 255, 142, .3);
  background: rgba(1, 15, 9, .9);
  box-shadow:
    inset 0 0 50px rgba(42, 255, 122, .045),
    0 22px 55px rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.result-image {
  width: min(420px, 72vw);
  max-height: 31vh;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(255, 42, 80, .16));
}

.result-panel.victory .result-image {
  filter: drop-shadow(0 0 24px rgba(255, 213, 97, .22));
}

.result-panel h2 {
  margin: 0;
  color: var(--red);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.12rem, 4.8vw, 2rem);
  line-height: 1;
  text-align: center;
}

.result-panel.victory h2 {
  color: var(--gold);
}

.result-panel > p {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: clamp(.75rem, 2.4vw, .95rem);
}

.result-stats {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.result-stats > div {
  min-width: 0;
  padding: clamp(6px, 1.1vh, 10px) 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(85, 255, 146, .18);
  background: rgba(6, 36, 22, .52);
}

.result-stats span {
  color: #8eb8a1;
  font-size: clamp(.52rem, 1.8vw, .66rem);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.result-stats strong {
  margin-top: 2px;
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.85rem, 3vw, 1.16rem);
}

.result-stats .result-score {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
}

.result-stats .result-score strong {
  color: var(--green);
}

.record-message {
  min-height: 1.2em;
  color: var(--gold) !important;
  font-family: "Orbitron", sans-serif;
  letter-spacing: .05em;
}

.result-actions {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

/* MODALS */
.modal-backdrop,
.feedback-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding:
    calc(var(--safe-top) + 12px)
    max(12px, env(safe-area-inset-right))
    calc(var(--safe-bottom) + 12px)
    max(12px, env(safe-area-inset-left));
  background: rgba(0, 7, 4, .78);
  backdrop-filter: blur(11px);
}

.modal-panel,
.feedback-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(81, 255, 145, .4);
  background:
    linear-gradient(145deg, rgba(4, 34, 21, .98), rgba(1, 13, 9, .99));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, .58),
    inset 0 0 44px rgba(50, 255, 127, .04);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
  animation: panelEnter .26s ease both;
}

.modal-panel {
  padding: clamp(18px, 4vw, 34px);
}

.modal-panel h2 {
  margin: 0 36px clamp(12px, 2vh, 20px);
  color: var(--green);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1rem, 4vw, 1.55rem);
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 9px;
  right: 11px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 72, 98, .5);
  border-radius: 50%;
  background: rgba(45, 5, 12, .8);
  color: #ffc7cf;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(7px, 1.5vw, 12px);
  margin-bottom: clamp(14px, 2vh, 22px);
}

.rules-grid > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  padding: clamp(8px, 1.5vw, 12px);
  border: 1px solid rgba(71, 255, 136, .17);
  background: rgba(3, 28, 17, .58);
}

.rules-grid strong {
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-size: .78rem;
}

.rules-grid p {
  margin: 0;
  color: #c7e8d4;
  font-size: clamp(.72rem, 2vw, .88rem);
  line-height: 1.22;
}

.modal-panel > .cyber-button {
  width: min(360px, 100%);
  margin: 0 auto;
  display: block;
}

.feedback-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(5px, 1.2vh, 11px);
  padding: clamp(13px, 3.4vw, 26px);
  text-align: center;
}

.feedback-image {
  width: min(310px, 62vw);
  max-height: 29vh;
  object-fit: contain;
}

.feedback-panel.wrong .feedback-image {
  filter: drop-shadow(0 0 22px rgba(255, 49, 81, .22));
}

.feedback-panel.correct .feedback-image {
  filter: drop-shadow(0 0 22px rgba(76, 255, 111, .18));
}

.feedback-panel h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.05rem, 4.6vw, 1.7rem);
  line-height: 1;
}

.feedback-panel.correct h2 {
  color: var(--green);
}

.feedback-panel.wrong h2 {
  color: var(--red);
}

.feedback-panel p {
  width: min(610px, 100%);
  margin: 0;
  color: #d9f0e2;
  font-size: clamp(.78rem, 2.55vw, 1rem);
  line-height: 1.28;
  text-wrap: balance;
}

.feedback-bonus {
  padding: 6px 10px;
  border: 1px solid rgba(255, 213, 97, .42);
  background: rgba(70, 48, 5, .65);
  color: var(--gold);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(.62rem, 2vw, .78rem);
}

.feedback-panel .cyber-button {
  width: min(370px, 100%);
  margin-top: 3px;
}

.toast {
  position: absolute;
  z-index: 140;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 18px);
  max-width: min(88vw, 520px);
  padding: 9px 14px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(78, 255, 140, .35);
  background: rgba(0, 16, 9, .94);
  color: #d7ffe5;
  text-align: center;
  font-size: .8rem;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ANIMATIONS */
@keyframes gridDrift {
  to { background-position: 44px 44px; }
}

@keyframes particlesFloatA {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-8deg); }
  50% { transform: translate3d(5%, 7%, 0) rotate(2deg); }
}

@keyframes particlesFloatB {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(180deg); }
  50% { transform: translate3d(-6%, -5%, 0) rotate(170deg); }
}

@keyframes characterBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.006); }
}

@keyframes pulseDot {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes rotateCore {
  to { transform: rotate(360deg); }
}

@keyframes timerPulse {
  50% { transform: scale(1.055); }
}

@keyframes shieldIn {
  from { opacity: 0; transform: scale(.55) rotate(-12deg); }
}

@keyframes specialGlow {
  50% { box-shadow: 0 0 18px rgba(255, 213, 97, .22); }
}

@keyframes panelEnter {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
}

/* MOBILE */
@media (max-width: 760px) {
  .start-screen {
    padding-top: calc(var(--safe-top) + 38px);
  }

  .start-layout {
    position: relative;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .start-copy {
    z-index: 3;
    height: 100%;
    justify-content: center;
  }

  .game-logo {
    width: min(90vw, 470px);
    max-height: 29vh;
  }

  .intro-line {
    max-width: 92%;
  }

  .character-stage {
    position: absolute;
    inset: auto -8% -1% auto;
    z-index: 1;
    width: 48%;
    height: 48%;
    opacity: .37;
    pointer-events: none;
  }

  .character-stage::before,
  .terminal-caption {
    display: none;
  }

  .hacker-character {
    max-height: 100%;
  }

  .menu-panel,
  .menu-actions,
  .best-line {
    position: relative;
    z-index: 4;
  }

  .game-hud {
    grid-template-columns: 1.1fr 1fr .82fr auto;
    padding-right: 42px;
  }

  .hud-block {
    padding-inline: 6px;
  }

  .question-area {
    gap: 8px;
  }

  .question-card {
    padding: 15px 12px;
  }

  .question-content {
    gap: 9px;
  }

  .answer-button {
    min-height: clamp(55px, 9vh, 68px);
    padding-inline: 10px;
  }

  .answer-button kbd {
    display: none;
  }

  .mini-credit a {
    font-size: .52rem;
  }

  .result-image {
    max-height: 25vh;
  }
}

@media (max-width: 430px) {
  .menu-actions {
    grid-template-columns: 1fr;
  }

  .cyber-button {
    min-height: 45px;
  }

  .menu-panel {
    width: 100%;
  }

  .status-row {
    min-height: 30px;
  }

  .special-badge {
    max-width: 61%;
  }

  .streak-notice {
    display: none;
  }

  .answer-grid {
    gap: 7px;
  }

  .answer-button {
    grid-template-columns: auto 1fr;
    gap: 7px;
    font-size: clamp(.68rem, 3.1vw, .86rem);
  }

  .answer-symbol {
    width: 29px;
  }

  .rules-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .modal-panel {
    padding: 15px;
  }

  .rules-grid > div {
    padding: 7px 8px;
  }

  .result-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-stats .result-score {
    grid-column: 1 / -1;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 700px) {
  .game-logo {
    max-height: 25vh;
  }

  .start-copy {
    gap: 6px;
  }

  .intro-line {
    font-size: .8rem;
  }

  .menu-stat {
    padding-block: 6px;
  }

  .question-text {
    font-size: clamp(.92rem, 3.5vw, 1.55rem);
  }

  .question-card.length-long .question-text,
  .question-card.length-very-long .question-text {
    font-size: clamp(.8rem, 3vw, 1.25rem);
  }

  .answer-button {
    min-height: 49px;
  }

  .feedback-image {
    max-height: 22vh;
  }

  .result-image {
    max-height: 20vh;
  }

  .result-panel {
    gap: 5px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .start-layout {
    grid-template-columns: 1fr .55fr;
  }

  .character-stage {
    position: relative;
    inset: auto;
    width: auto;
    height: 100%;
    opacity: .7;
  }

  .game-logo {
    max-height: 31vh;
  }

  .game-screen {
    gap: 4px;
  }

  .question-area {
    grid-template-columns: minmax(0, 1fr) minmax(220px, .48fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-button {
    min-height: auto;
  }

  .mini-credit {
    display: none;
  }

  .feedback-panel {
    width: min(850px, 100%);
    display: grid;
    grid-template-columns: minmax(170px, .55fr) 1fr;
    grid-template-areas:
      "img title"
      "img text"
      "img bonus"
      "img button";
    text-align: left;
  }

  .feedback-image { grid-area: img; width: 100%; max-height: 68vh; }
  .feedback-panel h2 { grid-area: title; }
  .feedback-panel p { grid-area: text; }
  .feedback-bonus { grid-area: bonus; width: fit-content; }
  .feedback-panel .cyber-button { grid-area: button; margin: 0; }
}

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