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

:root {
  color-scheme: dark;
  --bg: #050816;
  --bg-2: #08111f;
  --panel: rgba(14, 20, 36, 0.7);
  --panel-strong: rgba(18, 25, 44, 0.94);
  --border: rgba(167, 188, 255, 0.16);
  --border-strong: rgba(167, 188, 255, 0.28);
  --text: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.72);
  --soft: rgba(245, 247, 251, 0.08);
  --accent: #74d4ff;
  --accent-strong: #b5e7ff;
  --good: #65e4a4;
  --warn: #ffcf77;
  --bad: #ff9d9d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, rgba(116, 212, 255, 0.2), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(109, 89, 255, 0.16), transparent 26%),
    radial-gradient(circle at 80% 78%, rgba(65, 212, 156, 0.08), transparent 20%),
    linear-gradient(180deg, #040712 0%, #07111d 42%, #08131f 100%);
  overflow-x: hidden;
}

.bootstrap-fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(116, 212, 255, 0.16), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(101, 228, 164, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(5, 8, 22, 0.96), rgba(7, 17, 29, 0.98));
  z-index: 1;
}

html.app-ready .bootstrap-fallback {
  display: none;
}

.bootstrap-fallback__card {
  width: min(620px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(14, 20, 36, 0.84);
  box-shadow: var(--shadow);
  text-align: center;
}

.bootstrap-fallback__card h1 {
  margin-top: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.bootstrap-fallback__card p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.7;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 92%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-root {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.stage {
  position: relative;
  min-height: 100vh;
  width: 100%;
}

.stage--current,
.stage--incoming {
  position: absolute;
  inset: 0;
}

.stage--current {
  z-index: 0;
  animation: stage-current 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.stage--incoming {
  z-index: 1;
  animation: stage-incoming 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 28px;
  overflow: hidden;
}

.screen__ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(24px);
  pointer-events: none;
  opacity: 0.92;
  animation: float 10s ease-in-out infinite;
}

.screen__ambient--one {
  width: 38vw;
  height: 38vw;
  top: -10vw;
  left: -8vw;
  background: radial-gradient(circle, rgba(116, 212, 255, 0.26), transparent 68%);
}

.screen__ambient--two {
  width: 30vw;
  height: 30vw;
  right: -4vw;
  bottom: -6vw;
  background: radial-gradient(circle, rgba(109, 89, 255, 0.22), transparent 68%);
  animation-delay: -3s;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent-strong);
}

.landing,
.mode-select,
.game-shell {
  position: relative;
  width: min(1120px, 100%);
  margin: 0 auto;
  z-index: 1;
}

.landing {
  display: grid;
  gap: 24px;
  max-width: 760px;
  text-align: center;
  justify-items: center;
  padding: clamp(24px, 4vw, 48px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(9, 15, 30, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.landing h2,
.mode-select h2,
.game-shell h2 {
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.landing__subtitle,
.mode-select__subtitle {
  max-width: 26ch;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  line-height: 1.4;
  color: var(--text);
}

.landing__body {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.7;
}

.landing__actions,
.mode-select__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.mode-select {
  display: grid;
  gap: 26px;
  padding: clamp(20px, 3.4vw, 42px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(9, 15, 30, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.mode-select__copy {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.stage-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(180, 231, 255, 0.2);
  background: rgba(116, 212, 255, 0.08);
  color: var(--accent-strong);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mode-transition {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(116, 212, 255, 0.1);
  border: 1px solid rgba(116, 212, 255, 0.2);
  color: var(--accent-strong);
  font-size: 0.92rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.mode-card {
  min-height: 180px;
  padding: 20px;
  display: grid;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease,
    background 200ms ease;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.3);
}

.mode-card:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: rgba(180, 231, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(116, 212, 255, 0.12);
}

.mode-card--selected {
  border-color: rgba(180, 231, 255, 0.46);
  background:
    linear-gradient(180deg, rgba(116, 212, 255, 0.14), rgba(116, 212, 255, 0.04)),
    rgba(8, 16, 30, 0.9);
  box-shadow: 0 0 0 1px rgba(116, 212, 255, 0.08), 0 0 0 12px rgba(116, 212, 255, 0.03);
}

.mode-card--disabled {
  overflow: hidden;
  opacity: 0.72;
  cursor: not-allowed;
}

.mode-card--disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(5px);
}

.mode-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mode-card__badge,
.pill,
.feedback-card__label,
.card-kicker,
.navbar__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.mode-card__badge {
  color: var(--accent-strong);
}

.mode-card__role {
  color: var(--muted);
  font-size: 0.8rem;
}

.mode-card__overlay {
  color: var(--warn);
  font-size: 0.8rem;
}

.mode-card h3 {
  font-size: 1.15rem;
}

.mode-card p {
  color: var(--muted);
  line-height: 1.6;
}

.mode-card__footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.mode-card__footer span {
  display: block;
}

.button {
  position: relative;
  border: 0;
  border-radius: 999px;
  min-height: 52px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  outline: none;
}

.button:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.button--primary {
  color: #05101d;
  background: linear-gradient(180deg, #d8f4ff, #74d4ff);
  box-shadow: 0 16px 34px rgba(116, 212, 255, 0.28);
}

.button--secondary {
  color: #08101d;
  background: linear-gradient(180deg, #89f0c0, #65e4a4);
  box-shadow: 0 16px 34px rgba(101, 228, 164, 0.24);
}

.button--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.button--hero {
  min-width: 210px;
  min-height: 60px;
  font-size: 1.02rem;
}

.button__dots,
.thinking__dots {
  display: inline-flex;
  gap: 4px;
}

.button__dots i,
.thinking__dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
  animation: pulse-dot 900ms ease-in-out infinite;
}

.button__dots i:nth-child(2),
.thinking__dots i:nth-child(2) {
  animation-delay: 120ms;
}

.button__dots i:nth-child(3),
.thinking__dots i:nth-child(3) {
  animation-delay: 240ms;
}

.game-stage {
  display: grid;
  gap: 22px;
  padding: 24px 20px 28px;
}

.navbar {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar__mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d8f4ff, #74d4ff);
  box-shadow: 0 0 0 8px rgba(116, 212, 255, 0.08);
}

.navbar h1 {
  font-size: 1.18rem;
  line-height: 1.1;
}

.navbar__eyebrow {
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navbar__pills {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent-strong);
}

.pill--soft {
  color: var(--text);
}

.pill--tick {
  animation: tick-pop 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-shell {
  display: grid;
  gap: 18px;
}

.game-shell__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.game-shell__status {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-shell h2 {
  font-size: clamp(2rem, 4vw, 3.8rem);
}

.terminal-banner,
.notice,
.thinking,
.feedback-card,
.game-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.terminal-banner {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.terminal-banner--win {
  border-color: rgba(101, 228, 164, 0.28);
}

.terminal-banner--loss {
  border-color: rgba(255, 157, 157, 0.28);
}

.terminal-banner__button {
  margin-left: auto;
}

.notice {
  padding: 14px 16px;
  color: var(--warn);
}

.thinking {
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.thinking__label {
  color: var(--accent-strong);
  font-weight: 700;
}

.feedback-card {
  padding: 18px 20px;
  display: grid;
  gap: 8px;
  animation: card-pop 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feedback-card--yes {
  border-color: rgba(101, 228, 164, 0.34);
}

.feedback-card--no {
  border-color: rgba(255, 157, 157, 0.34);
}

.feedback-card--warning {
  border-color: rgba(255, 207, 119, 0.34);
}

.feedback-card--win {
  border-color: rgba(101, 228, 164, 0.42);
}

.feedback-card--loss {
  border-color: rgba(255, 157, 157, 0.42);
}

.feedback-card--quiet {
  border-style: dashed;
}

.feedback-card__label {
  color: var(--accent-strong);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.game-column {
  display: grid;
  gap: 18px;
}

.game-card {
  padding: 20px;
}

.game-card--history {
  min-height: 100%;
}

.game-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-kicker {
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

.field__label {
  font-size: 0.92rem;
  color: var(--muted);
}

.field__control {
  width: 100%;
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(4, 8, 17, 0.72);
  color: var(--text);
  padding: 14px 16px;
  resize: vertical;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.field__control::placeholder {
  color: rgba(245, 247, 251, 0.4);
}

.field__control:focus {
  outline: none;
  border-color: rgba(180, 231, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(116, 212, 255, 0.12);
  background: rgba(7, 11, 22, 0.92);
}

.field__control:disabled {
  opacity: 0.72;
}

.field__control--textarea {
  min-height: 104px;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.history {
  display: grid;
  gap: 12px;
  max-height: 640px;
  overflow: auto;
  padding-right: 2px;
}

.history__empty {
  display: grid;
  gap: 6px;
  min-height: 220px;
  place-content: center;
  text-align: center;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(180, 231, 255, 0.18);
  color: var(--muted);
  padding: 20px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--soft);
  background: rgba(255, 255, 255, 0.03);
  animation: item-in 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.history-item--yes {
  border-color: rgba(101, 228, 164, 0.22);
}

.history-item--no {
  border-color: rgba(255, 157, 157, 0.22);
}

.history-item--win {
  border-color: rgba(101, 228, 164, 0.3);
}

.history-item--loss {
  border-color: rgba(255, 157, 157, 0.3);
}

.history-item--warning {
  border-color: rgba(255, 207, 119, 0.28);
}

.history-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(245, 247, 251, 0.6);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-item strong {
  font-size: 1.02rem;
}

.history-item p {
  color: var(--text);
  line-height: 1.55;
}

@keyframes stage-current {
  from {
    opacity: 0.92;
    transform: scale(0.985);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes stage-incoming {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.986);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes card-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translate3d(14px, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tick-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, 18px, 0);
  }
}

@media (max-width: 920px) {
  .mode-grid,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .navbar,
  .game-shell__top {
    flex-direction: column;
    align-items: stretch;
  }

  .navbar__actions,
  .game-shell__status {
    justify-content: flex-start;
  }

  .terminal-banner__button {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .screen {
    padding: 16px;
  }

  .landing,
  .mode-select,
  .game-shell__top,
  .game-card,
  .feedback-card,
  .terminal-banner,
  .notice,
  .thinking {
    padding-left: 16px;
    padding-right: 16px;
  }

  .landing h2,
  .mode-select h2,
  .game-shell h2 {
    font-size: clamp(2.1rem, 13vw, 3.8rem);
  }

  .button,
  .button--hero {
    width: 100%;
  }

  .landing__actions,
  .mode-select__actions,
  .form-actions {
    justify-content: stretch;
  }

  .game-card__header,
  .navbar__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .game-card__header .button,
  .navbar__actions .button {
    width: 100%;
  }
}

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

  .stage--current,
  .stage--incoming {
    position: relative;
    inset: auto;
  }
}
