:root {
  --bg-start: #0b1020;
  --bg-mid: #0f172a;
  --bg-end: #0a0f1d;
  --bg-glow-1: rgba(125, 211, 252, 0.16);
  --bg-glow-2: rgba(99, 102, 241, 0.12);
  --bg-glow-3: rgba(34, 197, 94, 0.08);
  --panel: rgba(10, 14, 28, 0.88);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #edf4ff;
  --muted: #a8b7d3;
  --tile: #18233b;
  --tile-border: rgba(255, 255, 255, 0.08);
  --gray: #4b5563;
  --yellow: #b59f3b;
  --green: #538d4e;
  --accent: #7dd3fc;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

:root,
body[data-mode="dark"] {
  color-scheme: dark;
}

body[data-mode="light"] {
  color-scheme: light;
  --bg-start: #f9fcff;
  --bg-mid: #eff4fb;
  --bg-end: #e7eef8;
  --bg-glow-1: rgba(2, 132, 199, 0.12);
  --bg-glow-2: rgba(125, 211, 252, 0.18);
  --bg-glow-3: rgba(15, 23, 42, 0.04);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(15, 23, 42, 0.08);
  --text: #223043;
  --muted: #5f6f84;
  --tile: #e6edf7;
  --tile-border: rgba(15, 23, 42, 0.08);
  --gray: #94a3b8;
  --yellow: #d6b23f;
  --green: #7ab66d;
  --accent: #0284c7;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

body[data-mode="light"] .card {
  background: rgba(255, 255, 255, 0.94);
}

body[data-mode="light"] .hero,
body[data-mode="light"] .solver-panel,
body[data-mode="light"] .results-panel,
body[data-mode="light"] .footer {
  border-color: rgba(15, 23, 42, 0.09);
}

body[data-palette="classic"] {
  --accent: #7dd3fc;
  --gray: #4b5563;
  --yellow: #b59f3b;
  --green: #538d4e;
  --bg-glow-1: rgba(125, 211, 252, 0.16);
  --bg-glow-2: rgba(99, 102, 241, 0.12);
  --bg-glow-3: rgba(34, 197, 94, 0.08);
}

body[data-mode="dark"][data-palette="classic"] {
  --bg-start: #0b1020;
  --bg-mid: #0f172a;
  --bg-end: #0a0f1d;
  --panel: rgba(10, 14, 28, 0.88);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #edf4ff;
  --muted: #a8b7d3;
  --tile: #18233b;
  --tile-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

body[data-mode="light"][data-palette="classic"] {
  --bg-start: #f9fcff;
  --bg-mid: #eff4fb;
  --bg-end: #e7eef8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(15, 23, 42, 0.08);
  --text: #223043;
  --muted: #5f6f84;
  --tile: #e6edf7;
  --tile-border: rgba(15, 23, 42, 0.08);
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

body[data-palette="solarized"] {
  --accent: #268bd2;
  --gray: #657b83;
  --yellow: #b58900;
  --green: #859900;
  --bg-glow-1: rgba(38, 139, 210, 0.16);
  --bg-glow-2: rgba(181, 137, 0, 0.12);
  --bg-glow-3: rgba(133, 153, 0, 0.08);
}

body[data-mode="dark"][data-palette="solarized"] {
  --bg-start: #0a1b2a;
  --bg-mid: #102437;
  --bg-end: #09131d;
  --panel: rgba(12, 23, 36, 0.92);
  --panel-border: rgba(38, 139, 210, 0.18);
  --text: #f4efe4;
  --muted: #b3c0c0;
  --tile: #182838;
  --tile-border: rgba(38, 139, 210, 0.14);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.4);
}

body[data-mode="light"][data-palette="solarized"] {
  --bg-start: #f7f2e8;
  --bg-mid: #edf0e2;
  --bg-end: #dfe9e2;
  --panel: rgba(255, 249, 241, 0.94);
  --panel-border: rgba(38, 139, 210, 0.14);
  --text: #24313d;
  --muted: #5b6a70;
  --tile: #eef3eb;
  --tile-border: rgba(38, 139, 210, 0.12);
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

body[data-palette="pastel"] {
  --accent: #8b5cf6;
  --gray: #94a3b8;
  --yellow: #f6c177;
  --green: #7dd3a7;
  --bg-glow-1: rgba(139, 92, 246, 0.14);
  --bg-glow-2: rgba(125, 211, 252, 0.16);
  --bg-glow-3: rgba(125, 211, 167, 0.1);
}

body[data-mode="dark"][data-palette="pastel"] {
  --bg-start: #18132c;
  --bg-mid: #141b33;
  --bg-end: #0b1020;
  --panel: rgba(21, 25, 46, 0.92);
  --panel-border: rgba(139, 92, 246, 0.2);
  --text: #f5f1ff;
  --muted: #c7cdea;
  --tile: #202845;
  --tile-border: rgba(139, 92, 246, 0.14);
  --shadow: 0 24px 70px rgba(9, 11, 25, 0.42);
}

body[data-mode="light"][data-palette="pastel"] {
  --bg-start: #fff5fb;
  --bg-mid: #f4f7ff;
  --bg-end: #eefcf6;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(139, 92, 246, 0.12);
  --text: #243244;
  --muted: #66738b;
  --tile: #f2f4fb;
  --tile-border: rgba(139, 92, 246, 0.1);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

body[data-palette="monochrome"] {
  --accent: #111827;
  --gray: #6b7280;
  --yellow: #9ca3af;
  --green: #374151;
  --bg-glow-1: rgba(17, 24, 39, 0.1);
  --bg-glow-2: rgba(107, 114, 128, 0.1);
  --bg-glow-3: rgba(156, 163, 175, 0.08);
}

body[data-mode="dark"][data-palette="monochrome"] {
  --bg-start: #050505;
  --bg-mid: #101010;
  --bg-end: #1a1a1a;
  --panel: rgba(14, 14, 14, 0.94);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f7f7f7;
  --muted: #c1c1c1;
  --tile: #1a1a1a;
  --tile-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
}

body[data-mode="light"][data-palette="monochrome"] {
  --bg-start: #fbfbfb;
  --bg-mid: #f1f1f1;
  --bg-end: #e4e4e4;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(17, 24, 39, 0.1);
  --text: #171717;
  --muted: #5b5b5b;
  --tile: #eeeeee;
  --tile-border: rgba(17, 24, 39, 0.09);
  --shadow: 0 16px 38px rgba(17, 24, 39, 0.08);
}

body[data-palette="gradient"] {
  --accent: #8b5cf6;
  --gray: #51577b;
  --yellow: #c6a23f;
  --green: #59a96a;
  --bg-glow-1: rgba(139, 92, 246, 0.22);
  --bg-glow-2: rgba(56, 189, 248, 0.2);
  --bg-glow-3: rgba(16, 185, 129, 0.16);
}

body[data-palette="neon"] {
  --accent: #19f7ff;
  --gray: #4b5563;
  --yellow: #f8ff3f;
  --green: #4dff7a;
  --bg-glow-1: rgba(25, 247, 255, 0.22);
  --bg-glow-2: rgba(248, 255, 63, 0.14);
  --bg-glow-3: rgba(77, 255, 122, 0.16);
}

body[data-mode="dark"][data-palette="neon"] {
  --bg-start: #050816;
  --bg-mid: #090f22;
  --bg-end: #03050b;
  --panel: rgba(8, 12, 26, 0.94);
  --panel-border: rgba(25, 247, 255, 0.26);
  --text: #f4fffe;
  --muted: #b4cdd1;
  --tile: #101a33;
  --tile-border: rgba(25, 247, 255, 0.16);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.48);
}

body[data-mode="light"][data-palette="neon"] {
  --bg-start: #edfefe;
  --bg-mid: #eef3ff;
  --bg-end: #f9fff0;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-border: rgba(25, 247, 255, 0.18);
  --text: #1b2730;
  --muted: #52626b;
  --tile: #ecf5ff;
  --tile-border: rgba(25, 247, 255, 0.14);
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

body[data-mode="dark"][data-palette="gradient"] {
  --bg-start: #130a2b;
  --bg-mid: #0b1e3e;
  --bg-end: #08131f;
  --panel: rgba(16, 19, 34, 0.92);
  --panel-border: rgba(139, 92, 246, 0.22);
  --text: #f6f7ff;
  --muted: #c6cee9;
  --tile: #18233f;
  --tile-border: rgba(139, 92, 246, 0.14);
  --shadow: 0 24px 72px rgba(9, 11, 25, 0.44);
}

body[data-mode="light"][data-palette="gradient"] {
  --bg-start: #fff4fb;
  --bg-mid: #f2f8ff;
  --bg-end: #edfdf8;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-border: rgba(139, 92, 246, 0.12);
  --text: #233042;
  --muted: #5e6c83;
  --tile: #edf2fb;
  --tile-border: rgba(139, 92, 246, 0.1);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, var(--bg-glow-1), transparent 34%),
    radial-gradient(circle at 85% 8%, var(--bg-glow-2), transparent 22%),
    radial-gradient(circle at 18% 88%, var(--bg-glow-3), transparent 28%),
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 55%, var(--bg-end) 100%);
  color: var(--text);
}

body {
  padding: 32px 18px 40px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

.card {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px 24px 18px;
  text-align: left;
  margin-bottom: 10px;
}

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

h1 {
  font-size: clamp(2rem, 3.7vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.hero-title {
  color: var(--accent);
  text-shadow:
    0 0 10px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 22px color-mix(in srgb, var(--accent) 28%, transparent);
}

.lede {
  margin: 12px 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.hero-title-row h1 {
  flex: 1 1 auto;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.status-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.status-pill {
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(125, 211, 252, 0.15);
  border: 1px solid rgba(125, 211, 252, 0.22);
  color: var(--text);
  font-size: 0.88rem;
}

.status-pill.subtle {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.16);
  color: var(--muted);
}

.status-pill#dictionaryStatus[data-state="loading"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--text);
}

.status-pill#dictionaryStatus[data-state="ready"] {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  border-color: color-mix(in srgb, var(--green) 32%, transparent);
  color: var(--text);
}

.status-pill#dictionaryStatus[data-state="error"] {
  background: color-mix(in srgb, #ef4444 18%, transparent);
  border-color: color-mix(in srgb, #ef4444 34%, transparent);
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.solver-panel,
.results-panel {
  padding: 22px;
}

.panel-header,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-header p,
.section-title p {
  color: var(--muted);
  max-width: 42ch;
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 4px;
}

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

.theme-picker {
  display: inline-flex;
  align-items: center;
}

.theme-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--panel-border));
  border-radius: 999px;
  padding: 5px 26px 5px 9px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
  font: inherit;
  width: 88px;
  min-width: 88px;
  max-width: 96px;
  height: 32px;
  font-size: 0.78rem;
  line-height: 1;
}

.theme-select:focus {
  outline: 2px solid rgba(125, 211, 252, 0.5);
  outline-offset: 2px;
}

.mode-toggle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  flex: 0 0 auto;
  overflow: hidden;
}

.primary,
.ghost {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.primary {
  color: #04212d;
  background: linear-gradient(180deg, #9be7ff, #66d0f2);
  font-weight: 800;
}

.ghost {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.ghost.mode-toggle {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--panel-border));
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

body[data-mode="light"] .ghost.mode-toggle {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 24%, var(--panel-border));
}

.primary:hover,
.ghost:hover,
.tile:hover {
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

body[data-mode="light"] .ghost {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.12);
}

body[data-mode="light"] .theme-select,
body[data-mode="light"] .guess-input,
body[data-mode="light"] .tile,
body[data-mode="light"] .suggestion-tab {
  background: rgba(255, 255, 255, 0.94);
}

body[data-mode="light"] .guess-input {
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

body[data-mode="light"] .tile {
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

body[data-mode="light"] .tile.state-gray {
  background: #d9e3ef;
  border-color: rgba(15, 23, 42, 0.1);
  color: #172033;
}

body[data-mode="light"] .tile.state-yellow {
  background: #f1dc7d;
  border-color: rgba(15, 23, 42, 0.08);
  color: #172033;
}

body[data-mode="light"] .tile.state-green {
  background: #8ed69a;
  border-color: rgba(15, 23, 42, 0.08);
  color: #172033;
}

body[data-mode="light"] .tile-swatch {
  border-color: rgba(15, 23, 42, 0.12);
}

body[data-mode="light"] .tile-swatch.state-gray {
  background: #aebacc;
}

body[data-mode="light"] .tile-swatch.state-yellow {
  background: #e8c84a;
}

body[data-mode="light"] .tile-swatch.state-green {
  background: #72c67f;
}

body[data-mode="light"] .tile-palette .tile-swatch:not(.state-gray):not(.state-yellow):not(.state-green) {
  background: rgba(15, 23, 42, 0.08);
}

body[data-mode="light"] .suggestion-tab {
  border-color: rgba(2, 132, 199, 0.28);
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.1) inset;
}

body[data-mode="light"] .suggestion-tab-word {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.12);
  color: #172033;
}

body[data-mode="light"] .suggestion-tab-word.is-primary {
  background: color-mix(in srgb, var(--accent) 12%, rgba(255, 255, 255, 0.95));
  border-color: color-mix(in srgb, var(--accent) 30%, rgba(15, 23, 42, 0.12));
}

.guess-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 10px;
  margin: 14px 0 14px;
}

.tile-cell {
  display: grid;
  gap: 6px;
}

.tile-palette {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.tile {
  aspect-ratio: 1;
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 35, 59, 0.98), rgba(17, 24, 42, 0.98));
  color: var(--text);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  user-select: none;
}

.tile-swatch {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  width: 18px;
  height: 8px;
  padding: 0;
  color: transparent;
  font-size: 0;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.tile-swatch:hover {
  transform: translateY(-1px);
}

.tile-swatch.is-active {
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.6);
}

.tile-swatch:disabled {
  opacity: 0.25;
  transform: none;
  cursor: not-allowed;
}

.guess-input-wrap {
  margin-top: 14px;
}

.guess-input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guess-input::placeholder {
  color: rgba(159, 176, 204, 0.72);
  text-transform: none;
  letter-spacing: 0;
}

.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;
}

.tile.state-gray {
  background: var(--gray);
  border-color: rgba(255, 255, 255, 0.05);
}

.tile.state-yellow {
  background: var(--yellow);
  border-color: rgba(255, 255, 255, 0.08);
}

.tile.state-green {
  background: var(--green);
  border-color: rgba(255, 255, 255, 0.08);
}

.tile:disabled {
  opacity: 1;
}

.tile-swatch.state-gray {
  background: var(--gray);
}

.tile-swatch.state-yellow {
  background: var(--yellow);
}

.tile-swatch.state-green {
  background: var(--green);
}

.hint-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.history {
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding-top: 18px;
}

.suggestion-hero {
  margin-top: 14px;
}

.suggestion-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12) inset;
  color: inherit;
  text-align: left;
}

.suggestion-tab.is-final {
  border-color: rgba(83, 141, 78, 0.75);
  box-shadow: 0 0 0 1px rgba(83, 141, 78, 0.18) inset;
  background: rgba(14, 38, 23, 0.9);
}

.suggestion-tab-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.suggestion-tab-words {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.suggestion-tab-word {
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.suggestion-tab-word.is-primary {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--panel-border));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.suggestion-tab-empty {
  font-size: clamp(0.98rem, 2vw, 1.3rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  word-break: break-word;
}

.suggestion-tab.is-final .suggestion-tab-label,
.suggestion-tab.is-final .suggestion-tab-word,
.suggestion-tab.is-final .suggestion-tab-empty {
  color: var(--green);
}

.suggestion-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.11);
  color: var(--text);
  text-align: left;
}

.suggestion-item:hover {
  transform: translateY(-1px);
}

.ghost.is-active {
  border-color: rgba(125, 211, 252, 0.5);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.16) inset;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.history-entry {
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 12px;
}

.history-feedback {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-feedback {
  margin-top: 0;
}

.mini-tile {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  background: var(--tile);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-tile.state-gray {
  background: var(--gray);
}

.mini-tile.state-yellow {
  background: var(--yellow);
}

.mini-tile.state-green {
  background: var(--green);
}

.candidates-wrap {
  margin: 18px 0 12px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(125, 211, 252, 0.14);
}

.count-figure {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.count-note {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.candidate-list,
.suggestion-list {
  display: grid;
  gap: 8px;
}

.candidate-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.candidate-list .candidate-word,
.suggestion-item {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.11);
}

.candidate-word {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.92rem;
}

.candidate-word .score {
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

.suggestion-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.suggestion-word {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.suggestion-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 20px 14px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  line-height: 1.6;
}

.footer {
  margin-top: 18px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.footer-copy {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--panel-border));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.footer-link:hover {
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    padding: 16px 12px 26px;
  }

  .hero,
  .solver-panel,
  .results-panel {
    padding: 18px;
  }

  .panel-header,
  .section-title {
    flex-direction: column;
  }

  .hero-title-row {
    align-items: stretch;
  }

  .hero-actions {
    margin-left: 0;
    justify-content: flex-start;
  }

  .theme-select {
    width: 84px;
    min-width: 84px;
    max-width: 92px;
    height: 30px;
    padding: 4px 24px 4px 9px;
    font-size: 0.74rem;
  }

  .mode-toggle {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 0.82rem;
  }

  .actions {
    width: 100%;
    justify-content: stretch;
  }

  .actions > button {
    flex: 1;
  }

  .guess-grid {
    gap: 8px;
  }

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

  .footer-link {
    width: 100%;
  }
}
