:root {
  --layout-scale: 1;
  --bg-0: #0d1219;
  --bg-1: #131a24;
  --bg-2: #18242a;
  --panel: #202a30;
  --panel-soft: #1a2328;
  --surface: #161f25;
  --surface-soft: #11191e;
  --text-high: #eef3f6;
  --text-mid: #c2ced7;
  --text-low: #8f9fa9;
  --line: rgba(158, 188, 173, 0.24);
  --line-strong: rgba(173, 212, 191, 0.46);
  --accent: #50d38b;
  --accent-strong: #8af3b8;
  --accent-soft: rgba(80, 211, 139, 0.22);
  --premium: #d8b979;
  --premium-soft: rgba(216, 185, 121, 0.22);
  --premium-line: rgba(220, 190, 128, 0.42);
  --danger: #ff6f87;
  --warning: #ffc967;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 46px rgba(5, 7, 12, 0.5);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", sans-serif;
  color: var(--text-high);
  background:
    radial-gradient(circle at 12% 0%, rgba(73, 174, 121, 0.14), transparent 33%),
    radial-gradient(circle at 84% 8%, rgba(147, 128, 189, 0.08), transparent 35%),
    linear-gradient(155deg, var(--bg-0) 0%, var(--bg-1) 54%, var(--bg-2) 100%);
}

body.is-modal-open {
  overflow: hidden;
}

.bg-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(188, 210, 204, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(188, 210, 204, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.5;
}

.viewport-fit {
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 8px 6px;
}

.page-layout {
  position: relative;
  z-index: 1;
  width: min(1760px, calc(100% - 16px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: clamp(168px, 14vw, 230px) minmax(0, 1fr) clamp(168px, 14vw, 230px);
  gap: 12px;
  align-items: start;
  transform: scale(var(--layout-scale));
  transform-origin: top center;
  will-change: transform;
}

body.is-fit-locked {
  overflow: hidden;
}

.ad-rail {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(26, 34, 39, 0.92), rgba(16, 21, 26, 0.9));
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 88vh;
}

.ad-label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-low);
  font-weight: 700;
}

.ad-slot {
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(170, 210, 190, 0.4);
  background:
    linear-gradient(160deg, rgba(127, 170, 148, 0.12), rgba(76, 96, 107, 0.12)),
    repeating-linear-gradient(
      -45deg,
      rgba(176, 208, 196, 0.1) 0,
      rgba(176, 208, 196, 0.1) 8px,
      rgba(176, 208, 196, 0.03) 8px,
      rgba(176, 208, 196, 0.03) 16px
    );
  color: var(--text-mid);
  font-weight: 700;
  display: grid;
  place-items: center;
  text-align: center;
}

.ad-slot-vertical {
  height: clamp(240px, 32vh, 320px);
}

.app-shell {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(25, 33, 40, 0.95), rgba(16, 22, 29, 0.92));
  box-shadow: var(--shadow);
  padding: 12px;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

.hero-lights {
  pointer-events: none;
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 130px;
  z-index: 1;
}

.floodlight {
  position: absolute;
  top: -14px;
  width: 244px;
  height: 196px;
  border-radius: 46% 46% 54% 54%;
  opacity: 0.96;
  background:
    radial-gradient(circle at center, rgba(255, 248, 229, 0.9) 0%, rgba(244, 227, 183, 0.32) 48%, transparent 80%);
  filter: blur(0.8px);
}

.floodlight::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 8px;
  height: 42px;
  border-radius: 10px;
  background:
    radial-gradient(circle, rgba(255, 250, 233, 0.95) 0 2.8px, transparent 3.2px);
  background-size: 16px 16px;
  opacity: 0.95;
}

.floodlight::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  top: 34px;
  border-radius: 56% 56% 62% 62%;
  background: linear-gradient(to bottom, rgba(255, 239, 200, 0.44), transparent 80%);
}

.floodlight-left {
  left: 66px;
  transform: rotate(-16deg);
}

.floodlight-right {
  right: 66px;
  transform: rotate(16deg);
}

.topbar {
  position: relative;
  z-index: 2;
  border-radius: var(--radius-lg);
  border: 1px solid var(--premium-line);
  background: linear-gradient(168deg, #273238, #1a232a);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.icon-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 38px;
  width: 38px;
  background: rgba(128, 166, 148, 0.2);
  color: var(--text-high);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  filter: brightness(1.07);
}

.icon-btn-subtle {
  background: rgba(111, 131, 144, 0.2);
}

.icon-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-meta {
  border-radius: 12px;
  border: 1px solid rgba(167, 198, 183, 0.38);
  background: rgba(20, 30, 37, 0.6);
  padding: 7px 9px;
  display: grid;
  gap: 5px;
}

.topbar-date {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d2c8af;
}

.topbar-puzzle-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
}

.brand-logo-svg {
  width: 46px;
  height: 46px;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.34));
}

.brand-copy h1 {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
  color: #e4cb98;
  text-shadow: 0 1px 0 rgba(40, 34, 18, 0.8);
}

.brand-copy p {
  margin: 1px 0 0;
  color: #d6c39e;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(133, 166, 151, 0.22);
  color: var(--text-mid);
  padding: 7px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chip-rank {
  color: #eff6f2;
  border-color: rgba(160, 212, 185, 0.52);
  background: rgba(85, 152, 120, 0.32);
}

.puzzle-chip {
  border-color: rgba(221, 194, 137, 0.5);
  background: rgba(145, 123, 78, 0.24);
  color: #f2dfb7;
}

.screen {
  display: none;
  margin-top: 12px;
  animation: screenIn 180ms ease;
}

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

.game-layout {
  border-radius: var(--radius-lg);
  border: 1px solid var(--premium-line);
  background: linear-gradient(170deg, rgba(31, 41, 49, 0.92), rgba(20, 28, 35, 0.9));
  padding: 11px;
  display: grid;
  gap: 12px;
}

.game-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

.illustration-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 14% 24%, rgba(130, 189, 159, 0.16), transparent 44%),
    linear-gradient(155deg, rgba(45, 64, 74, 0.66), rgba(24, 34, 41, 0.72));
  padding: 11px;
}

.illustration-title {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1rem;
}

.illustration-card p {
  margin: 4px 0 0;
  color: var(--text-mid);
}

.game-board {
  border-radius: var(--radius-md);
  border: 1px solid rgba(166, 205, 180, 0.48);
  background:
    radial-gradient(circle at 30% 20%, rgba(95, 173, 114, 0.16), transparent 40%),
    radial-gradient(circle at 72% 68%, rgba(78, 138, 96, 0.16), transparent 46%),
    linear-gradient(160deg, rgba(23, 49, 37, 0.72), rgba(16, 33, 26, 0.78));
  padding: 9px;
  position: relative;
  overflow: hidden;
}

.game-board::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 220, 170, 0.2);
  pointer-events: none;
}

.game-board::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06), transparent 24%),
    radial-gradient(circle at 50% -26%, rgba(255, 247, 220, 0.18), transparent 52%);
  mix-blend-mode: screen;
  opacity: 0.55;
}

.grid-head {
  margin-left: 116px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.grid-body {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.grid-side {
  display: grid;
  gap: 8px;
}

.criterion-chip {
  border: 1px solid rgba(173, 212, 190, 0.4);
  border-radius: 12px;
  padding: 8px;
  color: var(--text-mid);
  background: rgba(113, 145, 129, 0.16);
  text-align: center;
  font-weight: 700;
  cursor: pointer;
}

.criterion-chip:hover {
  background: rgba(122, 160, 141, 0.28);
}

.criterion-chip.is-active {
  border-color: rgba(160, 213, 184, 0.76);
  background: rgba(98, 164, 130, 0.4);
  color: #effaf4;
}

.matrix-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
  isolation: isolate;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(214, 241, 222, 0.58),
    inset 0 0 0 2px rgba(214, 241, 222, 0.18);
}

.matrix-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(86, 156, 103, 0.18), rgba(33, 72, 47, 0.34)),
    repeating-linear-gradient(
      90deg,
      rgba(84, 147, 99, 0.2) 0,
      rgba(84, 147, 99, 0.2) 14%,
      rgba(49, 106, 66, 0.3) 14%,
      rgba(49, 106, 66, 0.3) 28%
    );
  opacity: 0.72;
}

.matrix-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 14px;
  opacity: 0.74;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Crect x='1.2' y='1.2' width='97.6' height='97.6' fill='none' stroke='%23e9f8ed8a' stroke-width='1.2'/%3E%3Cline x1='50' y1='1.2' x2='50' y2='98.8' stroke='%23e9f8ed8a' stroke-width='1.2'/%3E%3Ccircle cx='50' cy='50' r='13.2' fill='none' stroke='%23e9f8ed8a' stroke-width='1.2'/%3E%3Crect x='1.2' y='24.8' width='18.2' height='50.4' fill='none' stroke='%23e9f8ed85' stroke-width='1.2'/%3E%3Crect x='80.6' y='24.8' width='18.2' height='50.4' fill='none' stroke='%23e9f8ed85' stroke-width='1.2'/%3E%3Crect x='1.2' y='38.6' width='7.8' height='22.8' fill='none' stroke='%23e9f8ed7f' stroke-width='1.1'/%3E%3Crect x='91' y='38.6' width='7.8' height='22.8' fill='none' stroke='%23e9f8ed7f' stroke-width='1.1'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.matrix-cell {
  border: 1px solid rgba(154, 188, 173, 0.33);
  border-radius: 13px;
  padding: 8px;
  min-height: 96px;
  aspect-ratio: 1;
  background: linear-gradient(160deg, rgba(24, 36, 46, 0.84), rgba(19, 28, 36, 0.82));
  color: var(--text-high);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
  position: relative;
  z-index: 1;
}

.matrix-cell:hover {
  transform: translateY(-1px);
}

.matrix-cell.is-active {
  border-color: rgba(164, 223, 190, 0.84);
  background: linear-gradient(160deg, #2b3f4a, #24363f);
}

.matrix-cell.is-valid {
  border-color: rgba(146, 243, 190, 0.8);
  background: linear-gradient(160deg, #27443d, #223932);
}

.matrix-cell.is-error {
  border-color: rgba(255, 138, 164, 0.92);
  animation: errorShake 210ms ease;
}

.matrix-cell.is-pop {
  animation: successPop 220ms ease;
}

.cell-index {
  display: block;
  color: var(--text-low);
  font-size: 0.7rem;
}

.cell-empty {
  margin-top: 16px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(164, 198, 183, 0.43);
  color: var(--text-mid);
}

.cell-rarity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 auto 5px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tier-legendary {
  background: rgba(255, 210, 110, 0.28);
  border: 1px solid rgba(255, 221, 141, 0.66);
  color: #ffe7b1;
}

.tier-epique {
  background: rgba(215, 152, 255, 0.24);
  border: 1px solid rgba(225, 177, 255, 0.62);
  color: #f3dcff;
}

.tier-rare {
  background: rgba(112, 184, 255, 0.22);
  border: 1px solid rgba(150, 204, 255, 0.6);
  color: #daefff;
}

.tier-uncommon {
  background: rgba(103, 223, 166, 0.2);
  border: 1px solid rgba(146, 233, 189, 0.56);
  color: #ddffef;
}

.cell-player {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.jersey,
.mini-jersey {
  display: inline-block;
  clip-path: polygon(10% 0%, 30% 0%, 38% 18%, 62% 18%, 70% 0%, 90% 0%, 100% 30%, 84% 42%, 84% 100%, 16% 100%, 16% 42%, 0% 30%);
  background: var(--jersey-color, #4ccb8b);
  border: 2px solid var(--jersey-trim, #f2fff8);
}

.jersey {
  width: 32px;
  height: 26px;
}

.mini-jersey {
  width: 28px;
  height: 23px;
}

.club-badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(236, 247, 242, 0.18);
  border: 1px solid rgba(182, 221, 202, 0.53);
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ebf5f1;
}

.club-badge {
  min-width: 30px;
  height: 30px;
  font-size: 0.62rem;
  padding: 0 7px;
}

.mini-badge {
  min-width: 28px;
  height: 28px;
  font-size: 0.58rem;
  padding: 0 6px;
}

.cell-name {
  display: block;
  margin-top: 5px;
  font-weight: 800;
  font-size: 0.87rem;
}

.cell-club {
  display: block;
  margin-top: 2px;
  color: var(--text-low);
  font-size: 0.68rem;
}

.status-rail {
  display: grid;
  gap: 9px;
  align-content: start;
}

.kpi-card,
.tip-card,
.feedback,
.ad-card {
  border-radius: 12px;
  border: 1px solid rgba(156, 189, 173, 0.36);
  background: rgba(66, 81, 90, 0.38);
  padding: 10px;
}

.kpi-card p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-low);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin-top: 5px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(9, 14, 19, 0.76);
  color: #f2f6f8;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.55rem;
  text-align: center;
}

.switch {
  margin-top: 7px;
  display: inline-block;
  position: relative;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.slider {
  width: 72px;
  height: 35px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(12, 17, 24, 0.84);
  border: 1px solid rgba(168, 203, 186, 0.45);
  padding: 3px;
  cursor: pointer;
}

.slider::before {
  content: "∞";
  width: 29px;
  height: 29px;
  border-radius: 999px;
  background: #f4fff8;
  color: #195537;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateX(0);
  transition: transform 120ms ease;
}

.switch input:checked + .slider::before {
  transform: translateX(35px);
}

.feedback {
  margin: 0;
}

.feedback-label {
  margin: 0 0 4px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-low);
  font-weight: 800;
}

.feedback.is-valid {
  border-color: rgba(134, 237, 185, 0.58);
  background: rgba(73, 146, 112, 0.34);
}

.feedback.is-error {
  border-color: rgba(255, 143, 170, 0.62);
  background: rgba(170, 74, 104, 0.28);
}

.feedback.is-info {
  border-color: rgba(171, 230, 201, 0.44);
  background: rgba(88, 108, 120, 0.32);
}

.tip-title {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 1rem;
}

.muted {
  margin: 0;
  color: var(--text-low);
}

.rail-actions {
  display: grid;
  gap: 8px;
}

.qa-demos {
  border-radius: 12px;
  border: 1px solid rgba(157, 191, 175, 0.33);
  background: rgba(61, 76, 84, 0.36);
  padding: 10px;
}

.qa-demos summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text-mid);
}

.demo-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn-primary {
  color: #0a1f16;
  background: linear-gradient(132deg, #8fe8ba, #58ca90);
}

.btn-subtle {
  color: var(--text-high);
  border-color: var(--line);
  background: rgba(128, 152, 164, 0.2);
}

.btn-mini {
  border-radius: 9px;
  color: var(--text-high);
  border-color: var(--line);
  background: rgba(120, 150, 136, 0.26);
  padding: 7px 10px;
}

.full {
  width: 100%;
}

.bottom-ad-card {
  margin-top: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(26, 35, 42, 0.78);
  padding: 10px;
}

.ad-slot-banner {
  margin-top: 8px;
  min-height: 94px;
}

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(30, 40, 48, 0.94), rgba(19, 27, 33, 0.9));
  box-shadow: var(--shadow);
  padding: 16px;
}

.result-card {
  border-color: rgba(192, 179, 142, 0.35);
  background: linear-gradient(165deg, rgba(36, 42, 50, 0.96), rgba(24, 29, 37, 0.92));
}

.leaderboard-card {
  border-color: rgba(158, 184, 173, 0.28);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-low);
}

.result-card .eyebrow {
  color: #cdbb92;
}

.result-card h2,
.leaderboard-card h2 {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

.result-stats {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-stats article {
  border-radius: 10px;
  border: 1px solid rgba(185, 176, 146, 0.34);
  background: rgba(82, 79, 70, 0.24);
  padding: 10px;
}

.result-stats p {
  margin: 0;
  color: #afafad;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 700;
}

.result-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
  font-family: "Bricolage Grotesque", sans-serif;
}

.share-card {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(190, 177, 137, 0.34);
  background: rgba(16, 20, 27, 0.76);
  padding: 12px;
}

.share-card pre {
  margin: 8px 0 10px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.35;
  font-family: "Manrope", sans-serif;
  color: #c8d2d9;
}

.pseudo-card {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(190, 177, 137, 0.34);
  background: rgba(16, 20, 27, 0.76);
  padding: 12px;
}

.pseudo-field {
  display: grid;
  gap: 6px;
}

.pseudo-field span {
  color: var(--text-mid);
  font-size: 0.82rem;
  font-weight: 700;
}

.pseudo-field input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(169, 202, 186, 0.42);
  background: #eff5f8;
  color: #1b2730;
  padding: 10px 12px;
  font-weight: 800;
  font-family: inherit;
}

#display-name-status {
  margin-top: 8px;
}

#display-name-status.is-success {
  color: #9fe0be;
}

#display-name-status.is-error {
  color: #ffb0c2;
}

.row-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.between {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(156, 182, 170, 0.24);
  padding: 9px 8px;
  text-align: left;
}

th {
  font-size: 0.76rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.overlay[hidden] {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(8, 11, 16, 0.84);
  cursor: pointer;
}

.overlay-panel {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 24px));
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, #28343c, #1a242a);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  padding: 18px;
}

.overlay-title {
  margin: 0;
  font-size: 1.35rem;
  font-family: "Bricolage Grotesque", sans-serif;
}

.overlay-subtitle {
  margin: 5px 0 0;
  color: var(--text-mid);
}

.search-field {
  margin-top: 10px;
  display: block;
}

.search-field input {
  width: 100%;
  border-radius: 11px;
  border: 1px solid rgba(169, 202, 186, 0.42);
  background: #eff5f8;
  color: #1b2730;
  padding: 12px;
  font-weight: 800;
  font-family: inherit;
}

.suggestions {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(161, 193, 177, 0.3);
  background: rgba(14, 20, 27, 0.62);
  overflow: hidden;
}

.suggestion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid rgba(159, 191, 177, 0.17);
}

.suggestion-row:last-child {
  border-bottom: none;
}

.suggestion-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.suggestion-name {
  font-weight: 700;
}

.suggestion-club {
  color: var(--text-low);
  font-size: 0.8rem;
}

.suggestion-btn {
  border: 1px solid rgba(164, 196, 179, 0.4);
  background: rgba(107, 163, 136, 0.24);
  color: var(--text-high);
  border-radius: 9px;
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 800;
  font-family: inherit;
}

.empty-suggestions {
  padding: 14px;
  color: var(--text-low);
}

.atlas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.atlas-head h2 {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(1.4rem, 4.5vw, 2.1rem);
}

.atlas-layout {
  display: grid;
  gap: 12px;
}

.atlas-nav {
  border-radius: 12px;
  border: 1px solid rgba(164, 196, 181, 0.28);
  background: rgba(12, 17, 23, 0.52);
  padding: 10px;
  max-height: 54vh;
  overflow: auto;
}

.atlas-group + .atlas-group {
  margin-top: 9px;
}

.atlas-group h4 {
  margin: 0 0 7px;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-low);
}

.atlas-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px;
  color: var(--text-mid);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}

.atlas-item.is-active {
  border-color: rgba(161, 213, 184, 0.6);
  background: rgba(94, 153, 123, 0.3);
  color: #edfff5;
}

.atlas-content {
  border-radius: 12px;
  border: 1px solid rgba(164, 196, 181, 0.28);
  background: rgba(12, 18, 23, 0.52);
  padding: 14px;
}

.atlas-content h3 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  font-family: "Bricolage Grotesque", sans-serif;
}

.atlas-content p {
  margin: 0 0 10px;
  color: var(--text-mid);
}

.atlas-source {
  margin: 0;
  color: #9fd8bb;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  z-index: 50;
  border-radius: 999px;
  border: 1px solid rgba(162, 196, 179, 0.38);
  background: rgba(15, 20, 27, 0.95);
  color: #e7eef2;
  padding: 9px 14px;
  font-weight: 800;
  transition: transform 150ms ease, opacity 150ms ease;
}

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

.btn:focus-visible,
.matrix-cell:focus-visible,
.criterion-chip:focus-visible,
.suggestion-btn:focus-visible,
.icon-btn:focus-visible,
input:focus-visible,
.atlas-item:focus-visible {
  outline: 3px solid rgba(167, 220, 191, 0.76);
  outline-offset: 2px;
}

@keyframes successPop {
  0% {
    transform: scale(0.9);
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes errorShake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

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

@media (min-width: 940px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) clamp(286px, 31%, 328px);
    align-items: start;
    justify-content: stretch;
  }

  .game-main {
    max-width: min(900px, 100%);
    width: 100%;
  }

  .atlas-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 1460px) {
  .page-layout {
    grid-template-columns: clamp(150px, 13vw, 196px) minmax(0, 1fr) clamp(150px, 13vw, 196px);
    width: min(1480px, calc(100% - 14px));
  }

  .floodlight-left {
    left: 34px;
  }

  .floodlight-right {
    right: 34px;
  }
}

@media (max-width: 980px) {
  .viewport-fit {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 0;
  }

  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(1080px, calc(100% - 16px));
    transform: none;
    margin: 10px auto 28px;
  }

  .ad-rail {
    display: none;
  }
}

@media (max-width: 919px) {
  .hero-lights {
    display: none;
  }

  .grid-head {
    margin-left: 86px;
  }

  .grid-body {
    grid-template-columns: 80px 1fr;
  }

  .criterion-chip {
    font-size: 0.72rem;
    padding: 6px;
  }

  .matrix-cell {
    min-height: 84px;
  }

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

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

@media (max-width: 680px) {
  .app-shell {
    padding: 9px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  .topbar-left {
    width: 100%;
  }

  .topbar-meta {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .topbar-puzzle-row {
    flex-wrap: wrap;
  }

  .brand-copy p {
    font-size: 0.67rem;
    letter-spacing: 0.03em;
  }

  .grid-head {
    margin-left: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .matrix-cell {
    min-height: 76px;
  }

  .kpi-card strong {
    font-size: 1.38rem;
  }

  .overlay-panel {
    padding: 14px;
  }

  .atlas-content h3 {
    font-size: 1.26rem;
  }

  .floodlight {
    display: none;
  }
}
