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

:root {
  --st-board: min(620px, calc(100vw - 2rem));
  --st-cell: calc(var(--st-board) / 7);
  --st-bg: #f6f8fb;
  --st-ink: #172033;
  --st-muted: #64748b;
  --st-panel: rgba(255,255,255,.95);
  --st-panel-2: #ffffff;
  --st-line: rgba(71,85,105,.16);
  --st-wood-1: #8a5a32;
  --st-wood-2: #3a2415;
  --st-hole: #2b1b10;
  --st-hole-soft: #c69a67;
  --st-peg-1: #14b8a6;
  --st-peg-2: #0f766e;
  --st-gold: #b7791f;
  --st-danger: #b91c1c;
  --st-shadow: 0 22px 54px rgba(15,23,42,.13);
}

[data-theme="dark"] {
  --st-bg: #0d1425;
  --st-ink: #f8fafc;
  --st-muted: #a8b3c7;
  --st-panel: rgba(15,23,42,.95);
  --st-panel-2: #101827;
  --st-line: rgba(226,232,240,.14);
  --st-wood-1: #704725;
  --st-wood-2: #17100a;
  --st-hole: #080b12;
  --st-hole-soft: #805c37;
  --st-peg-1: #2dd4bf;
  --st-peg-2: #0f766e;
  --st-gold: #f6c453;
  --st-shadow: 0 24px 64px rgba(0,0,0,.42);
}

body { background: #f1f5f9; }
[data-theme="dark"] body { background: #0d1425; }

.solo-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(20,184,166,.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(183,121,31,.1), transparent 30%),
    var(--st-bg);
}

#solo-app {
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(1rem,3vw,1.6rem) clamp(.65rem,3vw,1.2rem) 3rem;
  color: var(--st-ink);
  font-family: Inter, sans-serif;
  box-sizing: border-box;
}

.st-shell {
  background: linear-gradient(180deg, var(--st-panel), rgba(255,255,255,.86));
  border: 1px solid var(--st-line);
  border-radius: clamp(18px, 2.6vw, 28px);
  padding: clamp(.75rem, 2vw, 1.2rem);
  box-shadow: var(--st-shadow);
  overflow: hidden;
}

[data-theme="dark"] .st-shell {
  background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(11,18,32,.94));
}

.st-head {
  text-align: center;
  margin-bottom: clamp(.85rem, 2vw, 1.2rem);
}

.st-title {
  margin: 0;
  font: 900 clamp(1.9rem, 5vw, 3.35rem)/1 Cinzel, serif;
  letter-spacing: .04em;
  color: var(--st-gold);
  text-shadow: 0 10px 26px rgba(183,121,31,.22);
}

.st-sub {
  margin: .35rem 0 0;
  color: var(--st-muted);
  font-size: clamp(.75rem, 1.8vw, .9rem);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.st-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 320px);
  gap: clamp(.85rem, 2.4vw, 1.25rem);
  align-items: start;
}

.st-board-wrap {
  display: grid;
  place-items: center;
  padding: clamp(.75rem, 2vw, 1.1rem);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--st-wood-1), var(--st-wood-2));
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.06), 0 18px 36px rgba(0,0,0,.18);
  overflow: auto;
}

.st-board {
  width: var(--st-board);
  height: var(--st-board);
  max-width: calc(100vw - 2.4rem);
  max-height: calc(100vw - 2.4rem);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: clamp(4px, .9vw, 8px);
  padding: clamp(7px, 1vw, 10px);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.1), transparent 30%),
    rgba(43,27,16,.8);
  box-sizing: border-box;
  touch-action: manipulation;
}

.st-cell {
  border: 0;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 58%, var(--st-hole), #120b07 70%);
  box-shadow: inset 0 7px 14px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.08);
  cursor: pointer;
  position: relative;
  min-width: 0;
}

.st-cell.invalid {
  visibility: hidden;
  pointer-events: none;
}

.st-cell.peg::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 25%, rgba(255,255,255,.7), transparent 13%),
    linear-gradient(145deg, var(--st-peg-1), var(--st-peg-2));
  box-shadow: 0 10px 18px rgba(0,0,0,.32), inset 0 3px 0 rgba(255,255,255,.28);
  transition: transform .15s ease, box-shadow .15s ease;
}

.st-cell.peg:hover::after,
.st-cell.selected::after {
  transform: translateY(-3px);
  box-shadow: 0 14px 22px rgba(0,0,0,.36), 0 0 0 5px rgba(20,184,166,.18), inset 0 3px 0 rgba(255,255,255,.32);
}

.st-cell.selected {
  outline: 3px solid rgba(246,196,83,.72);
  outline-offset: -3px;
}

.st-cell.move::before {
  content: "";
  position: absolute;
  inset: 31%;
  border-radius: 999px;
  background: var(--st-gold);
  box-shadow: 0 0 0 7px rgba(246,196,83,.18);
}

.st-panel {
  background: var(--st-panel-2);
  border: 1px solid var(--st-line);
  border-radius: 14px;
  padding: .85rem;
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
}

.st-panel + .st-panel { margin-top: .75rem; }

.st-pt {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--st-peg-2);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: .65rem;
}

[data-theme="dark"] .st-pt { color: var(--st-peg-1); }

.st-status {
  min-height: 3.1rem;
  display: flex;
  align-items: center;
  padding: .7rem .78rem;
  border-radius: 12px;
  background: rgba(20,184,166,.1);
  color: var(--st-ink);
  font-weight: 700;
  line-height: 1.35;
}

.st-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.st-chip {
  min-height: 62px;
  padding: .55rem;
  border-radius: 12px;
  background: rgba(100,116,139,.09);
  border: 1px solid var(--st-line);
  display: grid;
  align-content: center;
  text-align: center;
}

.st-chip span {
  font-size: .62rem;
  color: var(--st-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.st-chip strong {
  font: 900 1.35rem/1.1 Cinzel, serif;
  color: var(--st-gold);
}

.st-actions {
  display: grid;
  gap: .5rem;
}

.st-btn {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--st-line);
  background: rgba(100,116,139,.1);
  color: var(--st-ink);
  font: 800 .76rem/1 Inter, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  padding: 0 .75rem;
}

.st-btn:hover { border-color: var(--st-peg-2); color: var(--st-peg-2); }
.st-btn.primary { background: linear-gradient(135deg, var(--st-peg-1), var(--st-peg-2)); border-color: transparent; color: #fff; }
.st-btn.warn { color: var(--st-danger); }

.st-help {
  margin: 0;
  color: var(--st-muted);
  font-size: .82rem;
  line-height: 1.5;
}

.st-result[hidden] { display: none; }
.st-result {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2,6,23,.72);
  backdrop-filter: blur(8px);
}

.st-result-box {
  width: min(420px, 100%);
  text-align: center;
  background: var(--st-panel-2);
  color: var(--st-ink);
  border: 1px solid var(--st-line);
  border-radius: 18px;
  padding: clamp(1.1rem, 4vw, 1.6rem);
  box-shadow: 0 28px 70px rgba(0,0,0,.36);
  animation: stPop .18s ease-out;
}

.st-result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto .7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(20,184,166,.14);
  color: var(--st-peg-2);
  font-size: 1.65rem;
}

.st-result-box h2 {
  margin: 0;
  font: 900 clamp(1.45rem, 5vw, 2.1rem)/1.1 Cinzel, serif;
  color: var(--st-gold);
}

.st-result-box p {
  margin: .55rem 0 1rem;
  color: var(--st-muted);
  line-height: 1.45;
}

@keyframes stPop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 860px) {
  .st-layout { grid-template-columns: 1fr; }
  aside { display: grid; grid-template-columns: 1fr; gap: .55rem; }
  .st-panel + .st-panel { margin-top: 0; }
}

@media (max-width: 560px) {
  :root { --st-board: min(92vw, 430px); }
  #solo-app { padding-left: .5rem; padding-right: .5rem; }
  .st-shell { padding: .65rem; border-radius: 16px; }
  .st-board-wrap { padding: .5rem; border-radius: 15px; }
  .st-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .st-chip { min-height: 54px; padding: .42rem .22rem; }
  .st-chip span { font-size: .52rem; }
  .st-chip strong { font-size: 1.02rem; }
  .st-status { min-height: 2.7rem; font-size: .86rem; }
  .st-btn { min-height: 39px; font-size: .66rem; letter-spacing: .04em; }
}

@media (max-width: 400px) {
  :root { --st-board: min(91vw, 350px); }
  .st-grid { grid-template-columns: 1fr 1fr; }
  .st-help { font-size: .76rem; }
}
