/* Pwixel skin — the Matsuno pass. Pure visual layer: materials, type, light.
   NO layout metrics live here (sizes/spacing/hit-zones stay in index.html),
   so this file can never break usability. */

:root {
  /* Brand palette (pwixel-brand-sheet.html) */
  --gold: #D2662E;      /* terracotta — primary brand */
  --gold-hi: #EE8B4E;   /* orange light highlight */
  --gold-dim: #B85320;  /* orange deep */
  --cream: #F4ECD8;
  --charcoal: #2B2B2B;
  --paper: #F1E9D7;
  --bone: #efe1bd;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

body {
  background:
    radial-gradient(120% 90% at 50% -10%, #1a2030 0%, #10141c 45%, #0a0d13 100%);
}

/* ── Header: engraved title bar ── */
header {
  background: linear-gradient(180deg, #171c28, #12161f);
  border-bottom: 1px solid #060810;
  box-shadow: 0 1px 0 #2a3346 inset, 0 2px 8px #0009;
  position: relative;
}
header::after {
  content: '◆';
  position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  font-size: 8px; color: var(--gold); text-shadow: 0 0 6px #D2662E66;
  pointer-events: none;
  z-index: 6; /* hangs into the NEXT sibling (#stream, z 5) — must paint above it */
}
header h1 {
  font-family: var(--serif);
  background: linear-gradient(180deg, var(--gold-hi) 20%, var(--gold) 55%, var(--gold-dim));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 6px #0008;
  letter-spacing: 3px;
}
#mode-tag:not(:empty) {
  font-variant-caps: small-caps; letter-spacing: 1px; color: var(--gold);
  border: 1px solid #D2662E40; border-radius: 999px; padding: 2px 10px 3px;
  background: #D2662E11;
}
header .stat label { font-variant-caps: small-caps; letter-spacing: 1.2px; color: #6b7689; }
header .stat b {
  font-family: var(--serif);
  background: linear-gradient(180deg, #f4f7fc, #b9c4d6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#score-stat b { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); -webkit-background-clip: text; background-clip: text; }

/* ── The rail: a bronze groove the tiles ride in ── */
#stream {
  background: linear-gradient(180deg, #10141d, #0d1118 60%, #10141d);
  box-shadow: 0 -1px 0 #060810 inset;
}
#stream::before {
  content: '';
  position: absolute; left: 12px; right: 10px; top: 50%; height: 2px;
  background: linear-gradient(90deg, #2a3143, #3d4356 30%, #3d4356 70%, transparent);
  box-shadow: 0 1px 0 #000;
  pointer-events: none;
}
#rail-countdown {
  font-family: var(--serif); color: var(--gold);
  border: none; background: #14120b99;
  clip-path: var(--hexclip);
  text-shadow: 0 0 8px #D2662E55;
}

/* ── Tiles: carved bone HEXAGONS ──
   The button itself stays an unclipped rectangle so the expanded touch zones
   survive; .hexbg paints the clipped hex material behind the glyph. */
:root { --hexclip: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.stile, .rslot.filled, .rslot.reserved, .rslot, .drag-ghost {
  background: none !important; border: none !important; box-shadow: none !important;
  isolation: isolate; /* keep the z-index:-1 hexbg INSIDE the tile, not behind the dock */
}
.hexbg {
  position: absolute; inset: 0; z-index: -1;
  clip-path: var(--hexclip);
  background: linear-gradient(178deg, #9a7c34, #6e5520 70%);
  filter: drop-shadow(0 2.5px 2.5px #0009);
}
.hexbg::before {
  content: ''; position: absolute; inset: 1.4px;
  clip-path: var(--hexclip);
  background: linear-gradient(168deg, #f7ecd0 0%, var(--tile) 48%, #c39a48 130%);
}
.hexbg.empty { background: #29324477; filter: none; }
.hexbg.empty::before { background: radial-gradient(100% 100% at 50% 25%, #10141d, #0b0e15); }
.stile, .rslot.filled { color: var(--tile-ink); text-shadow: 0 1px 0 #fff6; }
.stile { font-family: var(--serif); }
.rslot.filled { font-family: var(--serif); }
.stile .val, .rslot.filled .val { color: #00000088; text-shadow: none; font-family: system-ui, sans-serif; right: 9px !important; bottom: 13px !important; }
/* Fuse bars: a quiet groove with a muted charge — legible, not shouting */
.stile::before, .rslot.filled::before {
  content: '';
  position: absolute; left: 13px; right: 13px; bottom: 9px; height: 3px;
  background: #00000026; border-radius: 2px;
  pointer-events: none; z-index: 1;
}
.stile .life, .rslot.filled .life {
  left: 13px; right: 13px; height: 3px; bottom: 9px; border-radius: 2px;
  background: #6f9d7c;
  box-shadow: none;
  z-index: 1;
}
.stile .life.low, .rslot.filled .life.low {
  background: #c65f5c;
}

/* Reserved slots: a pending tile still owns this space (tap to recall it) */
.rslot.reserved {
  color: #efe1bd55;
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  cursor: pointer; text-transform: uppercase;
}
.reserved .hexbg { background: #7e622466; filter: none; }
.reserved .hexbg::before { background: linear-gradient(168deg, #f7ecd014, #b98f3e0a); }
.rslot.reserved .val { position: absolute; right: 10px; bottom: 7px; color: #D2662E55; font-size: 12px; text-shadow: none; }
.rslot {
  border-color: #2a3143;
  background: radial-gradient(100% 100% at 50% 20%, #0d1119, #0a0d13);
  box-shadow: 0 2px 5px #0007 inset, 0 1px 0 #222b3d;
}
.rslot.sel { outline-color: var(--gold-hi); box-shadow: 0 0 14px #EE8B4E55; }
.stile.special, .rslot.filled.special { color: #e6dcff; text-shadow: 0 0 8px #b39dff88; }
.special .hexbg { background: linear-gradient(178deg, #7a63b8, #453578 70%); }
.special .hexbg::before { background: linear-gradient(168deg, #55468c 0%, #2c2450 55%, #191338 130%); }
.rslot.sel { outline: none !important; }
.rslot.sel .hexbg { filter: drop-shadow(0 0 7px var(--gold-hi)); }
.rslot.sel .hexbg::before { background: linear-gradient(168deg, #fff6d8 0%, #EE8B4E 48%, #c39a48 130%); }
.drag-ghost { font-family: var(--serif); filter: drop-shadow(0 8px 14px #000b); }
.drag-ghost .hexbg { filter: none; }

/* ── The dock: an altar shelf ── */
#dock {
  background: linear-gradient(180deg, #1a2030, #12161f 70%);
  border-top: 1px solid #060810;
  box-shadow: 0 1px 0 #2e3850 inset;
}

/* ── Footer: one engraved bar, buttons as segments ── */
#dock { position: relative; }
#dock::before {
  content: '◆';
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%);
  font-size: 8px; color: var(--gold); text-shadow: 0 0 6px #D2662E66;
  pointer-events: none;
}
#actions {
  background: linear-gradient(180deg, #10141d, #0c0f16);
  border: 1px solid #060810; border-radius: 14px; padding: 5px;
  box-shadow: 0 1px 0 #2a3346 inset, 0 2px 6px #0007;
}
#actions button {
  background: none; border: none; box-shadow: none;
  border-radius: 10px;
  color: #cdd6e6;
  font-variant-caps: small-caps; letter-spacing: .5px;
  transition: background .1s ease, filter .12s;
}
#actions button + button { position: relative; }
#actions button + button::before {
  content: ''; position: absolute; left: -4.5px; top: 20%; bottom: 20%; width: 1px;
  background: #ffffff12; pointer-events: none;
}
#actions button:active { background: #ffffff0a; transform: none; }

/* ── Buttons: embossed plaques (overlay cards only — the dock is a segmented bar) ── */
.card button {
  background: linear-gradient(180deg, #262f42, #1a2130 60%, #151b27);
  border: 1px solid #0a0d14;
  box-shadow: 0 1px 0 #3b4763 inset, 0 -1px 0 #0e1119 inset, 0 2px 5px #0008;
  color: #cdd6e6;
  font-variant-caps: small-caps; letter-spacing: .5px;
  transition: transform .06s ease, box-shadow .06s ease, filter .12s;
}
.card button:active { transform: translateY(1px); box-shadow: 0 1px 0 #3b4763 inset, 0 1px 2px #0008; }
#btn-submit, .card button:not(.ghost) {
  background: linear-gradient(180deg, #EE8B4E, #D2662E 45%, #B85320);
  border-color: #7a3410;
  box-shadow: 0 1px 0 #ffe4c8aa inset, 0 -2px 3px #00000030 inset, 0 3px 7px #000a;
  color: #241a04; text-shadow: 0 1px 0 #ffdcb466;
}
#btn-bomb.armed { background: linear-gradient(180deg, #f2837f, #d64f4a 50%, #9c2f2c); border-color: #6d1a18; color: #2a0605; }
#actions button:disabled { filter: grayscale(.5) brightness(.7); }

/* ── The board: a dark ritual table ── */
#board-wrap {
  background:
    radial-gradient(90% 70% at 50% 30%, #18202f 0%, #121824 45%, #0b0e15 100%);
}
#board-wrap::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, #00000055 100%);
}

/* ── Score float: illuminated numerals ── */
.float-score {
  font-family: var(--serif); font-style: italic;
  background: linear-gradient(180deg, #ffe9cf, var(--gold-hi) 60%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 5px #000c) drop-shadow(0 0 10px #D2662E66);
}

/* ── Toast: a message plaque ── */
#toast {
  background: linear-gradient(180deg, #1c2230f2, #12161ff2);
  border: 1px solid #0a0d14;
  box-shadow: 0 1px 0 #3b4763 inset, 0 0 0 1px #D2662E33, 0 6px 18px #000c;
}

/* ── Overlays: illuminated manuscript cards ── */
.overlay { background: #05070bd8; backdrop-filter: blur(3px); }
.card {
  background: linear-gradient(180deg, #1b2231, #141924 80%);
  border: 1px solid #0a0d14;
  box-shadow:
    0 1px 0 #35405a inset, 0 0 0 1px #D2662E26,
    0 0 0 5px #10141c, 0 0 0 6px #D2662E1f,
    0 18px 50px #000d;
}
.card h2 {
  font-family: var(--serif); letter-spacing: 1px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 8px; position: relative;
}
.card h2::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--gold) 0%, #D2662E33 60%, transparent);
}
.card .big, #end-total { font-family: var(--serif); text-shadow: 0 0 18px #7bd88f44, 0 2px 4px #000a; }
#home .logo {
  font-family: var(--serif); letter-spacing: 5px;
  background: linear-gradient(180deg, var(--gold-hi) 15%, var(--gold) 55%, var(--gold-dim));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 8px #000b);
}
#home .logo span { color: transparent; }
.crest {
  width: 54px; height: 60px; margin: 0 auto 10px;
  clip-path: var(--hexclip);
  background: linear-gradient(178deg, #DC7038, #B85320 70%);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.crest::before {
  content: ''; position: absolute; inset: 2px;
  clip-path: var(--hexclip);
  background: radial-gradient(100% 100% at 50% 20%, #232b3d, #12161f 75%);
}
.crest span {
  position: relative; font-size: 24px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px #D2662E66);
}
.tagline {
  text-align: center; font-variant-caps: small-caps; letter-spacing: 2px;
  color: var(--gold-dim); font-size: 13px !important; margin-top: -4px;
}
.rule {
  height: 1px; margin: 16px 8px 4px; position: relative;
  background: linear-gradient(90deg, transparent, #D2662E44 25%, #D2662E44 75%, transparent);
}
.rule::after {
  content: '◆'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 7px; color: var(--gold); background: none;
}
#end .big {
  text-align: center; font-size: 46px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
#end .big::before, #end .big::after {
  content: '✦'; font-size: 16px; color: var(--gold);
  text-shadow: 0 0 8px #D2662E66;
}
#end-sil:not(:empty) {
  background: #0b0e15;
  border: 1px solid #D2662E29; border-radius: 10px;
  padding: 12px 8px; margin: 10px 0;
  box-shadow: 0 2px 8px #0006 inset;
}
#end table td { border-bottom: 1px solid #ffffff0a; padding: 6px 0; }
#end table td:first-child { font-variant-caps: small-caps; color: var(--dim); }
#end table td:last-child { font-family: var(--serif); color: var(--ink); }
#end-title, #intro h2, #ach h2, #lb h2, #picker h2 { text-align: center; }
#end-title::before { content: '─ '; color: var(--gold-dim); }
#end-title::after { content: ' ─'; color: var(--gold-dim); }
#lb h3 { font-family: var(--serif); }
.cal-day.played {
  background: linear-gradient(180deg, #EE8B4E, #C25526);
  box-shadow: 0 1px 3px #0008, 0 1px 0 #fff5 inset;
}
.cal-day.today { border-color: var(--gold); box-shadow: 0 0 8px #D2662E44; }
#end-sil { text-shadow: 0 2px 8px #0009; }
#end-streak { font-family: var(--serif); }
#freeze-tag { text-shadow: 0 0 10px #4cc9f088; }
.name-row input {
  background: #0b0e15; border-color: #2a3346;
  box-shadow: 0 2px 5px #0006 inset;
}
#picker-grid button {
  background: linear-gradient(168deg, #f7ecd0, var(--tile) 55%, #b98f3e 140%);
  border: 1px solid #7e6224; font-family: var(--serif);
  box-shadow: 0 1px 0 #fff5 inset, 0 2px 4px #0008;
}

/* ── Pause veil & tooltip ── */
#tip {
  border: 1px solid #D2662E40; font-family: var(--serif);
  box-shadow: 0 4px 14px #000b, 0 0 0 1px #05070b;
}
#pause { backdrop-filter: none; }
#pause .pause-veil h2 {
  font-family: var(--serif); letter-spacing: 2px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#pause-count {
  font-family: var(--serif);
  background: linear-gradient(180deg, #f4f7fc, #b9c4d6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#pause .crest span { font-size: 20px; }
#pause .pause-veil button {
  background: linear-gradient(180deg, #EE8B4E, #D2662E 45%, #B85320);
  border: 1px solid #7a3410; color: #241a04;
  font-variant-caps: small-caps; letter-spacing: .5px;
}

/* ── Hints (adaptive tips) & mouse drag ghost ── */
#toast.hint {
  border-color: #D2662E55;
  box-shadow: 0 1px 0 #3b4763 inset, 0 0 0 1px #D2662E66, 0 6px 18px #000c, 0 0 18px #D2662E22;
  font-family: var(--serif); font-style: italic;
}
.drag-ghost.flat { transform: translate(-50%, -50%); opacity: .8; }
#dialog-msg { white-space: pre-line; }

/* ── Rack reorder gap + shuffle ── */
.rslot.gap .hexbg.empty { background: #D2662E66; }
.rslot.gap .hexbg.empty::before { background: radial-gradient(100% 100% at 50% 25%, #1c1a10, #12100a); }

/* ── Medallion buttons: gold-rimmed hex controls (pause, shuffle) ── */
.medallion { filter: drop-shadow(0 3px 5px #000a); }
.medallion::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  clip-path: var(--hexclip);
  background: linear-gradient(178deg, #DC7038, #B85320 78%);
}
.medallion::after {
  content: ''; position: absolute; inset: 1.6px; z-index: -1;
  clip-path: var(--hexclip);
  background: radial-gradient(110% 110% at 50% 16%, #27314a, #141924 75%);
}
.medallion svg { filter: drop-shadow(0 0 4px #D2662E55) drop-shadow(0 1px 1px #000); }
.medallion:active svg { fill: var(--gold-hi); }

/* ── Score: larger, and it moves when it changes ── */
#score-stat b {
  font-size: 21px; display: inline-block; transform-origin: 50% 80%;
}
@keyframes scorepop {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); }
  100% { transform: scale(1); }
}
#st-score.bump-up {
  animation: scorepop .5s cubic-bezier(.2, 1.5, .4, 1);
  filter: brightness(1.7) drop-shadow(0 0 8px #EE8B4E99);
}
#st-score.bump-down {
  animation: scorepop .5s ease-out;
  background: linear-gradient(180deg, #ff9a8a, #ef6461);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 8px #ef646188);
}

/* ── Streams, chips, end ceremony ── */
#stream-select button.active, #lb-tabs button.active {
  background: linear-gradient(180deg, #2c2a1a, #1d1a10);
  border-color: var(--gold); color: var(--gold-hi);
  box-shadow: 0 0 8px #D2662E33 inset;
}
#stream-select button, #lb-tabs button { font-variant-caps: small-caps; letter-spacing: .5px; }
.chip { font-family: var(--serif); }
.chip.gold {
  background: linear-gradient(180deg, #EE8B4E, #C25526); color: #241a04;
  border-color: #7a3410; font-weight: 700;
}
#end .card.ceremony { animation: cardpop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes cardpop { 0% { transform: scale(.9) translateY(14px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
#end-total.landed { animation: scorepop .5s cubic-bezier(.2, 1.5, .4, 1); }

/* ── Settings + arena invite ── */
#btn-arena-invite {
  background: linear-gradient(180deg, #EE8B4E, #D2662E 45%, #B85320) !important;
  border: 1px solid #7a3410 !important; color: #241a04 !important;
  box-shadow: 0 1px 0 #ffe4c8aa inset, 0 3px 7px #000a;
  font-variant-caps: small-caps; letter-spacing: .5px;
}
