/* style.css — dusk-over-the-sea palette: deep indigo, ember gold, hardwood. */

@font-face {
  font-family: 'Display Serif';
  src: url('../vendor/cormorant-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Display Serif';
  src: url('../vendor/cormorant-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #0b0d1a;
  --panel: rgba(14, 16, 32, 0.82);
  --panel-edge: rgba(217, 168, 63, 0.35);
  --gold: #d9a83f;
  --gold-bright: #f0c765;
  --ember: #ff9a4d;
  --text: #e8dfc8;
  --text-dim: #9a917c;
  --danger: #c8542e;
  --font-display: 'Display Serif', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-body: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--ink); }
body { font-family: var(--font-body); color: var(--text); }

#scene-container { position: fixed; inset: 0; }
#scene-container canvas { display: block; touch-action: none; }

/* soft vignette over the 3D scene */
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(4, 5, 12, 0.55) 100%);
}

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(120, 50, 20, 0.25), transparent 60%),
    radial-gradient(ellipse at 50% 30%, rgba(10, 12, 28, 0.25), rgba(8, 9, 20, 0.78) 90%);
}
.title-eyebrow {
  font-family: var(--font-body); font-size: 13px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--text-dim);
}
.title-logo {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(56px, 12vw, 128px); line-height: 0.95; letter-spacing: 0.06em;
  color: var(--gold-bright);
  text-shadow: 0 0 42px rgba(255, 154, 77, 0.45), 0 2px 0 rgba(0,0,0,0.4);
}
.title-sub { font-family: var(--font-display); font-size: clamp(16px, 2.6vw, 22px); color: var(--text); opacity: 0.9; }
.title-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; min-width: 300px; }
.title-foot { margin-top: 26px; font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }

.setup-head { font-family: var(--font-display); font-size: clamp(30px, 5vw, 44px); color: var(--gold-bright); }
.setup-sub { color: var(--text-dim); font-size: 14px; max-width: 520px; }
.setup-label {
  margin-top: 18px; font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--text-dim);
}
.setup-actions { display: flex; gap: 12px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }

.card-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 720px; }
.card {
  font-family: var(--font-body); cursor: pointer; text-align: left;
  background: var(--panel); color: var(--text);
  border: 1px solid rgba(232, 223, 200, 0.14); border-radius: 10px;
  padding: 14px 16px; width: 210px; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--panel-edge); }
.card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 6px 24px rgba(217, 168, 63, 0.18);
}
.card-name { font-family: var(--font-display); font-size: 20px; color: var(--gold-bright); }
.card-tag { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  letter-spacing: 0.04em; cursor: pointer; border-radius: 8px; padding: 12px 26px;
  border: 1px solid transparent; transition: all .15s;
}
.btn-primary {
  background: linear-gradient(180deg, #e8bd55, #b9852e);
  color: #241503; border-color: #f0c765;
  box-shadow: 0 4px 18px rgba(217, 168, 63, 0.35);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: rgba(232, 223, 200, 0.06); color: var(--text); border-color: rgba(232, 223, 200, 0.2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn-danger { background: rgba(200, 84, 46, 0.15); color: #e88a63; border-color: rgba(200, 84, 46, 0.5); }
.btn-danger:hover { background: rgba(200, 84, 46, 0.3); }
.btn-small { font-size: 14px; padding: 8px 14px; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(0.5); }

.icon-btn {
  font-family: var(--font-body); font-size: 13px; cursor: pointer;
  background: rgba(14, 16, 32, 0.7); color: var(--text);
  border: 1px solid rgba(232, 223, 200, 0.16); border-radius: 7px; padding: 7px 11px;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold-bright); }

/* ---------------------------------------------------------------- HUD */
#ui > .hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: linear-gradient(180deg, rgba(8, 9, 20, 0.85), transparent);
}
.topbar-logo { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--gold); letter-spacing: 0.12em; }
.turn-badge {
  font-family: var(--font-display); font-size: 17px; color: var(--text);
  background: var(--panel); border: 1px solid var(--panel-edge);
  padding: 6px 16px; border-radius: 999px;
}
.check-pill {
  font-family: var(--font-body); font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em;
  background: var(--danger); color: #fff; border-radius: 999px; padding: 2px 8px; margin-left: 6px;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: 0.75; } to { opacity: 1; } }
.topbar-buttons { margin-left: auto; display: flex; gap: 8px; }

.banner {
  position: absolute; top: 62px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 999px;
  padding: 7px 18px; font-size: 14px; color: var(--gold-bright);
  font-family: var(--font-display); letter-spacing: 0.04em;
}

/* side panel */
.panel {
  position: absolute; top: 64px; right: 12px; bottom: 12px; width: 262px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid rgba(232, 223, 200, 0.12);
  border-radius: 12px; padding: 12px; backdrop-filter: blur(6px);
}
.cap-tray { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 24px; }
.cap-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin-right: 4px; }
.cap-chip {
  font-size: 11px; background: rgba(232, 223, 200, 0.08); border: 1px solid rgba(232, 223, 200, 0.14);
  border-radius: 999px; padding: 2px 8px; color: var(--text);
}
.cap-diff { font-size: 12px; font-weight: 700; color: var(--gold-bright); margin-left: auto; }

.move-list {
  flex: 1; overflow-y: auto; border: 1px solid rgba(232, 223, 200, 0.08);
  border-radius: 8px; padding: 6px; background: rgba(0, 0, 0, 0.25);
}
.move-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 2px; }
.move-num { font-size: 12px; color: var(--text-dim); padding: 4px 2px; }
.move-cell {
  font-family: var(--font-body); font-size: 13px; text-align: left; cursor: pointer;
  background: transparent; border: none; color: var(--text);
  padding: 4px 6px; border-radius: 5px;
}
.move-cell:hover { background: rgba(217, 168, 63, 0.15); color: var(--gold-bright); }
.move-cell.viewing { background: rgba(217, 168, 63, 0.28); color: var(--gold-bright); }

.legend { font-size: 10px; color: var(--text-dim); line-height: 1.5; }
.panel-controls { display: flex; gap: 6px; flex-wrap: wrap; }

.replay-bar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 999px; padding: 8px 14px;
}
.replay-label { font-size: 13px; color: var(--gold-bright); font-family: var(--font-display); }

/* ---------------------------------------------------------------- modals */
#ui > .modal-root { position: absolute; inset: 0; pointer-events: none; }
.modal {
  pointer-events: auto;
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 14, 0.6); backdrop-filter: blur(3px); z-index: 30;
}
.modal-box {
  position: relative; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  overflow-y: auto; background: linear-gradient(180deg, #151830, #0e1020);
  border: 1px solid var(--panel-edge); border-radius: 14px; padding: 26px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.modal-title { font-family: var(--font-display); font-size: 26px; color: var(--gold-bright); margin-bottom: 10px; }
.modal-close {
  position: absolute; top: 12px; right: 12px; cursor: pointer;
  background: transparent; border: none; color: var(--text-dim); font-size: 18px;
}
.modal-close:hover { color: var(--gold-bright); }
.about-text p { font-size: 14.5px; line-height: 1.75; margin-bottom: 12px; color: var(--text); }
.about-text em { color: var(--gold-bright); }
.about-fine { color: var(--text-dim); font-size: 13px; }
.promo-row .card { width: 260px; }

.over-title { font-family: var(--font-display); font-size: 34px; color: var(--gold-bright); text-align: center; margin-bottom: 8px; }
.over-sub { font-size: 15px; color: var(--text); text-align: center; line-height: 1.6; margin-bottom: 6px; }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 760px) {
  .panel {
    top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 42vh;
    transform: translateY(calc(100% - 0px)); transition: transform .25s;
    display: none;
  }
  .panel.open { display: flex; transform: none; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .turn-badge { font-size: 14px; padding: 5px 12px; order: 3; width: 100%; text-align: center; }
  .banner { top: 104px; font-size: 12px; max-width: 92vw; text-align: center; }
  .card { width: calc(50vw - 30px); min-width: 150px; }
  .replay-bar { bottom: 8px; }
}
