:root {
  --bg-1: #08121f;
  --bg-2: #0f1f33;
  --font-ui: "Manrope", "Inter", "Segoe UI", sans-serif;
  --font-display: "Sora", "Manrope", "Inter", sans-serif;
  --ink: #f4f8ff;
  --ink-soft: #a9b8ca;
  --panel: rgba(13, 27, 44, 0.7);
  --panel-strong: rgba(10, 22, 37, 0.9);
  --line: rgba(168, 196, 226, 0.2);
  --line-strong: rgba(168, 196, 226, 0.34);
  --accent: #17ad7c;
  --accent-2: #2ea8ff;
  --danger: #d44f59;
  --warning: #f3b548;
  --chart-surface: #0c1727;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: #08121f;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(46, 168, 255, 0.2) 0, transparent 42%),
    radial-gradient(circle at 100% 0, rgba(26, 187, 134, 0.18) 0, transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(243, 181, 72, 0.08) 0, transparent 44%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
}

body.modal-open {
  overflow: hidden;
}

body.game-running {
  overflow-y: hidden;
  overflow-x: hidden;
}

.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(640px, 900px) minmax(260px, 320px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  align-content: start;
  justify-content: center;
  min-height: 100vh;
  overflow-x: clip;
}

.app.game-active {
  grid-template-columns: minmax(260px, 320px) minmax(700px, 960px);
  grid-template-rows: auto minmax(0, 1fr);
  padding: 12px;
  justify-content: center;
  min-height: 100vh;
  max-height: 100vh;
}

.app.game-active .left-column,
.app.game-active .game-panel,
.app.game-active .social-panel {
  min-height: 0;
  max-height: 100%;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app.game-active .config-panel {
  overflow: auto;
}

.app.game-active .game-panel {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 173, 214, 0.55) rgba(12, 25, 40, 0.45);
}

.app.game-active .game-panel {
  width: 100%;
  max-width: 980px;
}

.left-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(14px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 34px rgba(4, 12, 23, 0.42);
  animation: panelIn 350ms ease;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin-top: 0;
  letter-spacing: 0.15px;
}

#setup-view[hidden],
#session-view[hidden],
#result-box[hidden],
#final-summary[hidden],
#game-complete-modal[hidden],
#stats-row[hidden],
#controls[hidden],
#leaderboard-panel[hidden],
#advanced-settings[hidden],
#nickname-label[hidden],
#nickname-pill[hidden],
#save-settings[hidden] {
  display: none !important;
}

.config-panel {
  display: grid;
  grid-template-rows: 1fr;
  gap: 12px;
  align-content: start;
}

.brand-link {
  display: inline-flex;
  border-radius: 12px;
}

.brand-link:focus-visible {
  outline: 2px solid rgba(46, 168, 255, 0.82);
  outline-offset: 3px;
}

.brand-logo {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.mode-pill {
  border-radius: 999px;
  border: 1px solid rgba(146, 183, 220, 0.42);
  background: rgba(11, 23, 38, 0.74);
  color: #d8e8fa;
  text-decoration: none;
  padding: 8px 14px;
  min-height: 42px;
  line-height: 1.1;
  font-size: 1.05rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.mode-pill.active {
  border-color: rgba(54, 156, 238, 0.84);
  background: rgba(47, 144, 225, 0.2);
  color: #e7f4ff;
}

.mode-pill:disabled {
  opacity: 1;
  cursor: default;
}

.config-grid {
  display: grid;
  gap: 12px;
  align-content: start;
}

.session-view {
  display: grid;
  gap: 12px;
  align-content: start;
}

.social-panel {
  display: grid;
  gap: 8px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(168, 196, 226, 0.3);
  background: rgba(17, 35, 56, 0.72);
  color: #d7e7f8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.social-link-circle {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.social-link-circle:hover {
  transform: translateY(-1px);
  border-color: rgba(101, 179, 244, 0.72);
  background: rgba(22, 48, 75, 0.88);
}

.social-link-circle svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.social-link--x {
  color: #81bff6;
}

.social-link--discord {
  color: #47c9d8;
}

.social-link--github {
  color: #95f0d0;
}

.copyright {
  margin: 0;
  color: #8ea7c1;
  font-size: 0.73rem;
  line-height: 1.35;
}

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

.side-stats div {
  padding: 9px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, rgba(16, 33, 54, 0.9), rgba(9, 21, 34, 0.74));
  text-align: center;
}

#side-round,
#side-score,
#side-correct,
#side-accuracy {
  font-size: 1.26rem;
  font-weight: 700;
  line-height: 1.1;
}

.fixed-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.fixed-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(22, 40, 63, 0.65);
  color: #d8e8f8;
  font-size: 0.82rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-pill {
  cursor: pointer;
}

.advanced-settings {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 26, 42, 0.48);
}

.choice-group {
  display: grid;
  gap: 8px;
}

.choice-title {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-btn {
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(15, 29, 46, 0.74);
  color: #d9e8fa;
  font-size: 0.84rem;
  box-shadow: none;
}

.choice-btn.active {
  border-color: rgba(46, 168, 255, 0.66);
  background: linear-gradient(135deg, rgba(15, 102, 173, 0.86), rgba(18, 136, 115, 0.78));
  color: #f7fcff;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: #ccdaea;
}

input,
select,
button {
  font: inherit;
  border-radius: 12px;
}

input,
select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(7, 16, 29, 0.62);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(46, 168, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(46, 168, 255, 0.18);
}

.config-grid input:disabled,
.config-grid select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  color: #95aac0;
  background: rgba(7, 16, 29, 0.42);
}

button {
  padding: 11px 14px;
  border: 0;
  cursor: pointer;
  color: #f7fcff;
  background: linear-gradient(135deg, #15986e, #138b84);
  transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 8px 20px rgba(10, 133, 99, 0.34);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#save-settings {
  background: linear-gradient(140deg, rgba(18, 54, 89, 0.86), rgba(13, 77, 105, 0.78));
  border: 1px solid rgba(76, 150, 213, 0.42);
  box-shadow: none;
}

#save-settings:disabled {
  background: rgba(24, 46, 70, 0.64);
  border-color: rgba(128, 162, 198, 0.22);
}

#submit-guess:not(:disabled) {
  animation: submitGlow 2.2s ease-in-out infinite;
}

.game-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  position: relative;
  background: var(--chart-surface);
}

.app:not(.game-active) .game-panel {
  background: var(--chart-surface);
}

.leaderboard-panel {
  display: grid;
  align-content: start;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: static;
}

.leaderboard-panel h2 {
  margin-bottom: 2px;
  font-size: 1.95rem;
}

.leaderboard-panel h3 {
  margin-bottom: 0;
  font-size: 1.16rem;
}

.game-panel.flash-win {
  animation: gameWinPulse 760ms ease;
}

.game-panel.flash-loss {
  animation: gameLossPulse 680ms ease;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.stats-row div {
  padding: 10px;
  text-align: center;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, rgba(16, 33, 54, 0.9), rgba(9, 21, 34, 0.74));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition: transform 0.15s ease;
}

.stats-row div:hover {
  transform: translateY(-2px);
}

.label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

#stat-round,
#stat-score,
#stat-correct,
#stat-accuracy {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--chart-surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

#chart {
  display: block;
  width: auto;
  max-width: none;
  max-height: none;
  touch-action: pan-y;
  transition: opacity 0.2s ease;
}

.intro-animation {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.intro-start-cta {
  --intro-cta-transform: translateX(-50%);
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: var(--intro-cta-transform);
  min-width: 220px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, box-shadow 0.24s ease;
  border: 1px solid rgba(44, 183, 146, 0.58);
  box-shadow: 0 10px 22px rgba(11, 102, 91, 0.42);
  isolation: isolate;
  will-change: opacity, box-shadow;
}

.intro-start-cta.is-visible {
  opacity: 1;
  pointer-events: auto;
  animation: ctaPulse 2.6s ease-in-out infinite;
}

.intro-start-cta:hover {
  transform: var(--intro-cta-transform);
  box-shadow: 0 12px 30px rgba(17, 157, 122, 0.52);
}

.intro-start-cta:active {
  transform: var(--intro-cta-transform);
}

.intro-start-cta:disabled {
  transform: var(--intro-cta-transform);
  opacity: 1;
  animation: none;
  box-shadow: 0 10px 22px rgba(11, 102, 91, 0.42);
}

.chart-wrap.show-intro .intro-animation {
  opacity: 1;
}

.chart-wrap.show-intro #chart {
  opacity: 0;
}

.app:not(.game-active) .chart-wrap {
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.controls {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(14, 29, 47, 0.56), rgba(10, 24, 39, 0.48));
}

.app.game-active .controls {
  gap: 5px;
  padding: 9px 12px;
}

.app.game-active #round-hint {
  font-size: 1rem;
}

.controls p {
  margin: 0;
}

#round-hint {
  font-size: 1.05rem;
  font-weight: 600;
}

.controls-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.controls-topline #round-hint {
  flex: 1 1 auto;
  min-width: 0;
}

.slider-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

#price-slider {
  width: 100%;
  padding: 0;
  appearance: none;
  touch-action: pan-x;
  height: 10px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(90deg, rgba(199, 65, 74, 0.9) 0%, rgba(199, 65, 74, 0.58) 50%, rgba(27, 170, 123, 0.58) 50%, rgba(27, 170, 123, 0.9) 100%);
}

#price-slider:disabled {
  opacity: 0.48;
}

#price-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #f7fbff;
  background: linear-gradient(145deg, #2b81d3, #18486f);
  box-shadow: 0 4px 12px rgba(8, 18, 34, 0.5);
  cursor: grab;
}

#price-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #f7fbff;
  background: linear-gradient(145deg, #2b81d3, #18486f);
  box-shadow: 0 4px 12px rgba(8, 18, 34, 0.5);
  cursor: grab;
}

.guess-vs-cut {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(71, 96, 126, 0.24);
  color: #dbe8f7;
  white-space: nowrap;
  flex: 0 0 auto;
}

.guess-vs-cut.up {
  background: rgba(23, 173, 124, 0.18);
  border-color: rgba(23, 173, 124, 0.42);
  color: #7ef0c7;
}

.guess-vs-cut.down {
  background: rgba(212, 79, 89, 0.17);
  border-color: rgba(212, 79, 89, 0.42);
  color: #ffadb3;
}

.guess-vs-cut.flat {
  background: rgba(243, 181, 72, 0.16);
  border-color: rgba(243, 181, 72, 0.42);
  color: #ffd68c;
}

.move-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: baseline;
}

.move-metric {
  margin: 0;
  font-size: 0.96rem;
  color: #d7e5f5;
}

.move-metric strong {
  color: #f0f7ff;
}

.move-metrics-row .move-metric:nth-child(1) {
  text-align: left;
}

.move-metrics-row .move-metric:nth-child(2) {
  text-align: center;
}

.move-metrics-row .move-metric:nth-child(3) {
  text-align: right;
}

.result-box {
  border: 1px solid var(--line);
  border-left: 5px solid var(--warning);
  border-radius: 14px;
  padding: 13px;
  background: linear-gradient(180deg, rgba(23, 42, 64, 0.78), rgba(11, 25, 39, 0.72));
  display: grid;
  gap: 10px;
}

.result-box.correct {
  border-left-color: var(--accent);
}

.result-box.correct h2 {
  color: #9ff4d4;
}

.result-box.wrong {
  border-left-color: var(--danger);
}

.result-box.wrong h2 {
  color: #ffc2c8;
}

.result-box.anim-win {
  animation: winPop 760ms ease;
}

.result-box.anim-loss {
  animation: lossShake 520ms ease;
}

.result-box h2 {
  margin: 0;
  line-height: 1.2;
  font-size: 1.95rem;
  color: #f6fbff;
  text-shadow: 0 6px 22px rgba(8, 19, 33, 0.42);
}

.result-box p {
  margin: 0;
  color: #d4e2f3;
}

.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-direction-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #d9e8f9;
  background: rgba(61, 89, 123, 0.25);
}

.result-direction-badge.up {
  color: #88f0cb;
  border-color: rgba(23, 173, 124, 0.45);
  background: rgba(23, 173, 124, 0.16);
}

.result-direction-badge.down {
  color: #ffadb3;
  border-color: rgba(212, 79, 89, 0.45);
  background: rgba(212, 79, 89, 0.16);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.result-card {
  border: 1px solid rgba(170, 198, 227, 0.22);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  background: linear-gradient(175deg, rgba(13, 31, 49, 0.72), rgba(9, 22, 37, 0.64));
}

.result-card-wide {
  grid-column: 1 / -1;
}

.result-card h3 {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #95adc6;
  letter-spacing: 0.35px;
}

#result-score-line {
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.metric-row span {
  color: #bdd1e6;
}

.metric-row strong {
  color: #edf6ff;
  font-size: 1.03rem;
}

.metric-row.metric-main-win span {
  color: #d7ecff;
  font-weight: 700;
}

.metric-row.metric-main-win strong {
  color: #7ef0c7;
  font-size: 1.3rem;
}

.metric-row.metric-main-loss span {
  color: #bdd1e6;
  font-weight: 400;
}

.metric-row.metric-main-loss strong {
  color: #edf6ff;
  font-size: 1.03rem;
}

.round-move-meta {
  color: #a9bfd5;
}

.round-move-meta strong {
  color: #e8f4ff;
}

@media (max-width: 920px) {
  .app {
    padding: 10px;
    gap: 10px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel {
    padding: 14px;
  }

  .game-panel {
    gap: 10px;
  }

  .app:not(.game-active) .game-panel {
    min-height: 390px;
  }

  .app:not(.game-active) .chart-wrap {
    min-height: 260px;
  }

  .intro-start-cta {
    --intro-cta-transform: translate(-50%, -50%);
    min-width: min(78%, 320px);
    top: 66%;
    bottom: auto;
    transform: var(--intro-cta-transform);
  }

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

  .fixed-pill {
    width: 100%;
  }

  #price-slider {
    height: 12px;
  }

  .controls,
  .app.game-active .controls {
    padding-left: 16px;
    padding-right: 16px;
  }

  #price-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  #price-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  .move-metrics-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .move-metrics-row .move-metric:nth-child(1),
  .move-metrics-row .move-metric:nth-child(2),
  .move-metrics-row .move-metric:nth-child(3) {
    text-align: left;
  }
}

.final-summary {
  border: 1px solid rgba(170, 198, 227, 0.22);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  background: linear-gradient(175deg, rgba(13, 31, 49, 0.72), rgba(9, 22, 37, 0.64));
}

.final-summary h3 {
  margin: 0;
  font-size: 0.8rem;
  color: #95adc6;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.final-summary p {
  margin: 0;
  color: #d4e2f3;
}

.lb-tabs {
  display: flex;
  gap: 8px;
  width: 100%;
  margin: 8px 0 0;
}

.lb-tab {
  flex: 1 1 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  background: rgba(14, 29, 47, 0.68);
  color: #d2e3f8;
  box-shadow: none;
}

.lb-period-tabs .lb-tab {
  flex-basis: 50%;
  padding: 10px 12px;
  font-size: 1rem;
  font-weight: 700;
  border-color: rgba(81, 145, 201, 0.38);
  background: rgba(16, 36, 59, 0.82);
}

.lb-period-tabs {
  margin-top: 8px;
  margin-bottom: 6px;
}

.lb-round-tabs {
  margin-top: 2px;
  margin-bottom: 8px;
  opacity: 0.86;
}

.lb-round-tabs .lb-tab {
  padding: 6px 9px;
  font-size: 0.82rem;
  color: #a9bfd5;
  border-color: rgba(136, 173, 214, 0.22);
  background: rgba(11, 24, 40, 0.62);
}

.lb-tab:hover {
  transform: translateY(-1px);
}

.lb-tab.active {
  border-color: rgba(46, 168, 255, 0.6);
  background: linear-gradient(135deg, rgba(19, 75, 134, 0.88), rgba(15, 129, 112, 0.78));
  color: #f6fbff;
}

.lb-period-tabs .lb-tab.active {
  border-color: rgba(65, 187, 255, 0.66);
  box-shadow: 0 0 0 1px rgba(34, 170, 242, 0.16) inset;
}

.lb-round-tabs .lb-tab.active {
  border-color: rgba(100, 161, 214, 0.42);
  background: rgba(18, 49, 78, 0.82);
  color: #d6e9fb;
  box-shadow: none;
}

.lb-table {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(9, 20, 34, 0.55);
}

.lb-body {
  display: grid;
  align-content: start;
  grid-auto-rows: min-content;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 173, 214, 0.55) rgba(12, 25, 40, 0.45);
}

.lb-body::-webkit-scrollbar {
  width: 8px;
}

.lb-body::-webkit-scrollbar-track {
  background: rgba(12, 25, 40, 0.45);
}

.lb-body::-webkit-scrollbar-thumb {
  background: rgba(136, 173, 214, 0.55);
  border-radius: 999px;
}

.lb-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 52px 44px 52px;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-top: 1px solid rgba(168, 196, 226, 0.16);
  font-size: 0.78rem;
  color: #d9e7f8;
}

.lb-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-row span:nth-child(1),
.lb-row span:nth-child(3),
.lb-row span:nth-child(4),
.lb-row span:nth-child(5) {
  text-align: right;
}

.lb-head {
  border-top: 0;
  font-size: 0.64rem;
  font-weight: 700;
  color: #8ca6bf;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: rgba(20, 38, 59, 0.72);
}

.lb-empty {
  color: #90a8bf;
}

.game-complete-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.game-complete-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 11, 20, 0.68);
  backdrop-filter: blur(4px);
}

.game-complete-dialog {
  position: relative;
  width: min(560px, calc(100vw - 36px));
  border: 1px solid rgba(146, 182, 219, 0.32);
  border-radius: 18px;
  padding: 18px 18px 16px;
  background: linear-gradient(170deg, rgba(16, 33, 54, 0.96), rgba(8, 19, 32, 0.96));
  box-shadow:
    0 26px 56px rgba(2, 9, 18, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 12px;
}

.game-complete-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(168, 196, 226, 0.28);
  background: rgba(11, 26, 42, 0.75);
  color: #d9ebff;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: none;
}

.game-complete-dialog h3 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.1;
}

.game-complete-subtitle {
  margin: 0;
  color: #9fb6cd;
  font-size: 0.92rem;
}

.game-complete-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.game-complete-grid div {
  border: 1px solid rgba(168, 196, 226, 0.24);
  border-radius: 12px;
  padding: 10px 9px;
  background: rgba(9, 22, 37, 0.58);
  display: grid;
  gap: 4px;
}

.game-complete-grid span {
  color: #9ab2ca;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.26px;
}

.game-complete-grid strong {
  color: #f2f8ff;
  font-size: 1.34rem;
  line-height: 1.1;
}

.game-complete-ranks {
  border: 1px solid rgba(168, 196, 226, 0.2);
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(8, 20, 34, 0.54);
  display: grid;
  gap: 5px;
}

.game-complete-ranks p {
  margin: 0;
  color: #cde1f5;
  font-weight: 600;
}

.game-complete-ok {
  margin-top: 2px;
}

ol,
ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin: 5px 0;
  line-height: 1.3;
  color: #d4e2f3;
}

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

@keyframes submitGlow {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(10, 133, 99, 0.3);
  }
  50% {
    box-shadow: 0 10px 24px rgba(24, 170, 132, 0.52);
  }
}

@keyframes ctaPulse {
  0%,
  100% {
    box-shadow:
      0 10px 22px rgba(11, 102, 91, 0.42),
      0 0 0 0 rgba(22, 173, 129, 0);
  }
  50% {
    box-shadow:
      0 12px 30px rgba(17, 157, 122, 0.56),
      0 0 0 6px rgba(22, 173, 129, 0.22);
  }
}

@keyframes winPop {
  0% {
    transform: scale(0.985);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  45% {
    transform: scale(1.006);
    box-shadow: 0 0 0 6px rgba(23, 173, 124, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

@keyframes lossShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes gameWinPulse {
  0% {
    box-shadow: inset 0 0 0 0 rgba(23, 173, 124, 0);
  }
  55% {
    box-shadow: inset 0 0 0 2px rgba(23, 173, 124, 0.38);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(23, 173, 124, 0);
  }
}

@keyframes gameLossPulse {
  0% {
    box-shadow: inset 0 0 0 0 rgba(212, 79, 89, 0);
  }
  55% {
    box-shadow: inset 0 0 0 2px rgba(212, 79, 89, 0.38);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(212, 79, 89, 0);
  }
}

@media (max-width: 1360px) {
  body.game-running {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .app.game-active {
    grid-template-columns: 1fr;
    justify-content: stretch;
    min-height: 0;
    max-height: none;
  }

  .left-column {
    display: contents;
  }

  .config-panel {
    order: 1;
  }

  .game-panel {
    order: 2;
  }

  .leaderboard-panel {
    order: 3;
  }

  .social-panel {
    order: 4;
  }

  .app.game-active .config-panel,
  .app.game-active .game-panel,
  .app.game-active .social-panel {
    max-height: none;
  }

  .app.game-active .config-panel,
  .app.game-active .game-panel {
    overflow: visible;
  }

  .leaderboard-panel {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .lb-body {
    max-height: 260px;
  }

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

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

  .result-card-wide {
    grid-column: auto;
  }

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

  .game-complete-grid {
    grid-template-columns: 1fr;
  }
}
