:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #203047;
  --muted: #65748b;
  --line: #dbe3ef;

  --blue-soft: #dcecff;
  --blue-deep: #3f7fd8;

  --red-soft: #ffe0e0;
  --red-deep: #d96565;

  --gold-soft: #fff2c9;
  --gold-deep: #c9951a;

  --green-soft: #def7e7;
  --green-deep: #4b9d6d;

  --purple-soft: #ebe4ff;
  --purple-deep: #7c63c9;

  --board-cell: 42px;
  --radius: 18px;
  --shadow: 0 10px 28px rgba(33, 55, 92, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, #fbfdff 0%, #f6f7fb 55%, #f0f3f9 100%);
}

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

.site-header,
.site-footer {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.site-footer {
  border-top: 1px solid var(--line);
  border-bottom: none;
  margin-top: 24px;
}

.site-header-inner,
.page-wrap,
.site-footer {
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
}

.site-header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.top-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--muted);
  font-weight: 600;
}

.page-wrap {
  padding: 22px 0 28px;
}

.hero-card,
.panel-card,
.board-shell,
.rack-area {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 20px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-copy h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 2vw, 2.4rem);
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-deep);
  font-weight: 800;
  font-size: 1rem;
}

.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.score-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfcff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-box.active {
  outline: 2px solid #bfcfff;
  background: #f4f7ff;
}

.score-label {
  color: var(--muted);
  font-weight: 700;
}

.score-value {
  font-size: 1.8rem;
  font-weight: 800;
}

.game-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  padding: 18px;
}

.panel-card h2 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

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

.action-btn {
  border: none;
  border-radius: 14px;
  min-height: 46px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--blue-deep);
  color: #fff;
}

.secondary {
  background: #edf3fb;
  color: var(--ink);
}

.secondary.active-mode {
  background: #dfe9ff;
  color: #244d9b;
}

.danger {
  background: #fbe6e6;
  color: #9c3636;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid #edf1f7;
}

.meta-row:first-of-type {
  border-top: none;
}

.meta-row span {
  color: var(--muted);
}

.validated-words {
  min-height: 48px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}

.board-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.board-shell {
  padding: 14px;
  overflow: auto;
}

.board {
  display: grid;
  grid-template-columns: repeat(15, var(--board-cell));
  grid-template-rows: repeat(15, var(--board-cell));
  gap: 4px;
  width: max-content;
  margin: 0 auto;
}

.cell {
  width: var(--board-cell);
  height: var(--board-cell);
  border-radius: 10px;
  border: 1px solid #d8e1ee;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  background: #f8fbff;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #5b6d86;
  text-align: center;
  line-height: 1.05;
  padding: 2px;
}

.cell.normal {
  background: #f8fbff;
}

.cell.tw {
  background: var(--red-soft);
  color: var(--red-deep);
}

.cell.dw {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.cell.tl {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.cell.dl {
  background: var(--green-soft);
  color: var(--green-deep);
}

.cell.center {
  background: #ffeab3;
  color: #aa7b12;
}

.cell.drop-hover {
  outline: 3px dashed #89a9eb;
  outline-offset: -3px;
}

.cell .bonus-label {
  pointer-events: none;
}

.tile {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(180deg, #f5dfae 0%, #ebca84 100%);
  border: 1px solid #be9950;
  box-shadow: 0 2px 5px rgba(70, 45, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 800;
  color: #53370a;
  cursor: pointer;
}

.tile .letter {
  font-size: 1.1rem;
  transform: translateY(-1px);
}

.tile .points {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 0.58rem;
  font-weight: 800;
}

.tile.selected {
  outline: 3px solid #7ea4f1;
  transform: translateY(-2px);
}

.tile.swap-selected {
  outline: 3px solid #9b79eb;
  transform: translateY(-2px);
}

.tile.locked {
  cursor: default;
}

.tile.dragging {
  opacity: 0.45;
}

.cell .tile {
  width: 32px;
  height: 32px;
}

.rack-area {
  padding: 16px;
}

.rack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.rack-header h2,
.rack-header p {
  margin: 0;
}

.rack-header p {
  color: var(--muted);
  font-weight: 700;
}

.rack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px dashed #c9d5e6;
  border-radius: 16px;
  background: #f9fbff;
}

.rack.drop-hover {
  outline: 3px dashed #89a9eb;
  outline-offset: 2px;
}

.site-footer {
  padding: 18px 0 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 1080px) {
  .hero-card,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    order: 2;
  }

  .board-section {
    order: 1;
  }
}

@media (max-width: 700px) {
  :root {
    --board-cell: 34px;
  }

  .site-header-inner {
    padding: 12px 0;
    align-items: flex-start;
    flex-direction: column;
  }

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

  .board-shell {
    padding: 10px;
  }
}