:root {
  color-scheme: dark;
  --page: #17001f;
  --nav: #15001e;
  --nav-2: #3a0048;
  --panel: #22002f;
  --panel-2: #180022;
  --ink: #fffaf5;
  --muted: #d5c6dd;
  --line: rgba(255, 250, 245, 0.2);
  --tile: #fff6eb;
  --tile-ink: #21002d;
  --accent: #9cff00;
  --accent-2: #6f00ff;
  --brand-red: #ef0000;
  --brand-green: #04c853;
  --brand-maroon: #85000a;
  --red: #ff1744;
  --green: #00d05a;
  --yellow: #9cff00;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(780px 560px at -12% 6%, rgba(111, 0, 255, 0.95), transparent 62%),
    radial-gradient(760px 520px at 52% -18%, rgba(133, 0, 10, 0.9), transparent 58%),
    radial-gradient(860px 620px at 47% 34%, rgba(239, 0, 0, 0.82), transparent 58%),
    radial-gradient(620px 500px at 108% 9%, rgba(4, 200, 83, 0.95), rgba(156, 255, 0, 0.82) 46%, transparent 62%),
    linear-gradient(135deg, #180020 0%, #260034 50%, #100018 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

.site-header {
  background: rgba(19, 0, 28, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  min-height: 62px;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 900;
}

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  image-rendering: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: linear-gradient(135deg, var(--brand-red), var(--accent-2));
  color: #ffffff;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 128px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #ff2b18;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(46px, 8vw, 78px);
  line-height: 0.95;
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.58);
}

.status-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.58);
}

.hero-actions {
  padding-bottom: 10px;
}

.ghost-button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 245, 0.1);
  color: var(--ink);
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--accent);
  background: rgba(156, 255, 0, 0.16);
  color: #ffffff;
}

.game-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(34, 0, 47, 0.94), rgba(18, 0, 26, 0.94)),
    radial-gradient(circle at top right, rgba(156, 255, 0, 0.18), transparent 44%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.game-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.game-topline h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.15;
}

.helper-text {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 8px;
  min-width: 250px;
}

.stat-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 245, 0.08);
  padding: 10px 12px;
}

.stat-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stat-pill strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
  line-height: 1;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding: 22px 24px;
  background: rgba(19, 0, 28, 0.46);
  border-bottom: 1px solid var(--line);
}

.guess-form {
  display: grid;
  gap: 9px;
}

.guess-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.autocomplete {
  position: relative;
  min-width: 0;
}

.input-row input {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6eb;
  padding: 0 14px;
  color: var(--tile-ink);
  outline: none;
}

.input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(156, 255, 0, 0.28);
}

.input-row button {
  height: 50px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-red), #ff3a00);
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.input-row button:hover {
  background: linear-gradient(135deg, #ff2500, var(--accent-2));
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 20;
  display: none;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #250034;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

.suggestions.is-open {
  display: grid;
}

.suggestion-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item.is-active {
  background: linear-gradient(90deg, rgba(239, 0, 0, 0.34), rgba(111, 0, 255, 0.28));
}

.suggestion-item img {
  display: block;
  max-width: 34px;
  max-height: 34px;
  object-fit: contain;
}

.suggestion-fallback-logo {
  align-items: center;
  background: rgba(156, 255, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  flex: 0 0 34px;
  font-size: 0.78rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.suggestion-item strong,
.suggestion-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-item strong {
  font-size: 14px;
}

.suggestion-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.suggestion-empty {
  padding: 14px;
  color: var(--muted);
  font-weight: 800;
}

.input-row button:disabled,
.input-row input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 250px;
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 99px;
}

.match-dot {
  background: var(--green);
}

.close-dot {
  background: var(--yellow);
}

.miss-dot {
  background: var(--red);
}

.guess-board {
  display: grid;
  gap: 0;
  background: var(--panel-2);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  font-weight: 800;
}

.attempt-card {
  padding: 18px 24px 22px;
  border-bottom: 1px solid var(--line);
}

.attempt-header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.attempt-header span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 1000;
  text-transform: uppercase;
}

.attempt-header strong {
  font-size: 16px;
  line-height: 1.1;
}

.clue-grid {
  display: grid;
  grid-template-columns: repeat(var(--clue-columns, 7), minmax(84px, 1fr));
  gap: 14px;
}

.clue {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  border: 2px solid var(--red);
  border-radius: 18px;
  background: var(--tile);
  color: var(--tile-ink);
  box-shadow: inset 0 -5px 0 rgba(33, 0, 45, 0.12);
  overflow: hidden;
}

.tile.match {
  border-color: var(--green);
}

.tile.close {
  border-color: var(--yellow);
}

.tile.miss {
  border-color: var(--red);
}

.tile-logo {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.tile-logo[hidden] {
  display: none;
}

.tile-value {
  padding: 0 6px;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 1000;
  line-height: 1.12;
  text-align: center;
}

.tile-image-fallback {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
}

.tile-image-fallback[hidden] {
  display: none;
}

.view-section[hidden] {
  display: none;
}

.data-view {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(34, 0, 47, 0.94), rgba(18, 0, 26, 0.94)),
    radial-gradient(circle at top right, rgba(156, 255, 0, 0.14), transparent 42%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.view-header h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.view-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.view-search {
  width: min(420px, 100%);
}

.view-search input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6eb;
  color: var(--tile-ink);
  padding: 0 13px;
  outline: none;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
  padding: 20px;
}

.players-grid > .empty-state {
  grid-column: 1 / -1;
}

.player-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 0, 29, 0.56);
  padding: 14px;
}

.player-card-rank {
  width: fit-content;
  border-radius: 999px;
  background: rgba(156, 255, 0, 0.16);
  color: var(--accent);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 1000;
}

.player-card-main {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.player-card-photo {
  display: block;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 245, 0.08);
  object-fit: cover;
}

.player-card-photo-fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 20px;
  font-weight: 1000;
}

.player-card h3 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-card p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-card-meta {
  display: grid;
  gap: 8px;
}

.player-card-meta span {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.player-card-meta img {
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
}

.inline-fallback-logo,
.ranking-fallback-logo {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 250, 245, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.inline-fallback-logo {
  width: 28px;
  height: 28px;
}

.player-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.player-card-stats strong {
  color: #ffffff;
}

.player-card-stats span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 20px;
  padding: 20px;
}

.leaderboard-layout h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.ranking-list {
  display: grid;
  gap: 8px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 34px 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 0, 29, 0.56);
  padding: 10px;
}

.ranking-item strong {
  color: var(--accent);
  text-align: center;
}

.ranking-item img {
  max-width: 36px;
  max-height: 34px;
  object-fit: contain;
}

.ranking-fallback-logo {
  width: 36px;
  height: 34px;
}

.ranking-item span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-item small {
  color: var(--muted);
  font-weight: 1000;
}

.tile-label {
  min-height: 34px;
  color: var(--red);
  font-size: 13px;
  font-weight: 1000;
  line-height: 1.1;
  text-align: center;
}

.tile.match + .tile-label {
  color: var(--green);
}

.tile.close + .tile-label {
  color: var(--yellow);
}

.tile-hint {
  display: block;
  margin-top: 4px;
  color: currentColor;
  font-size: 20px;
  line-height: 0.8;
}

@media (max-width: 900px) {
  .clue-grid {
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    width: min(100% - 20px, 1120px);
  }

  .site-nav {
    display: none;
  }

  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 20px 0 32px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    gap: 14px;
  }

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

  .game-topline,
  .play-area {
    display: grid;
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .stat-strip {
    min-width: 0;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .legend {
    justify-content: flex-start;
    min-width: 0;
    flex-wrap: wrap;
  }

  .attempt-card {
    padding: 16px 14px 20px;
  }

  .clue-grid {
    grid-template-columns: repeat(3, minmax(78px, 1fr));
    gap: 12px 8px;
  }

  .tile {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }

  .tile-logo {
    width: 54px;
    height: 54px;
  }

  .view-header,
  .leaderboard-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .players-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}
