/* ==============================================
   Tafl — naval chart editorial
   ============================================== */

:root {
  --abyss:        #0a141d;
  --abyss-2:      #0c1821;
  --panel:        #10202c;
  --panel-2:      #15293a;
  --ink:          #050a10;
  --bone:         #e8dfc8;
  --bone-2:       #d8ceb3;
  --bone-dim:     rgba(232, 223, 200, 0.55);
  --bone-faint:   rgba(232, 223, 200, 0.18);
  --bone-hair:    rgba(232, 223, 200, 0.08);
  --amber:        #d49a41;
  --amber-lite:   #ecb964;
  --amber-deep:   #8d5f1c;
  --amber-glow:   rgba(236, 185, 100, 0.35);
  --seaglass:     #7fa6b8;
  --seaglass-lite:#a9c4d1;
  --seaglass-deep:#3d5e6f;
  --rust:         #b05a42;
  --rust-glow:    rgba(176, 90, 66, 0.4);
  --highlight:    #5ba99b;

  --serif: 'Fraunces', 'EB Garamond', Georgia, serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--abyss); }

body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  color: var(--bone);
  background:
    radial-gradient(ellipse at 20% -10%, rgba(212, 154, 65, 0.05), transparent 50%),
    radial-gradient(ellipse at 85% 110%, rgba(127, 166, 184, 0.04), transparent 55%),
    linear-gradient(180deg, var(--abyss) 0%, var(--abyss-2) 100%);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Film grain overlay */
.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.91 0 0 0 0 0.87 0 0 0 0 0.78 0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.35;
  mix-blend-mode: overlay;
}

/* Horizon hairline across the middle of the page (only visible on some views) */
.horizon {
  position: fixed; top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bone-hair) 20%, var(--bone-hair) 80%, transparent);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 600ms;
}
body:has(#landing.active) .horizon { opacity: 0.7; }

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 6vh, 72px) 20px;
}

/* ==============================================
   Views
   ============================================== */

.view {
  display: none;
  width: 100%;
  max-width: 760px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.view.active {
  display: flex;
  animation: view-in 500ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==============================================
   Landing
   ============================================== */

.crest {
  color: var(--bone);
  opacity: 0.92;
  margin-top: 8px;
  animation: crest-in 900ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
.crest-mark { width: 56px; height: auto; display: block; }
@keyframes crest-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 0.92; transform: translateY(0); }
}

.display-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 300;
  font-style: italic;
  color: var(--bone);
  font-size: clamp(84px, 16vw, 180px);
  letter-spacing: 0.02em;
  line-height: 0.9;
  margin: 18px 0 4px;
  animation: title-in 1000ms cubic-bezier(0.22, 0.8, 0.3, 1) both 80ms;
}
@keyframes title-in {
  from { opacity: 0; letter-spacing: -0.04em; }
  to   { opacity: 1; letter-spacing: 0.02em; }
}

.subrule {
  width: 64px;
  height: 1px;
  background: var(--bone-dim);
  margin: 20px auto 36px;
  animation: grow-in 700ms ease both 700ms;
}
@keyframes grow-in {
  from { width: 0; opacity: 0; }
  to   { width: 64px; opacity: 1; }
}

/* ---- menu ---- */

.menu {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 440px;
  margin-bottom: 48px;
  animation: fade-in 700ms ease both 400ms;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.menu-btn {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 22px 4px 22px 4px;
  background: transparent;
  color: var(--bone);
  border: none;
  border-top: 1px solid var(--bone-faint);
  cursor: pointer;
  font-family: var(--serif);
  font-variation-settings: "opsz" 36, "SOFT" 40;
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  text-align: left;
  transition: color 250ms, padding 250ms;
}
.menu-btn:last-child { border-bottom: 1px solid var(--bone-faint); }
.menu-btn:hover { color: var(--amber-lite); padding-left: 12px; padding-right: 12px; }

.menu-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
}
.menu-btn:hover .menu-num { color: var(--amber); }

.menu-label { display: block; }

.menu-arrow {
  font-family: var(--serif);
  font-style: normal;
  color: var(--bone-dim);
  font-size: 18px;
  transition: transform 250ms, color 250ms;
}
.menu-btn:hover .menu-arrow {
  color: var(--amber-lite);
  transform: translateX(6px);
}

/* ---- rules card ---- */

.rules-card {
  width: 100%;
  max-width: 520px;
  text-align: left;
  padding: 28px 30px 28px;
  background:
    linear-gradient(180deg, rgba(16, 32, 44, 0.6) 0%, rgba(12, 24, 33, 0.3) 100%);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  animation: fade-in 800ms ease both 650ms;
}

.rules-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.rules-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--amber);
}
.rules-kicker-rule {
  flex: 1;
  height: 1px;
  background: var(--bone-faint);
}

.rules-intro {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18, "SOFT" 40;
  font-style: italic;
  font-size: 15px;
  line-height: 1.65;
  color: var(--bone-2);
  margin: 0 0 20px;
}
.fleet-txt    { color: var(--amber-lite); font-style: normal; font-weight: 500; }
.blockade-txt { color: var(--seaglass-lite); font-style: normal; font-weight: 500; }

.rules-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  counter-reset: rule;
  border-top: 1px solid var(--bone-hair);
}
.rules-list li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 11px 0 10px;
  border-bottom: 1px solid var(--bone-hair);
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14px;
  line-height: 1.5;
  color: var(--bone-2);
}
.rules-list em {
  font-style: italic;
  color: var(--bone);
}
.rules-list .n {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--amber);
  padding-top: 2px;
}

.rules-outcome {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rubric-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14px;
  font-style: italic;
  color: var(--bone-dim);
}
.rubric-mark {
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
  width: 14px;
  text-align: center;
}
.rubric-mark.fleet { color: var(--amber); }
.rubric-mark.blockade { color: var(--seaglass); }
.rubric-title {
  font-style: normal;
  font-weight: 500;
  color: var(--bone);
  font-variation-settings: "opsz" 14, "wght" 500;
}
.rubric-sep { color: var(--bone-faint); }

/* ---- variant picker ---- */

.variant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.variant-row select {
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.variant-row select:hover { border-color: var(--amber); }

/* ==============================================
   Move history + replay + import
   ============================================== */

.history-panel {
  width: 320px;
  align-self: stretch;
  padding: 18px 22px 20px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--abyss-2) 100%);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.history-header {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--bone-dim);
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--bone-hair);
  flex-shrink: 0;
}
.history-list {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 120px;
  max-height: min(520px, 60vh);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.85;
  color: var(--bone-2);
}
.hist-empty {
  color: var(--bone-faint);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  padding-top: 8px;
}
.hist-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  gap: 10px;
  padding: 2px 0;
  align-items: baseline;
}
.hist-row:hover { background: rgba(232, 223, 200, 0.04); }
.hist-num { color: var(--bone-faint); text-align: right; }
.hist-g { color: var(--amber-lite); }
.hist-s { color: var(--seaglass-lite); }
.hist-row span.active {
  background: rgba(212, 154, 65, 0.2);
  outline: 1px solid var(--amber);
  padding: 0 2px;
  border-radius: 2px;
}

.panel-link {
  background: transparent;
  color: var(--amber);
  border: none;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 12px;
  text-align: left;
  width: 100%;
}
.panel-link:hover { color: var(--amber-lite); }

.replay-bar {
  margin-top: 24px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  background: var(--panel);
  width: min(88vmin, 600px);
}
.replay-btn {
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--bone-faint);
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 120ms, border-color 120ms;
}
.replay-btn:hover { background: var(--bone); color: var(--abyss); border-color: var(--bone); }
.replay-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--bone-dim);
  letter-spacing: 0.1em;
  margin-left: 12px;
}

/* Import modal */
.modal {
  display: none;
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(5, 10, 16, 0.85);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.active { display: flex; }
.modal-body {
  background: var(--panel);
  border: 1px solid var(--bone-faint);
  border-radius: 4px;
  padding: 28px 32px;
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}
.import-text {
  width: 100%;
  background: var(--abyss-2);
  color: var(--bone);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}
.import-file {
  margin-top: 8px;
  color: var(--bone-dim);
  font-family: var(--mono);
  font-size: 12px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ==============================================
   Secondary views (shared header)
   ============================================== */

.top-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  color: var(--bone-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.top-mini-mark { color: var(--amber); font-size: 14px; }

.section-head {
  font-family: var(--serif);
  font-variation-settings: "opsz" 48, "SOFT" 30;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(32px, 5vw, 44px);
  margin: 0 0 36px;
  color: var(--bone);
}

/* ==============================================
   AI choice cards
   ============================================== */

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 32px;
}
@media (max-width: 560px) {
  .choice-grid { grid-template-columns: 1fr; }
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 24px 22px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--abyss-2) 100%);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  cursor: pointer;
  color: var(--bone);
  text-align: left;
  transition: border-color 250ms, transform 250ms, box-shadow 250ms, background 250ms;
  font-family: var(--serif);
  position: relative;
  overflow: hidden;
}
.choice-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  transition: border-color 400ms;
  pointer-events: none;
}
.choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--bone-dim);
}
.choice-card.fleet-card:hover::after { border-color: var(--amber-glow); box-shadow: inset 0 0 40px var(--amber-glow); }
.choice-card.blockade-card:hover::after { border-color: rgba(127, 166, 184, 0.3); box-shadow: inset 0 0 40px rgba(127, 166, 184, 0.15); }

.choice-emblem {
  width: 64px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.choice-emblem svg { width: 100%; height: 100%; }
.fleet-card .choice-emblem { color: var(--amber); }
.blockade-card .choice-emblem { color: var(--seaglass); }

.choice-name {
  font-family: var(--serif);
  font-variation-settings: "opsz" 36, "SOFT" 30;
  font-size: 28px;
  font-weight: 400;
  font-style: italic;
  line-height: 1;
}
.choice-desc {
  font-size: 14px;
  color: var(--bone-dim);
  font-style: italic;
  line-height: 1.55;
}
.choice-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--bone-faint);
  text-transform: uppercase;
  margin-top: 4px;
}
.fleet-card .choice-meta { color: var(--amber-deep); }
.blockade-card .choice-meta { color: var(--seaglass-deep); }

/* ==============================================
   Online setup
   ============================================== */

.form-panel {
  width: 100%;
  max-width: 440px;
  margin-bottom: 28px;
}

.form-section { padding: 18px 0; }
.form-section + .form-section { border-top: none; }

.form-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin-bottom: 14px;
}

.btn-row, .join-row {
  display: flex;
  gap: 10px;
}

.pill-btn {
  flex: 1;
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--bone-faint);
  padding: 13px 20px;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 40;
  font-size: 16px;
  font-style: italic;
  transition: background 250ms, color 250ms, border-color 250ms;
}
.pill-btn:hover {
  background: var(--bone);
  color: var(--abyss);
  border-color: var(--bone);
}
.pill-btn.fleet-pill { border-left: 2px solid var(--amber); }
.pill-btn.fleet-pill:hover { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.pill-btn.blockade-pill { border-left: 2px solid var(--seaglass); }
.pill-btn.blockade-pill:hover { background: var(--seaglass); border-color: var(--seaglass); color: var(--ink); }

.form-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
  color: var(--bone-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.form-divider::before, .form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bone-faint);
}

.code-input {
  flex: 1;
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  padding: 13px 16px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  min-width: 0;
  transition: border-color 250ms, background 250ms;
}
.code-input::placeholder {
  color: var(--bone-faint);
  letter-spacing: 0.15em;
}
.code-input:focus {
  outline: none;
  border-color: var(--amber);
  background: rgba(212, 154, 65, 0.05);
}

/* ==============================================
   Waiting
   ============================================== */

.wait-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 48px;
  background: var(--panel);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  margin-bottom: 28px;
}
.wait-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.wait-code {
  font-family: var(--mono);
  font-size: clamp(52px, 9vw, 84px);
  font-weight: 300;
  letter-spacing: 0.3em;
  color: var(--amber);
  text-shadow: 0 0 28px var(--amber-glow);
  margin: 4px 0 12px;
  padding-left: 0.3em;
}
.wait-hint {
  font-family: var(--serif);
  font-style: italic;
  color: var(--bone-dim);
  font-size: 14px;
  margin-bottom: 14px;
}
.wait-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  animation: pulse 1500ms ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

/* ==============================================
   Game view
   ============================================== */

.game-bar {
  width: 100%;
  max-width: 1320px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bone-faint);
}
.game-leave {
  justify-self: start;
  background: transparent;
  border: none;
  color: var(--bone-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 200ms;
}
.game-leave:hover { color: var(--amber); }
.game-bar-title {
  justify-self: center;
  font-family: var(--serif);
  font-style: italic;
  font-variation-settings: "opsz" 24, "SOFT" 30;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: var(--bone);
}
.game-bar-spacer { width: 1px; }

.game-wrap {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 1320px;
}

/* ==============================================
   Board — the centerpiece
   ============================================== */

.board-outer {
  flex-shrink: 0;
}

.board-wrap {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 24px;
  width: min(88vmin, 600px);
  aspect-ratio: 1;
  position: relative;
}

.coords-y, .coords-x {
  display: grid;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--bone-faint);
  user-select: none;
}
.coords-y {
  grid-row: 1;
  grid-column: 1;
  grid-template-rows: repeat(11, 1fr);
  gap: 2px;
  padding: 4px 0;
}
.coords-y span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}
.coords-x {
  grid-row: 2;
  grid-column: 2;
  grid-template-columns: repeat(11, 1fr);
  gap: 2px;
  padding: 0 4px;
}
.coords-x span {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
}

.board {
  grid-row: 1;
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 1.5px;
  /* Bone-tint behind cells makes the 1.5px gaps read as crisp grid lines */
  background: rgba(232, 223, 200, 0.18);
  padding: 4px;
  border: 1px solid var(--bone-dim);
  border-radius: 2px;
  aspect-ratio: 1;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(232, 223, 200, 0.08);
}

.cell {
  /* Fully opaque so the bone gap-lines show through uniformly across the whole board */
  background: #0d1a24;
  position: relative;
  cursor: pointer;
  transition: background 160ms;
  border-radius: 0;
}
.cell.center-area {
  background: #152a38;
}
.cell.center-square {
  background: #1d3546;
}

/* compass rose in center square */
.cell.center-square::before {
  content: '';
  position: absolute;
  inset: 14%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8dfc8' stroke-width='0.4' opacity='0.5'><circle cx='12' cy='12' r='9' stroke-width='0.3'/><circle cx='12' cy='12' r='5' stroke-width='0.3'/><path d='M 12 2 L 13.5 11 L 12 12 L 10.5 11 Z M 12 22 L 10.5 13 L 12 12 L 13.5 13 Z M 2 12 L 11 10.5 L 12 12 L 11 13.5 Z M 22 12 L 13 13.5 L 12 12 L 13 10.5 Z' fill='%23e8dfc8' opacity='0.4'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
  opacity: 0.55;
}

.cell:hover { background: #1c3348; }
.cell.center-area:hover { background: #244058; }
.cell.center-square:hover { background: #2b4a62; }

.cell.selected {
  background: rgba(212, 154, 65, 0.18) !important;
  box-shadow: inset 0 0 0 1px var(--amber);
}

.cell.legal-move::after {
  content: '';
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: var(--bone);
  opacity: 0.42;
  pointer-events: none;
}
.cell.legal-capture::after {
  content: '';
  position: absolute;
  inset: 10%;
  border: 1.5px solid var(--rust);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px var(--rust-glow);
}

/* Last move highlight — chart-marker style */
.cell.last-from {
  box-shadow: inset 0 0 0 1px var(--amber-glow);
  background: rgba(212, 154, 65, 0.05);
}
.cell.last-to {
  box-shadow: inset 0 0 0 1px var(--amber);
  background: rgba(212, 154, 65, 0.12);
}

/* ==============================================
   Pieces
   ============================================== */

.piece {
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 120ms;
}

/* Fleet (gold) — amber, solid */
.piece.gold {
  background:
    radial-gradient(circle at 32% 30%, var(--amber-lite) 0%, var(--amber) 50%, var(--amber-deep) 100%);
  box-shadow:
    inset -2px -2px 4px rgba(0, 0, 0, 0.4),
    inset 2px 2px 4px rgba(255, 230, 180, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Blockade (silver) — seaglass, with a thicker bone ring */
.piece.silver {
  background:
    radial-gradient(circle at 34% 32%, var(--seaglass-lite) 0%, var(--seaglass) 55%, var(--seaglass-deep) 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(232, 223, 200, 0.12),
    inset -2px -2px 4px rgba(0, 0, 0, 0.4),
    inset 2px 2px 4px rgba(255, 255, 255, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.45);
}

/* Flagship — amber, with drakkar silhouette */
.piece.flagship {
  inset: 7%;
  background:
    radial-gradient(circle at 32% 30%, var(--amber-lite) 0%, var(--amber) 45%, var(--amber-deep) 95%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 248, 220, 0.55),
    inset -3px -3px 7px rgba(0, 0, 0, 0.45),
    inset 3px 3px 7px rgba(255, 240, 200, 0.35),
    0 0 20px var(--amber-glow),
    0 3px 8px rgba(0, 0, 0, 0.5);
}

.piece svg {
  width: 62%;
  height: 62%;
  color: var(--ink);
}
.piece.flagship svg {
  width: 66%;
  height: auto;
  color: #231306;
  opacity: 0.88;
}

/* ==============================================
   Side panel
   ============================================== */

.panel {
  width: 260px;
  padding: 22px 22px 20px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--abyss-2) 100%);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  font-family: var(--serif);
}

.turn-display {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bone-hair);
  margin-bottom: 14px;
}
.turn-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
.turn-dot.gold {
  background: radial-gradient(circle at 32% 30%, var(--amber-lite), var(--amber) 60%, var(--amber-deep));
  box-shadow: 0 0 10px var(--amber-glow);
}
.turn-dot.silver {
  background: radial-gradient(circle at 32% 30%, var(--seaglass-lite), var(--seaglass) 60%, var(--seaglass-deep));
  box-shadow: 0 0 10px rgba(127, 166, 184, 0.25);
}
.turn-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.turn-caption {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
#turn-label {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 30;
  font-size: 18px;
  font-style: italic;
  color: var(--bone);
  line-height: 1.2;
}

.status {
  color: var(--bone-dim);
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  min-height: 44px;
  margin-bottom: 18px;
}

.counts {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  margin-bottom: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--bone-hair);
  border-bottom: 1px solid var(--bone-hair);
}
.count-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}
.count-sep {
  background: var(--bone-hair);
  margin: 2px 0;
}
.count-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.count-num {
  font-family: var(--serif);
  font-variation-settings: "opsz" 36, "SOFT" 30;
  font-size: 26px;
  font-weight: 400;
  color: var(--bone);
  line-height: 1;
}
.fleet-count .count-label   { color: var(--amber); }
.blockade-count .count-label { color: var(--seaglass); }
.fleet-count .count-num     { color: var(--amber-lite); }
.blockade-count .count-num   { color: var(--seaglass-lite); }

.pass-btn {
  width: 100%;
  background: transparent;
  color: var(--bone-dim);
  border: 1px solid var(--bone-faint);
  padding: 10px 14px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 200ms, border-color 200ms;
}
.pass-btn:hover {
  color: var(--amber);
  border-color: var(--amber);
}

/* ==============================================
   Banner (game-over)
   ============================================== */

.banner {
  padding: 18px 20px;
  border: 1px solid var(--amber);
  border-left-width: 3px;
  background: linear-gradient(90deg, rgba(212, 154, 65, 0.15) 0%, transparent 100%);
  border-radius: 2px;
  margin-bottom: 16px;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--bone);
  line-height: 1.55;
}
.banner strong {
  display: block;
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  font-variation-settings: "opsz" 36, "SOFT" 30;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
  color: var(--amber-lite);
}
.banner.silver-win {
  border-color: var(--seaglass);
  background: linear-gradient(90deg, rgba(127, 166, 184, 0.15) 0%, transparent 100%);
}
.banner.silver-win strong { color: var(--seaglass-lite); }

/* ==============================================
   Shared link-style back buttons
   ============================================== */

.link-btn, .btn-back {
  background: transparent;
  border: none;
  color: var(--bone-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 10px;
  transition: color 200ms, letter-spacing 200ms;
  margin-top: 8px;
}
.link-btn:hover, .btn-back:hover {
  color: var(--amber);
  letter-spacing: 0.25em;
}

/* ==============================================
   Responsive
   ============================================== */

@media (max-width: 1100px) {
  .history-panel { width: min(88vmin, 600px); }
}
@media (max-width: 760px) {
  .game-wrap { flex-direction: column; align-items: center; }
  .panel { width: min(88vmin, 600px); }
  .board-wrap { width: min(88vmin, 600px); }
  .menu-btn { font-size: 20px; padding: 18px 4px; }
  .history-list { max-height: 280px; }
}
@media (max-width: 460px) {
  .display-title { font-size: 76px; }
  .panel { padding: 18px; }
}
