:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #ece8df;
  background: #121310;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 5%, rgba(117, 140, 92, 0.18), transparent 32rem),
    linear-gradient(145deg, #171914, #0e0f0d 70%);
}

button, select { font: inherit; }

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

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #a8b39b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.04em; }
h2 { margin-bottom: 16px; font-size: .88rem; letter-spacing: .06em; text-transform: uppercase; color: #c3cbb9; }

.device {
  padding: 8px 12px;
  border: 1px solid #393d34;
  border-radius: 999px;
  color: #abb2a2;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 720px) minmax(240px, 300px);
  gap: 28px;
  align-items: start;
}

#board {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06);
}

.status-card {
  display: flex;
  gap: 13px;
  align-items: center;
  min-height: 74px;
  margin-top: 14px;
  padding: 15px 18px;
  background: #1b1d18;
  border: 1px solid #30332c;
  border-radius: 9px;
}

.status-card strong { display: block; margin-bottom: 4px; }
.status-card p { margin: 0; color: #999f92; font-size: .86rem; }
.status-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #8eae69; box-shadow: 0 0 14px #8eae69; }
.status-dot.finished { background: #c9a565; box-shadow: 0 0 14px #c9a565; }

.controls {
  display: grid;
  gap: 14px;
}

.controls section, .error {
  padding: 20px;
  background: rgba(29,31,26,.9);
  border: 1px solid #353830;
  border-radius: 10px;
}

label { display: block; margin-bottom: 7px; color: #969e8e; font-size: .78rem; font-weight: 650; }

select, button {
  width: 100%;
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid #454a3f;
}

select {
  margin-bottom: 10px;
  padding: 0 11px;
  color: #e9e7df;
  background: #141611;
  text-overflow: ellipsis;
}

button { padding: 0 14px; cursor: pointer; font-weight: 720; transition: transform .12s, filter .12s; }
button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: .55; }
.primary { color: #10120e; background: #a8c283; border-color: #b9d193; }
.secondary { color: #e5e3dc; background: #30342c; }
.hint { margin: 10px 0 0; color: #80877a; font-size: .76rem; line-height: 1.45; }
.evaluation output { display: block; color: #d7e6c6; font: 700 2rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.error { margin: 0; color: #f0aaa1; background: rgba(79,34,31,.55); border-color: #70443f; font-size: .85rem; line-height: 1.45; }

dialog {
  color: #ece8df;
  background: #20221d;
  border: 1px solid #505549;
  border-radius: 12px;
  box-shadow: 0 25px 80px #000;
}
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
dialog h2 { text-align: center; }
.promotion-pieces { display: flex; gap: 8px; }
.promotion-pieces button { width: 58px; height: 58px; padding: 0; color: #f2f0e9; background: #33372f; font-size: 2.1rem; }

@media (max-width: 820px) {
  .shell { width: min(680px, calc(100% - 20px)); padding-top: 20px; }
  .masthead { align-items: start; }
  .game-layout { grid-template-columns: 1fr; gap: 18px; }
  .controls { grid-template-columns: repeat(2, 1fr); }
  .evaluation, .error { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .device { display: none; }
  .controls { grid-template-columns: 1fr; }
  .evaluation, .error { grid-column: auto; }
  .status-card { padding: 12px; }
}
