* { box-sizing: border-box; }

html, body { height: 100%; }
html {
  background: #5a8edd url('../../Windows XP Background.svg') center center / cover no-repeat fixed;
}
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  font-family: Tahoma, "Segoe UI", "MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: #000;
}

/* ─── XP window chrome ─── */
.xp-window {
  background: linear-gradient(to bottom, #0058e6 0%, #245edb 9%, #245edb 100%);
  border-radius: 8px 8px 0 0;
  padding: 0 3px 3px;
  box-shadow: 0 0 0 1px #003a99, 0 18px 32px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 1000px;
}

.xp-titlebar {
  background: linear-gradient(to bottom,
    #0058e6 0%, #3893ff 3%, #1d72e0 9%, #0c5fd5 50%, #045fda 90%, #0455b7 100%);
  color: #fff;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 13px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.35);
  height: 28px;
  border-radius: 6px 6px 0 0;
}
.xp-titlebar-left { display: flex; align-items: center; gap: 6px; }
.xp-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.xp-icon svg { display: block; }
.xp-titlebar-buttons { display: flex; gap: 2px; }
.xp-tb-btn {
  width: 22px; height: 22px;
  background: linear-gradient(to bottom, #4791ed 0%, #2772d4 50%, #205fc4 100%);
  border: 1px solid rgba(0,0,0,0.55);
  border-radius: 3px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -1px 0 rgba(0,0,0,0.18);
}
.xp-tb-btn.close {
  background: linear-gradient(to bottom, #e96d65 0%, #c93630 50%, #9d1410 100%);
  border-color: #500000;
}
.xp-tb-btn:hover { filter: brightness(1.12); }
a.xp-tb-btn { text-decoration: none; }

.xp-menubar {
  background: #ece9d8;
  padding: 2px 6px;
  border-bottom: 1px solid #aca899;
  font-size: 11px;
  display: flex; gap: 4px;
}
.xp-menubar span { padding: 3px 8px; cursor: default; color: #000; }
.xp-menubar span:hover { background: #316ac5; color: #fff; }

/* ─── Toolbar ─── */
.xp-toolbar {
  background: linear-gradient(to bottom, #f7f6ef 0%, #ece9d8 100%);
  padding: 5px 8px;
  border-bottom: 1px solid #d4d0c8;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.toolbar-stat {
  font-size: 11px;
  color: #003399;
  background: #fff;
  border: 1px inset #aca899;
  padding: 2px 8px;
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.toolbar-stat b { color: #000; }

.xp-btn {
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  background: linear-gradient(to bottom,
    #f6f6f6 0%, #ece9d8 45%, #ddd9c0 55%, #d6d2c2 100%);
  border: 1px solid #003c74;
  border-radius: 3px;
  padding: 3px 12px;
  color: #000;
  cursor: pointer;
  min-width: 75px;
  min-height: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -1px 0 rgba(0,0,0,0.05);
}
.xp-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom,
    #fff7d2 0%, #ffe589 45%, #ffb04a 55%, #ffa12d 100%);
  border-color: #c66902;
}
.xp-btn:active:not(:disabled) {
  background: linear-gradient(to bottom, #d6d2c2 0%, #ddd9c0 45%, #ece9d8 55%, #f6f6f6 100%);
}
.xp-btn.primary {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 0 0 1px #0855c4;
  font-weight: bold;
}
.xp-btn.xp-icon-btn {
  min-width: 0;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.xp-btn.xp-icon-btn svg { display: block; }

/* ─── Game area ─── */
.game-area {
  position: relative;
  padding: 10px;
  background: #ece9d8;
}

#board {
  display: block;
  background: linear-gradient(to bottom, #2a3a78 0%, #142046 100%);
  border: 2px inset #aca899;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ─── Overlays ─── */
.overlay {
  position: absolute;
  inset: 10px;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.overlay-card {
  background: linear-gradient(to bottom, #0058e6 0%, #245edb 9%, #245edb 100%);
  border-radius: 6px 6px 0 0;
  padding: 0 3px 3px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.55);
  max-width: 440px;
  width: 100%;
  margin: 0 16px;
}
.overlay-card > * { background: #ece9d8; }
.overlay-card > *:first-child {
  background: linear-gradient(to bottom,
    #0058e6 0%, #3893ff 3%, #1d72e0 9%, #0c5fd5 50%, #045fda 90%, #0455b7 100%);
  color: #fff;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.35);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 4px 4px 0 0;
}
.overlay-card .oc-title { text-align: left; }
.overlay-card .oc-sub {
  padding: 14px 16px 6px;
  font-size: 12px;
  color: #003399;
  text-align: center;
}
.overlay-card .oc-stat {
  padding: 4px 16px;
  font-size: 12px;
  color: #000;
  text-align: center;
}
.overlay-card .oc-stat b { color: #003399; }
.overlay-card ul.oc-controls {
  list-style: none;
  margin: 0; padding: 8px 18px;
  font-size: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
}
.overlay-card ul.oc-controls li { display: flex; align-items: center; gap: 4px; }
.overlay-card ul.oc-controls kbd {
  background: #fff;
  border: 1px solid #aca899;
  border-radius: 2px;
  padding: 1px 5px;
  font: 10px Tahoma, sans-serif;
  box-shadow: 1px 1px 0 #888;
}
.overlay-card .xp-btn {
  display: block;
  margin: 14px auto 14px;
  min-width: 160px;
}

/* ─── Intro mode picker ─── */
.oc-mode-heading {
  padding: 10px 16px 2px;
  font-size: 11px;
  font-weight: bold;
  color: #003399;
  text-align: left;
}
.oc-mode-group {
  padding: 4px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.oc-mode-row {
  display: grid;
  grid-template-columns: 18px auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
}
.oc-mode-row:hover {
  background: #d9e6ff;
  border-color: #a8c3ee;
}
.oc-mode-row input[type="radio"] { margin: 0; }
.oc-mode-name { font-weight: bold; color: #003399; }
.oc-mode-desc { color: #333; }

/* ─── Post-game keyword recap ─── */
.overlay-card.overlay-card-wide {
  max-width: 560px;
}
.recap-section {
  background: #ece9d8;
  padding: 8px 14px 4px;
}
.recap-section + .recap-section {
  padding-top: 4px;
  border-top: 1px solid #aca899;
}
.recap-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px 4px;
  font-size: 11px;
  font-weight: bold;
  color: #003399;
  text-align: left;
  letter-spacing: 0.3px;
}
.recap-heading-escaped {
  color: #9a0000;
}
.recap-warn-icon {
  display: block;
  flex-shrink: 0;
}
.recap-list {
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
  font-size: 11.5px;
  background: #fff;
  border: 1px solid;
  border-color: #919b9c #ffffff #ffffff #919b9c;
  box-shadow: inset 1px 1px 0 rgba(0,0,0,0.10);
  padding: 4px 8px;
  margin: 0 0 4px;
}
.recap-row {
  padding: 5px 2px;
  border-bottom: 1px dotted #cfcabb;
}
.recap-row:last-child { border-bottom: none; }
.recap-term {
  font-weight: bold;
  color: #003399;
  letter-spacing: 0.3px;
}
.recap-list-escaped .recap-term {
  color: #9a0000;
}
.recap-def {
  color: #1a1004;
  margin-top: 2px;
  line-height: 1.35;
}
.recap-empty {
  padding: 8px 4px;
  color: #555;
  font-style: italic;
}

/* ─── Status bar ─── */
.xp-statusbar {
  background: #ece9d8;
  border-top: 1px solid #919b9c;
  padding: 3px 8px;
  font-size: 11px;
  color: #333;
  display: flex;
  justify-content: space-between;
}
.status-cell { border-left: 1px solid #aca899; padding-left: 8px; margin-left: 8px; }
.xp-start-tag {
  display: inline-block;
  background: linear-gradient(to bottom, #3ca33c 0%, #2c8f2c 50%, #207020 100%);
  color: #fff;
  font-style: italic;
  font-weight: bold;
  padding: 2px 12px 2px 8px;
  border-radius: 0 12px 12px 0;
  font-size: 11px;
  margin-right: 4px;
}

@media (max-width: 900px) {
  body { padding: 4px; }
  .xp-toolbar { flex-wrap: wrap; }
}
