:root {
  --ink-0: #030304;
  --ink-1: #09090c;
  --ink-2: #13151a;
  --smoke-0: #eee6dc;
  --smoke-1: #9ea5ae;
  --smoke-2: #5a616a;
  --wine-0: #17070b;
  --wine-1: #2b0a12;
  --wine-2: #51111f;
  --ember-0: #7f2837;
  --ember-1: #5a1523;
  --app-display-font: 'Marcellus SC', serif;
  --app-ui-font: 'Archivo Narrow', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

.app-body {
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 34%, rgba(132, 16, 34, 0.2), transparent 24%),
    radial-gradient(circle at 18% 78%, rgba(92, 11, 28, 0.18), transparent 28%),
    linear-gradient(150deg, var(--ink-0) 0%, var(--ink-1) 46%, var(--ink-2) 100%);
}

.app-body.game-active,
.app-body.game-active .scene,
.app-body.game-active .app-nav {
  cursor: none;
}

.app-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 24px 32px;
  background: linear-gradient(180deg, rgba(3, 3, 4, 0.92), rgba(3, 3, 4, 0));
}

.game-hud {
  display: flex;
  align-items: stretch;
  gap: 8px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

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

.game-chip {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  min-width: 84px;
  min-height: 48px;
  padding: 6px 12px 7px;
  border: 1px solid rgba(90, 97, 106, 0.28);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(17, 18, 22, 0.94), rgba(8, 9, 12, 0.96));
  box-shadow: inset 0 1px 0 rgba(127, 40, 55, 0.12);
  text-align: center;
}

.game-chip-label {
  display: block;
  width: 100%;
  color: rgba(158, 165, 174, 0.72);
  font-family: var(--app-ui-font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1;
  text-transform: uppercase;
}

.game-chip-value {
  display: block;
  width: 100%;
  color: var(--smoke-0);
  font-family: var(--app-ui-font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid rgba(95, 102, 114, 0.46);
  background:
    linear-gradient(180deg, rgba(20, 22, 27, 0.9), rgba(7, 8, 11, 0.92)),
    rgba(8, 12, 18, 0.82);
  color: var(--smoke-0);
  text-decoration: none;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-family: var(--app-ui-font);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.login-button:hover {
  border-color: rgba(127, 40, 55, 0.58);
  background:
    linear-gradient(180deg, rgba(26, 15, 19, 0.96), rgba(11, 9, 12, 0.96)),
    rgba(25, 33, 46, 0.82);
  transform: translateY(-1px);
}

.game-field {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.game-tape-layer,
.game-slash-layer,
.game-celebration-layer,
.game-finale {
  position: absolute;
  inset: 0;
}

.game-celebration-layer,
.game-finale {
  pointer-events: none;
}

.tape-piece {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid rgba(104, 15, 31, 0.42);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(144, 24, 43, 0.96), rgba(82, 16, 30, 0.98)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.06) 0,
      rgba(255, 255, 255, 0.06) 10px,
      rgba(85, 8, 22, 0.12) 10px,
      rgba(85, 8, 22, 0.12) 20px
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(40, 5, 11, 0.26),
    0 6px 12px rgba(0, 0, 0, 0.18);
  will-change: transform, opacity;
  overflow: hidden;
}

.tape-piece::after {
  content: attr(data-stamp);
  position: absolute;
  left: 50%;
  top: 50%;
  color: rgba(248, 239, 230, 0.32);
  font-family: var(--app-ui-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(90deg);
}

.slash-mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 104px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 247, 240, 0.98), rgba(255, 255, 255, 0));
  opacity: 0;
  will-change: transform, opacity;
  animation: slashFade 220ms ease-out forwards;
}

.celebration-fragment {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--piece-width, 18px);
  height: var(--piece-height, 72px);
  border-radius: 2px;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(145, 26, 46, 0.98), rgba(74, 14, 28, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 18px rgba(0, 0, 0, 0.22);
  transform: translate3d(0, 0, 0) rotate(var(--piece-rotation, 0deg));
  animation: ribbonBurst 1550ms cubic-bezier(0.19, 0.84, 0.38, 1) forwards;
}

.celebration-fragment.is-streamer {
  border-radius: 1px;
  filter: saturate(1.06);
}

.celebration-fragment.is-banner {
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(160, 30, 52, 0.98), rgba(88, 18, 32, 0.98));
}

.celebration-fragment.is-smoke {
  background:
    linear-gradient(180deg, rgba(210, 217, 227, 0.9), rgba(128, 138, 151, 0.88));
}

.celebration-confetti {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--confetti-size, 10px);
  height: var(--confetti-size, 10px);
  border-radius: var(--confetti-radius, 1px);
  opacity: 0;
  background: var(--confetti-fill, rgba(238, 230, 220, 0.95));
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18);
  transform: translate3d(0, 0, 0) rotate(var(--confetti-rotation, 0deg));
  animation: confettiBurst 1350ms cubic-bezier(0.16, 0.84, 0.36, 1) forwards;
}

.game-finale {
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 220ms ease, transform 220ms ease;
}

.game-finale.is-visible {
  opacity: 1;
  transform: scale(1);
}

.game-finale::before {
  content: '';
  position: absolute;
  inset: 18% 16%;
  border: 1px solid rgba(130, 139, 149, 0.42);
  background:
    linear-gradient(180deg, rgba(11, 12, 16, 0.985), rgba(22, 12, 16, 0.99)),
    radial-gradient(circle at center, rgba(88, 18, 31, 0.22), rgba(7, 8, 10, 0.12) 60%, rgba(7, 8, 10, 0) 100%);
  box-shadow:
    inset 0 1px 0 rgba(220, 226, 234, 0.08),
    inset 0 0 0 1px rgba(88, 18, 31, 0.24),
    0 30px 80px rgba(0, 0, 0, 0.52);
}

.game-finale::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.46);
}

.game-finale-kicker,
.game-finale-title,
.game-finale-score {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
}

.game-finale-kicker {
  color: rgba(198, 205, 214, 0.74);
  font-family: var(--app-ui-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.34em;
  line-height: 1.2;
  max-width: min(28ch, 100%);
  text-transform: uppercase;
}

.game-finale-title {
  margin-top: 12px;
  color: #f4ece2;
  font-family: var(--app-display-font);
  font-size: clamp(34px, 6.2vw, 70px);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.04;
  max-width: min(16ch, 100%);
  text-wrap: balance;
  text-transform: uppercase;
  text-shadow:
    0 8px 26px rgba(0, 0, 0, 0.46),
    0 0 28px rgba(127, 40, 55, 0.2);
}

.game-finale-title.is-compact {
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.08;
  max-width: min(22ch, 100%);
}

.game-finale-score {
  margin-top: 14px;
  color: rgba(238, 230, 220, 0.84);
  font-family: var(--app-ui-font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.game-finale-records {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.game-finale-records-label {
  margin: 0;
  color: rgba(193, 201, 209, 0.72);
  font-family: var(--app-ui-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.game-finale-records-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.game-finale-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(107, 114, 124, 0.34);
  background:
    linear-gradient(180deg, rgba(18, 19, 23, 0.96), rgba(8, 9, 12, 0.98));
  color: rgba(234, 225, 214, 0.84);
  font-family: var(--app-ui-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.game-finale-record.is-top {
  border-color: rgba(145, 46, 64, 0.56);
  color: #f7efe6;
  box-shadow:
    inset 0 1px 0 rgba(168, 74, 90, 0.22),
    0 8px 18px rgba(23, 5, 10, 0.22);
}

@keyframes slashFade {
  0% {
    opacity: 0;
    filter: blur(1px);
  }

  20% {
    opacity: 1;
    filter: blur(0);
  }

  100% {
    opacity: 0;
    filter: blur(1px);
  }
}

@keyframes ribbonBurst {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(var(--piece-rotation, 0deg)) skewX(var(--piece-skew, 0deg)) scale(0.92);
  }

  10% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--piece-x, 0px), var(--piece-y, 0px), 0) rotate(calc(var(--piece-rotation, 0deg) + var(--piece-spin, 0deg))) skewX(var(--piece-skew, 0deg)) scale(1.08);
  }
}

@keyframes confettiBurst {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(var(--confetti-rotation, 0deg)) scale(0.7);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-x, 0px), var(--confetti-y, 0px), 0) rotate(calc(var(--confetti-rotation, 0deg) + var(--confetti-spin, 0deg))) scale(1.04);
  }
}

.auth-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, var(--auth-dialog-shift, -50%));
  width: min(476px, calc(100vw - 28px));
  margin: 0;
  padding: 0;
  border: 1px solid rgba(120, 128, 138, 0.34);
  background:
    radial-gradient(circle at top right, rgba(88, 18, 31, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(16, 11, 13, 0.985), rgba(7, 8, 11, 0.99)),
    rgba(7, 10, 16, 0.94);
  color: var(--smoke-0);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.74),
    0 14px 34px rgba(43, 10, 18, 0.24),
    inset 0 1px 0 rgba(159, 166, 177, 0.07),
    inset 0 2px 0 rgba(90, 24, 36, 0.24);
}

.auth-dialog::backdrop {
  background:
    radial-gradient(circle at center, rgba(83, 10, 24, 0.2), rgba(2, 3, 6, 0.9)),
    rgba(2, 3, 6, 0.82);
  backdrop-filter: blur(8px);
}

.auth-card {
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    transparent;
}

.auth-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(93, 102, 114, 0.34);
  border-radius: 2px;
  background: rgba(10, 11, 15, 0.84);
  color: rgba(239, 230, 220, 0.72);
  font-family: var(--app-display-font);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.auth-close:hover {
  border-color: rgba(127, 40, 55, 0.52);
  color: #f7eee6;
  background: rgba(21, 14, 17, 0.96);
}

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-kicker {
  margin: 0;
  color: rgba(196, 186, 176, 0.86);
  font-family: var(--app-ui-font);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-mode {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 2px;
  border: 1px solid rgba(90, 97, 106, 0.22);
  border-radius: 2px;
  background: rgba(7, 8, 10, 0.8);
  margin-top: 4px;
}

.auth-mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: rgba(239, 230, 220, 0.54);
  font-family: var(--app-ui-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.auth-mode-button.is-active {
  background:
    linear-gradient(180deg, rgba(58, 15, 24, 0.98), rgba(18, 15, 18, 0.98));
  color: #f8efe6;
  box-shadow:
    inset 0 1px 0 rgba(160, 72, 87, 0.18),
    inset 0 0 0 1px rgba(90, 97, 106, 0.18);
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-password-field {
  overflow: hidden;
  transform-origin: top;
  max-height: 96px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.auth-field span {
  color: rgba(198, 205, 214, 0.82);
  font-family: var(--app-ui-font);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.auth-field input {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(126, 134, 145, 0.34);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(20, 22, 28, 0.97), rgba(7, 8, 11, 0.98));
  color: #f5efe7;
  font-family: var(--app-ui-font);
  font-size: 16px;
  font-weight: 500;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.auth-password-field.is-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.auth-field input::placeholder {
  color: rgba(184, 192, 202, 0.36);
}

.auth-field input:focus-visible {
  outline: none;
  border-color: rgba(176, 70, 86, 0.62);
  background:
    linear-gradient(180deg, rgba(22, 18, 22, 0.98), rgba(9, 10, 13, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(159, 166, 177, 0.06),
    0 0 0 1px rgba(176, 70, 86, 0.16);
}

.auth-actions {
  display: grid;
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 1px solid rgba(116, 124, 135, 0.34);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(24, 27, 33, 0.96), rgba(8, 9, 12, 0.98));
  color: #f4ece2;
  font-family: var(--app-ui-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.auth-submit:hover {
  border-color: rgba(127, 40, 55, 0.5);
  transform: translateY(-1px);
}

.auth-submit-primary {
  border-color: rgba(133, 58, 72, 0.42);
  background:
    linear-gradient(180deg, rgba(53, 23, 30, 0.98), rgba(14, 12, 16, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(170, 68, 84, 0.26),
    inset 0 -1px 0 rgba(35, 6, 13, 0.34);
}

.auth-submit:disabled {
  opacity: 0.56;
  cursor: wait;
  transform: none;
}

.auth-status {
  min-height: 20px;
  margin: 0;
  color: rgba(180, 168, 154, 0.78);
  font-family: var(--app-ui-font);
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.45;
  text-align: left;
}

.auth-status.is-error {
  color: #d9707f;
}

.auth-status.is-success {
  color: #c9d1db;
}

.scene {
  position: relative;
  width: min(1320px, 100%);
  height: min(800px, 88vh);
  display: grid;
  place-items: center;
  isolation: isolate;
}

.mitre-word {
  margin: 0;
  position: relative;
  z-index: 3;
  font-family: var(--app-display-font);
  font-size: clamp(78px, 15vw, 224px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ebe2d8;
  text-shadow:
    0 18px 26px rgba(0, 0, 0, 0.42),
    0 0 22px rgba(128, 21, 40, 0.12);
}

.mitre-word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #d9d2ca;
  clip-path: polygon(62% 0, 100% 0, 100% 100%, 56% 100%);
  transform: translate(4px, 0);
  opacity: 0.66;
}

.saw-zone {
  position: absolute;
  width: clamp(340px, 49vw, 760px);
  right: clamp(-12px, 4vw, 52px);
  top: clamp(14px, 8vh, 68px);
  z-index: 2;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.56));
  animation: sawPress 2.2s ease-in-out infinite;
}

.saw-zone.is-hunting {
  position: fixed;
  right: auto;
  animation: none;
  z-index: 7;
  filter:
    drop-shadow(0 18px 26px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 24px rgba(127, 40, 55, 0.12));
  will-change: left, top, transform;
}

.saw-zone.is-hunting .blade-assembly {
  animation-duration: 150ms;
}

.saw-trigger {
  position: absolute;
  left: 8%;
  bottom: 4%;
  width: 48%;
  height: 30%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
  appearance: none;
  z-index: 4;
}

.saw-trigger:focus {
  outline: none;
}

.mitre-saw {
  width: 100%;
  height: auto;
}

.blade-assembly {
  transform-origin: 420px 214px;
  animation: bladeSpin 460ms linear infinite;
}

@keyframes bladeSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes sawPress {
  0%,
  100% {
    transform: rotate(-9deg) translate3d(0, 0, 0);
  }

  50% {
    transform: rotate(-10deg) translate3d(-8px, 4px, 0);
  }
}

@media (max-width: 980px) {
  .scene {
    height: min(760px, 92vh);
  }

  .mitre-word {
    font-size: clamp(64px, 16vw, 164px);
    letter-spacing: 0.11em;
  }

  .saw-zone {
    width: clamp(290px, 70vw, 560px);
    right: clamp(-52px, -2vw, -18px);
    top: clamp(82px, 18vh, 138px);
  }
}

@media (max-width: 680px) {
  .app-nav {
    min-height: 82px;
    padding: 16px 18px;
  }

  .game-hud {
    gap: 6px;
  }

  .game-chip {
    min-width: 70px;
    min-height: 44px;
    padding: 5px 8px 6px;
    gap: 2px;
  }

  .game-chip-label {
    font-size: 8px;
    letter-spacing: 0.18em;
  }

  .game-chip-value {
    font-size: 14px;
  }

  .login-button {
    min-height: 40px;
    padding: 0 15px;
    font-size: 10px;
  }

  .app-stage {
    padding: 10px;
  }

  .auth-card {
    padding: 20px;
  }

  .scene {
    height: 86vh;
  }

  .mitre-word {
    font-size: clamp(54px, 16vw, 96px);
    letter-spacing: 0.09em;
  }

  .saw-zone {
    width: clamp(250px, 84vw, 360px);
    right: -58px;
    top: 25%;
  }

  .game-finale-records {
    margin-top: 18px;
    gap: 8px;
  }

  .game-finale-records-label {
    font-size: 10px;
  }

  .game-finale-records-list {
    gap: 8px;
  }

  .game-finale-record {
    min-width: 62px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .game-finale-title {
    max-width: min(18ch, 100%);
  }

  .game-finale-title.is-compact {
    max-width: min(24ch, 100%);
  }
}
