/* Kai & Koa. Panels are kapa (bark cloth): tan with umber ink and a stamped triangle band.
   The board floats in deep ocean with a lighter reef ring. One accent: ʻōhiʻa lehua red. */
:root {
  --sea: #13495d; --sea-deep: #0a2c3a; --reef: #2b7a82;
  --kapa: #d6b98e; --kapa-2: #c9a878; --kapa-hi: #e9d8b9;
  --umber: #2e1c12; --umber-2: #5b3f2c; --muted: #6e5440;
  --lehua: #b8322a; --gold: #e3a52b;
  --kit-bg: var(--kapa); --kit-ink: var(--umber); --kit-muted: var(--muted); --kit-line: #a88a62; --kit-accent: var(--lehua);
  --kit-p0: #c43b2c; --kit-p1: #2f6db5; --kit-p2: #f1e8d4; --kit-p3: #e08a1e;
  --band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='18'%3E%3Cpath d='M0 18 12 0 24 18Z' fill='%232e1c12'/%3E%3Cpath d='M7 18 12 10.5 17 18Z' fill='%23b8322a'/%3E%3C/svg%3E");
  --band-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='24'%3E%3Cpath d='M18 0 0 12 18 24Z' fill='%232e1c12'/%3E%3Cpath d='M18 7 10.5 12 18 17Z' fill='%23b8322a'/%3E%3C/svg%3E");
  --serif: "Alegreya", Georgia, serif;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--sea-deep); color: var(--umber); font: 16px/1.45 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1.15; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--kapa-hi); border: 1.5px solid var(--umber-2); border-radius: 6px; padding: 7px 13px; color: var(--umber); }
button:hover:not(:disabled) { background: #f3e6cd; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.primary { background: var(--lehua); border-color: #7d1d17; color: #fbf1e2; font-weight: 700; }
.primary:hover:not(:disabled) { background: #cb3b31; }
.big { font-size: 1.1rem; padding: 11px 18px; }
.muted { color: var(--muted); }
.error { color: #ffd9c9; }
.band { height: 18px; background: var(--band) repeat-x; background-size: 24px 18px; }
.band.small { height: 12px; background-size: 16px 12px; margin: -6px 0 12px; }

/* ---------- title ---------- */
#title { min-height: 100vh; color: #f4e7d0; background:
  linear-gradient(90deg, #0a2c3ae6 0%, #0a2c3ab3 30%, #0a2c3a40 55%, #0a2c3a00 70%),
  url("art/title.webp") 62% center / cover no-repeat, var(--sea-deep); }
#title .wordmark, #title .sub { text-shadow: 0 2px 14px #0a2c3a, 0 1px 3px #0a2c3acc; }
#title .band { filter: invert(.88) sepia(.3) hue-rotate(-10deg); }
.titlewrap { max-width: 560px; margin: 0 0 0 clamp(16px, 7vw, 120px); padding: 48px 0 60px; }
.wordmark { font-size: clamp(3.2rem, 11vw, 5.6rem); font-weight: 800; letter-spacing: -.02em; color: #f6ead4; line-height: .95; }
.wordmark .amp { font-style: italic; font-weight: 500; color: var(--gold); }
.sub { font-size: 1.12rem; color: #d9c6a6; margin: 16px 0 30px; max-width: 34em; }
.menu { display: grid; gap: 12px; background: var(--kapa); color: var(--umber); padding: 22px; border-radius: 4px;
  box-shadow: 0 0 0 1px #0004, 0 18px 40px #0007; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M0 20 10 4 20 20' fill='none' stroke='%232e1c12' stroke-opacity='.06'/%3E%3C/svg%3E"); }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.field > span { color: var(--umber-2); font-weight: 500; }
.field input { width: 12em; padding: 7px 10px; border: 1.5px solid var(--umber-2); border-radius: 6px; background: var(--kapa-hi); }
.seg { display: inline-flex; border: 1.5px solid var(--umber-2); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 6px 11px; }
.seg button + button { border-left: 1.5px solid var(--umber-2); }
.seg button.on { background: var(--umber); color: var(--kapa-hi); }
.menu .primary.big { margin-top: 8px; }
.online { display: grid; gap: 10px; padding-top: 12px; border-top: 1.5px dashed #8a6c4f; }
#joinForm { display: flex; gap: 8px; }
#joinForm input { flex: 1; text-transform: uppercase; letter-spacing: .15em; padding: 7px 10px; border: 1.5px solid var(--umber-2); border-radius: 6px; background: var(--kapa-hi); }
#lobby { max-width: 620px; margin: 0 auto; padding: 24px 16px; color: var(--umber); }

#handoff { min-height: 100vh; display: grid; place-items: center; background: var(--sea-deep); }
.handoffbox { background: var(--kapa); padding: 34px 30px; border-radius: 4px; text-align: center; max-width: 420px; margin: 16px; }
.handoffbox p { color: var(--umber-2); }

/* ---------- the game ---------- */
.boardwrap { position: relative; min-height: 0; background-color: var(--sea-deep); background-image:
  radial-gradient(70% 70% at 50% 50%, var(--sea) 0, var(--sea-deep) 100%); background-size: cover; background-position: center; }
#board { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.seaart { opacity: 1; }
.sea { fill: #2b7a8233; stroke: #6ab4b822; stroke-width: 1; }
.hex .rim { fill: none; stroke: #1c120c; stroke-width: 2.2; stroke-opacity: .55; }
.hex .motif { color: #00000040; }
.t-desert .motif { color: inherit; }
.hex .place { font: italic 500 8.2px var(--serif); fill: #f6ecd8; text-anchor: middle; opacity: .8; paint-order: stroke; stroke: #0006; stroke-width: 2px; pointer-events: none; }
.token circle:first-child { fill: #efe1c4; stroke: #2e1c12; stroke-width: 1.4; }
.token text { font: 700 15px var(--serif); text-anchor: middle; fill: var(--umber); }
.token .pip { fill: var(--umber); }
.token.red text, .token.red .pip { fill: var(--lehua); }
.hex.hot .token circle:first-child { fill: #ffe9a8; stroke: var(--gold); stroke-width: 2.4; }
.hex.pulse polygon:first-child { animation: hot 1.4s ease-out 1; }
@keyframes hot { 0% { filter: brightness(1.7) saturate(1.3); } 100% { filter: none; } }
.harbor line { stroke: #e9d8b9; stroke-width: 2.4; stroke-dasharray: 3 2.5; opacity: .8; }
.harbor circle { stroke: #2e1c12; stroke-width: 1.5; }
.harbor text { font: 700 9.5px var(--sans); text-anchor: middle; fill: var(--umber); }
.harbor text.small { font-size: 7px; fill: #f6ecd8; }
.lava { pointer-events: none; }
.lavatint { fill: #1a0602; opacity: .45; }
.lava .flow { fill: none; stroke: #ff7a2a; stroke-width: 3.5; stroke-linecap: round; opacity: .85; }
.trail line { stroke-width: 6.5; stroke-linecap: round; }
.trail .under { stroke: #1c120c; stroke-width: 9.5; }
.piece use { stroke: #1c120c; stroke-width: 1.6; }
.piece.new > *, .trail.new > * { animation: drop .5s cubic-bezier(.3, 1.5, .5, 1) 1; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes drop { 0% { opacity: 0; translate: 0 -16px; scale: 1.15; } 60% { opacity: 1; } 100% { translate: 0 0; scale: 1; } }
.vtarget { fill: #fff4; stroke: #fff; stroke-width: 2.4; cursor: pointer; animation: breathe 1.6s ease-in-out infinite; }
.vtarget:hover { fill: var(--gold); }
.etarget { stroke: #ffffff66; stroke-width: 9; stroke-linecap: round; cursor: pointer; animation: breathe 1.6s ease-in-out infinite; }
.etarget:hover { stroke: var(--gold); }
.htarget { fill: #ffe9a81a; stroke: #ffe9a8; stroke-width: 3; stroke-dasharray: 7 5; cursor: pointer; animation: htglow 1.4s ease-in-out infinite; }
@keyframes htglow { 50% { fill: #ffe9a84d; } }
.htarget:hover { fill: #ff5a1a44; stroke: var(--gold); }
@keyframes breathe { 50% { opacity: .55; } }
.boardtools { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.boardtools button { background: #0a2c3acc; color: #e9d8b9; border-color: #5d8c96; padding: 5px 10px; font-size: .9rem; }
.boardtools button:hover { background: #13495d; }
.hint { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; background: var(--umber); color: var(--kapa-hi); padding: 8px 14px; border-radius: 6px; box-shadow: 0 6px 20px #0008; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); }
.hint button { padding: 3px 10px; background: transparent; color: var(--kapa-hi); border-color: #9a7a5c; }

.gain { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: .92rem; color: var(--umber-2); margin-top: 2px; }
.gain.seven { color: var(--lehua); font-weight: 700; }
.gain.none { color: var(--muted); }
.dice { display: flex; gap: 6px; }
.die { width: 34px; height: 34px; background: #fbf4e6; border: 1.5px solid var(--umber); border-radius: 7px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 1px; }
.die i { border-radius: 50%; }
.die i.on { background: var(--umber); }
.die.blank { opacity: .35; }
.dice.roll .die { animation: tumble .5s ease-out 1; }
.dice.roll .die + .die { animation-delay: .06s; }
@keyframes tumble { 0% { rotate: -160deg; scale: .6; } 70% { rotate: 12deg; scale: 1.08; } 100% { rotate: 0; scale: 1; } }
.ci { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--umber); }
.ci svg { width: 16px; height: 16px; color: var(--c); }
.chip { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--c); border: 1.5px solid var(--umber); margin-right: 5px; vertical-align: -1px; }
.chip.lg { width: 16px; height: 16px; margin: 0; flex: none; }
.prow > .chip { justify-self: center; }

.card { position: relative; aspect-ratio: 5 / 7; border-radius: 6px; background: var(--c); color: #fff6e6; border: 1.5px solid var(--umber); display: grid; place-items: center; overflow: hidden; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card svg { width: 54%; height: 40%; color: #fff3; position: relative; }
.card img + svg { display: none; }
.card:has(img) .n, .card:has(img) .nm { text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.lavaart { filter: drop-shadow(0 2px 3px #000a); }
.card .n { position: absolute; top: 3px; left: 6px; font: 800 1.3rem/1 var(--serif); text-shadow: 0 1px 2px #0008; }
.card .nm { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: .74rem; font-weight: 700; text-shadow: 0 1px 2px #000a; }
.card.zero { opacity: .42; }
.devs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.devs p { margin: 0; font-size: .92rem; }
.dev { display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; text-align: left; }
.dev svg { width: 22px; height: 26px; color: var(--umber-2); }
.dev span { line-height: 1.1; }
.dev small { display: block; color: var(--muted); }
.dev.ok { border-color: var(--lehua); }
.dev.ok small { color: var(--lehua); font-weight: 700; }

#log ul { list-style: none; margin: 0; padding: 0; }
#log li.turn { margin-bottom: 8px; }
#log h4 { margin: 0 0 3px; font: 600 .78rem var(--sans); color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
#log ul li { padding: 2px 0 2px 9px; border-left: 3px solid var(--c, #a88a62); margin-bottom: 2px; color: var(--umber-2); }
#log > li:first-child ul li { color: var(--umber); }
.who { font-weight: 700; color: var(--umber); }
.who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); border: 1px solid var(--umber); margin-right: 4px; vertical-align: 0; }
.recap { background: #efe0c3; border-left: 4px solid var(--lehua); }
.recap h2 { margin-bottom: 4px; }
.recap ul { margin: 0 0 8px; padding-left: 0; list-style: none; font-size: .92rem; }
.recap li { margin: 3px 0; color: var(--umber-2); }
.recap .got { margin: 0 0 6px; font-weight: 500; }
.recap button { padding: 4px 12px; }
.flyer { position: fixed; z-index: 19; pointer-events: none; }
.fc { display: grid; place-items: center; width: 26px; height: 36px; border-radius: 4px; background: var(--c); border: 1.5px solid #1c120c; box-shadow: 0 4px 10px #0008; overflow: hidden; }
.fc img { width: 100%; height: 100%; object-fit: cover; }
.fc svg { width: 16px; height: 16px; color: #fff8; }
.fc.back { background: repeating-linear-gradient(45deg, #5b3f2c 0 4px, #2e1c12 4px 8px); }
line.recent { stroke: #ffe9a8; stroke-width: 15; stroke-linecap: round; opacity: .75; animation: recent 1.2s ease-in-out infinite; }
circle.recent { fill: #ffe9a855; stroke: #ffe9a8; stroke-width: 2.5; animation: recent 1.2s ease-in-out infinite; }
@keyframes recent { 50% { opacity: .25; } }

.toast { position: fixed; left: 50%; top: 14px; translate: -50% -140%; background: var(--lehua); color: #fff4e6; padding: 9px 16px; border-radius: 6px; margin: 0; transition: translate .25s; z-index: 30; max-width: calc(100% - 32px); box-shadow: 0 8px 24px #0007; }
.toast.on { translate: -50% 0; }
.toast:empty { display: none; }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; background: #06161ecc; display: grid; place-items: center; z-index: 20; padding: 16px; }
.dialog { background: var(--kapa); border-radius: 4px; max-width: 560px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 22px 18px; box-shadow: 0 24px 60px #000a; animation: rise .22s ease-out 1; }
@keyframes rise { from { opacity: 0; translate: 0 10px; } }
.dialog h2 { font-size: 1.45rem; margin-bottom: 8px; }
.dialog h3 { font-size: 1.05rem; margin: 16px 0 4px; color: var(--umber-2); }
.dialog p { margin: 6px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.row.col { flex-direction: column; }
.row.col button { text-align: left; }
.steps { display: grid; gap: 5px; }
.step { display: grid; grid-template-columns: 20px 1fr 30px 22px 30px; gap: 6px; align-items: center; }
.step svg { width: 18px; height: 18px; color: var(--c); }
.step button { padding: 1px 0; font-weight: 700; }
.step b { text-align: center; font: 700 1.1rem var(--serif); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two small, .offer small { display: block; color: var(--muted); margin-bottom: 4px; }
.pickres { display: flex; flex-wrap: wrap; gap: 5px; }
.resbtn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; }
.resbtn svg { width: 17px; height: 17px; color: var(--c); }
.resbtn.on { background: var(--umber); color: var(--kapa-hi); }
.bankrow { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.bankrow > span { color: var(--muted); }
.offer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--kapa-hi); padding: 12px; border-radius: 4px; margin: 10px 0; }
.offer .ci svg { width: 20px; height: 20px; }
.scores { padding-left: 22px; font-size: 1.1rem; }
.scores li { display: flex; justify-content: space-between; max-width: 260px; padding: 2px 0; }
.reslist, .costs { padding-left: 0; list-style: none; }
.reslist li, .costs li { margin: 4px 0; }
.reslist svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.costs svg { vertical-align: -3px; }

/* ---------- phones and small screens ---------- */
@media (max-width: 900px) {
  #title { background: linear-gradient(180deg, #0a2c3acc 0%, #0a2c3a66 40%, #0a2c3add 75%, #0a2c3a 100%), url("art/title.webp") 70% top / auto 62vh no-repeat, var(--sea-deep); }
  .titlewrap { margin: 0 auto; padding: 36px 16px 48px; }
  .menu { padding: 16px 14px; }
  .field { gap: 8px; }
  .field input { width: 9.5em; }
  .seg button { padding: 6px 9px; }
  .boardtools { top: 8px; left: 8px; }
  .boardtools button { font-size: .82rem; padding: 4px 8px; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.badge-res circle { stroke: #f1e4c8; stroke-width: 1.4; }
.badge-res use { color: #fbf1df; }
.badge-res { pointer-events: none; }

/* stage 2 */
.build .why { display: block; font-style: normal; font-size: .8rem; color: var(--lehua); margin-top: 1px; }
.build .why .ci svg { width: 13px; height: 13px; }
.build:disabled .why { opacity: 1; }
.build:disabled { opacity: .62; }
.build.can { border-color: var(--lehua); box-shadow: inset 3px 0 0 var(--lehua); }
.vt .odds { font: 700 9.5px var(--sans); text-anchor: middle; fill: #1c120c; pointer-events: none; }
.vt .vtarget { fill: #fff6e0d0; }
.vt.good .vtarget { fill: #ffe08a; stroke: var(--gold); }
.vt .vtarget:hover { fill: var(--gold); }
.card .rate { position: absolute; top: 3px; right: 3px; font: 700 .66rem/1 var(--sans); background: #f1e4c8; color: var(--umber); padding: 2px 3px; border-radius: 3px; }
#hand.tradeable .card { cursor: pointer; }
#hand.tradeable .card:not(.zero):hover { outline: 2px solid var(--gold); outline-offset: 1px; }
.vt.low { opacity: .55; }
.vt.low .vtarget { r: 8.5px; }

/* stage 3: zoom, tap targets, phones */
.zoom { position: absolute; right: 10px; bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.zoom button { width: 34px; height: 34px; padding: 0; font-size: 1.2rem; line-height: 1; background: #0a2c3acc; color: #e9d8b9; border-color: #5d8c96; }
.zoom button:hover:not(:disabled) { background: #13495d; }
.vhit { fill: transparent; cursor: pointer; }
.ehit { stroke: transparent; stroke-width: 20; stroke-linecap: round; cursor: pointer; }
.hex .place.long { font-size: 6.8px; }
.tog { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #b19066; cursor: pointer; }
.tog input { width: 18px; height: 18px; accent-color: var(--lehua); }
.tog small { color: var(--muted); }

/* stage 5 */
.mark { fill: #fff; stroke: #1c120c; stroke-width: 1.3; pointer-events: none; }
.chip { position: relative; }
.chip .mk { position: absolute; inset: 1px; width: calc(100% - 2px); height: calc(100% - 2px); }
.chip .mk path { fill: #fff; stroke: #1c120c; stroke-width: 1.4; }
.tip { background: #fbf0d6; border-left: 4px solid var(--gold); }
.tip p { margin: 0 0 6px; }
.tip .row { margin-top: 4px; }
.tip button { padding: 3px 10px; font-size: .9rem; }
table.stats { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: .95rem; }
table.stats th { font: 600 .78rem var(--sans); color: var(--muted); text-align: right; padding: 3px 4px; }
table.stats td { text-align: right; padding: 4px; border-top: 1px solid #b19066; font-variant-numeric: tabular-nums; }
table.stats td:first-child, table.stats th:first-child { text-align: left; }
.dicechart { width: 100%; max-width: 420px; display: block; }
.dicechart .bar { fill: var(--umber-2); }
.dicechart .bar.seven { fill: var(--lehua); }
.dicechart .exp { stroke: var(--gold); stroke-width: 2; }
.dicechart text { font: 600 8px var(--sans); text-anchor: middle; fill: var(--umber); }
.dicechart text.cnt { font-size: 7px; fill: var(--muted); }
.small { font-size: .85rem; }

/* tutorial coach */
.coach { position: absolute; top: 52px; left: 10px; width: min(370px, calc(100% - 64px)); background: var(--kapa); border-radius: 4px; padding: 12px 14px 14px; box-shadow: 0 12px 34px #000a; border-top: 4px solid var(--gold); z-index: 5; animation: rise .22s ease-out 1; }
.coach .ch { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.coach .ch small { color: var(--muted); font-weight: 600; }
.coach .skip { padding: 2px 8px; font-size: .8rem; background: transparent; border-color: #a88a62; }
.coach h3 { font-size: 1.2rem; margin: 0 0 4px; }
.coach p { margin: 0; line-height: 1.45; }
.coach .row { margin-top: 10px; }
.coach .waiting { margin-top: 8px; font-style: italic; }
.coach-hl { outline: 3px solid var(--gold) !important; outline-offset: 2px; animation: coachpulse 1.3s ease-in-out infinite; position: relative; z-index: 2; }
@keyframes coachpulse { 50% { outline-color: #ffe9a8; box-shadow: 0 0 0 6px #e3a52b55; } }
.minihand span { cursor: pointer; }

/* ===================== full-screen board layout (26 Oct) ===================== */
:root { --plW: 250px; --acW: 272px; --topH: 50px; --handH: 122px; }
#play { position: relative; height: 100vh; overflow: hidden; }
.boardwrap { position: absolute; inset: 0; }
.stage { position: absolute; inset: 0; }
#board { position: absolute; top: var(--topH); left: calc(var(--plW) + 12px); width: calc(100% - var(--plW) - var(--acW) - 24px); height: calc(100% - var(--topH) - var(--handH)); }
.stage .hint { left: calc(var(--plW) + 12px + (100% - var(--plW) - var(--acW) - 24px) / 2); bottom: calc(var(--handH) + 6px); }
.stage .zoom { right: calc(var(--acW) + 18px); bottom: calc(var(--handH) + 6px); }
.boardtools { z-index: 6; }
.boardtools button.on { background: var(--gold); color: var(--umber); border-color: var(--gold); }

/* the turn line, top centre */
.turnline { position: absolute; top: 9px; left: 50%; translate: -50% 0; z-index: 6; display: flex; align-items: center; gap: 10px; background: #0a2c3ae0; color: #f1e4c8; padding: 5px 14px 5px 8px; border-radius: 22px; border: 1px solid #5d8c96; max-width: calc(100% - 520px); box-shadow: 0 6px 18px #0006; }
.turnline .stline { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.turnline p { margin: 0; font-weight: 500; }
.turnline .who { color: #fff3dc; }
.turnline .gain { color: #d6c09c; margin: 0; }
.turnline .gain .ci { color: #fff3dc; }
.turnline .gain.seven { color: #ff9a6a; }
.turnline .dice:empty { display: none; }
.turnline .die { width: 26px; height: 26px; padding: 3px; }

/* player plaques, left ocean */
.plaques { position: absolute; top: var(--topH); left: 12px; width: var(--plW); display: flex; flex-direction: column; gap: 9px; z-index: 4; }
.plaque { display: grid; grid-template-columns: 58px 1fr auto; grid-template-rows: auto auto auto; column-gap: 10px; align-items: center; background: linear-gradient(135deg, var(--kapa-hi), var(--kapa)); border: 3px solid var(--c); border-radius: 10px; padding: 7px 10px 7px 7px; box-shadow: 0 6px 18px #0007; transition: transform .25s, box-shadow .25s; }
.plaque.active { transform: translateX(8px); box-shadow: 0 0 0 3px #fff3, 0 0 22px var(--c), 0 8px 22px #0008; }
.plaque.me .pname small { color: var(--lehua); font-weight: 700; }
.portrait { grid-row: 1 / 4; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; border: 3px solid var(--c); background: var(--c); display: grid; place-items: center; position: relative; box-shadow: inset 0 0 0 2px #0003; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait span { font: 800 1.6rem var(--serif); color: #fff; text-shadow: 0 1px 3px #0008; }
.portrait .mk { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; }
.portrait .mk path { fill: #fff; stroke: #1c120c; stroke-width: 1.4; }
.pname { min-width: 0; line-height: 1.1; }
.pname b { display: block; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--muted); font-size: .8rem; }
.plaque .pts { font: 800 1.75rem/1 var(--serif); text-align: right; cursor: help; }
.plaque .pts small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.pstats { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: .86rem; color: var(--umber-2); margin-top: 3px; align-items: center; }
.pstats span { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.pstats svg { width: 14px; height: 14px; }
.pstats .badge { margin: 0; font-size: .7rem; padding: 1px 6px; }
.pbar { grid-column: 2 / 4; height: 5px; background: #0000001f; border-radius: 3px; overflow: hidden; margin-top: 5px; }
.pbar i { display: block; height: 100%; background: var(--c); border-right: 1px solid #1c120c55; }

/* right ocean: tutorial, tips and the recap on top; actions at the bottom */
.floaters { position: absolute; top: var(--topH); right: 12px; width: var(--acW); display: flex; flex-direction: column; gap: 10px; z-index: 5; max-height: calc(100% - var(--topH) - 400px); overflow-y: auto; }
.floaters .coach { position: static; width: auto; }
.float { background: var(--kapa); border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 22px #0007; }
.float h2 { font-size: 1.05rem; margin-bottom: 6px; }
.actions { position: absolute; right: 12px; bottom: 12px; width: var(--acW); display: flex; flex-direction: column; gap: 8px; z-index: 5; align-items: stretch; }
.actions .devs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; justify-content: flex-end; }
.actions .devs p { display: none; }
.actions .dev { background: var(--kapa-hi); box-shadow: 0 4px 12px #0006; }
.builds { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.build { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto auto; column-gap: 7px; align-items: center; text-align: left; padding: 6px 8px; background: var(--kapa-hi); border-radius: 8px; box-shadow: 0 4px 12px #0006; min-height: 62px; }
.build .bicon { grid-row: 1 / 4; width: 34px; height: 34px; object-fit: contain; color: var(--umber-2); }
.build b { font-size: .92rem; line-height: 1.1; }
.build .cost { display: inline-flex; gap: 0; flex-wrap: wrap; }
.build .cost svg { width: 14px; height: 14px; }
.build .why { font-style: normal; font-size: .72rem; color: var(--lehua); line-height: 1.15; margin-top: 1px; }
.build .why .ci svg { width: 11px; height: 11px; }
.build:disabled { opacity: .7; }
.build.can { border-color: var(--lehua); box-shadow: inset 0 0 0 1px var(--lehua), 0 4px 12px #0006; }
.build.on { background: var(--umber); color: var(--kapa-hi); }
.tradebtn { padding: 9px; font-weight: 700; background: var(--kapa-hi); box-shadow: 0 4px 12px #0006; border-radius: 8px; }
.mainbtn { align-self: center; width: 148px; height: 148px; border-radius: 50%; border: 4px solid #f6e3bf; display: grid; place-content: center; text-align: center; gap: 2px; margin-top: 4px;
  --mb: radial-gradient(circle at 35% 30%, #e0584a, var(--lehua) 55%, #7d1d17); background: var(--mb); color: #fff6e6; box-shadow: 0 0 0 6px #b8322a55, 0 14px 30px #000a; transition: transform .15s; }
.mainbtn span { font: 800 1.75rem/1 var(--serif); text-shadow: 0 2px 4px #0006; }
.mainbtn small { font-size: .82rem; opacity: .9; }
.mainbtn.go { animation: mainpulse 1.8s ease-in-out infinite; }
#mainBtn:hover, #mainBtn:disabled { background: var(--mb); }
.mainbtn.go:hover { transform: scale(1.05); filter: brightness(1.08); }
.mainbtn.end { --mb: radial-gradient(circle at 35% 30%, #5d9a8d, #2b7a82 55%, #134a50); box-shadow: 0 0 0 6px #2b7a8255, 0 14px 30px #000a; }
.mainbtn.end span { font-size: 1.45rem; }
.mainbtn.wait, .mainbtn.hold { --mb: radial-gradient(circle at 35% 30%, #2a5866, #0a2c3a); border-color: var(--c, #5d8c96); box-shadow: 0 0 0 6px #0a2c3a99, 0 10px 24px #0008; cursor: default; opacity: 1; }
.mainbtn.wait span, .mainbtn.hold span { font-size: 1.2rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mainbtn:disabled { opacity: 1; cursor: default; }
@keyframes mainpulse { 50% { box-shadow: 0 0 0 14px #b8322a22, 0 14px 30px #000a; } }

/* your cards, bottom ocean */
.handbar { position: absolute; left: calc(var(--plW) + 12px); right: calc(var(--acW) + 12px); bottom: 10px; display: flex; justify-content: center; z-index: 4; pointer-events: none; }
.hand { display: flex; gap: 8px; pointer-events: auto; }
.hand .card { width: 70px; box-shadow: 0 6px 16px #0008; border-width: 2px; }
.hand .card .n { font-size: 1.45rem; }
.hand p { color: #e9d8b9; }

/* the log drawer */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 340px; max-width: 92vw; background: var(--kapa); z-index: 12; box-shadow: -12px 0 30px #0009; display: flex; flex-direction: column; padding: 12px 14px; animation: slidein .2s ease-out 1; }
@keyframes slidein { from { translate: 30px 0; opacity: 0; } }
.drawerhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawerhead button { padding: 3px 10px; }
.drawer #log { flex: 1; overflow-y: auto; max-height: none; }

/* the big dice */
.dicestage { position: fixed; inset: 0; pointer-events: none; z-index: 18; }
.dicestage .pair { position: fixed; display: flex; gap: 18px; translate: -50% -50%; }
.bigdie { width: 92px; height: 92px; border-radius: 18px; background: linear-gradient(145deg, #fffaf0, #e8dcc4); border: 3px solid #2e1c12; box-shadow: inset -6px -8px 0 #0000001f, 0 14px 26px #000a; padding: 12px; }
.bigdie .pips { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.bigdie .pips i { border-radius: 50%; }
.bigdie .pips i.on { background: radial-gradient(circle at 40% 35%, #5b3f2c, #1c120c); }
.dicestage .sum { position: fixed; translate: none; transform: translate(-50%,-50%); font: 800 4.8rem/1 var(--serif); color: #ffe9a8; text-shadow: 0 0 18px #e3a52b, 0 0 40px #e3a52b99, 0 3px 6px #000; }
.dicestage .sum.seven { color: #ffb08a; text-shadow: 0 0 18px #ff5a1a, 0 0 44px #ff5a1a99, 0 3px 6px #000; }
.hex.pulse polygon:first-child { animation-delay: .75s; }

/* phones: plaques in a strip above the board, a dock at the bottom */
@media (max-width: 900px) {
  :root { --acW: 0px; }
  #play { height: auto; min-height: 100vh; overflow: visible; padding-bottom: 214px; }
  .boardwrap { position: relative; display: flex; flex-direction: column; min-height: 100vh; }
  .boardtools { position: static; order: 0; padding: 8px 8px 4px; flex-wrap: wrap; }
  .turnline { position: static; translate: none; order: 1; margin: 4px 8px; max-width: none; border-radius: 10px; }
  .plaques { position: static; order: 2; width: auto; flex-direction: row; gap: 5px; padding: 4px 8px; }
  .plaque { flex: 1; min-width: 0; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; padding: 4px 5px; column-gap: 5px; border-width: 2px; border-radius: 8px; }
  .plaque.active { transform: translateY(-3px); }
  .portrait { grid-row: 1 / 3; width: 30px; height: 30px; border-width: 2px; }
  .portrait span { font-size: 1rem; }
  .pname b { font-size: .78rem; }
  .pname small, .pbar { display: none; }
  .plaque .pts { grid-column: 2; font-size: 1.05rem; text-align: left; }
  .plaque .pts small { font-size: .65rem; }
  .pstats { display: none; }
  .stage { position: relative; inset: auto; order: 3; height: min(104vw, 58vh); }
  #board { inset: 0; width: 100%; height: 100%; }
  .stage .hint { left: 8px; right: 52px; bottom: 8px; translate: none; }
  .stage .zoom { right: 8px; bottom: 8px; }
  .floaters { position: static; order: 4; width: auto; max-height: none; overflow: visible; padding: 6px 8px; }
  .float, .floaters .coach { border-radius: 8px; }
  .actions { position: fixed; left: 0; right: 0; bottom: 0; width: auto; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; background: var(--kapa); border-top: 3px solid var(--umber); box-shadow: 0 -8px 24px #0006; z-index: 15;
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; }
  .actions .handbar { position: static; grid-column: 1 / -1; order: -2; pointer-events: auto; }
  .actions .hand { width: 100%; gap: 4px; }
  .actions .hand .card { flex: 1; width: auto; aspect-ratio: auto; height: 46px; }
  .actions .hand .card .n { font-size: 1.1rem; }
  .actions .hand .card .nm { font-size: .64rem; }
  .actions .devs { grid-column: 1 / -1; order: -1; justify-content: flex-start; }
  .actions .devs:empty { display: none; }
  .builds { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .build { grid-template-columns: 1fr; grid-template-rows: auto auto; min-height: 0; padding: 4px; justify-items: center; text-align: center; }
  .build .bicon { grid-row: auto; width: 24px; height: 24px; }
  .build b { font-size: .72rem; }
  .build .cost, .build .why { display: none; }
  .tradebtn { grid-column: 1 / 3; }
  .mainbtn { grid-column: 3 / 5; width: 100%; height: 50px; border-radius: 26px; margin: 0; border-width: 3px; }
  .mainbtn span { font-size: 1.25rem; }
  .mainbtn small { display: none; }
  .mainbtn.end span { font-size: 1.15rem; }
  .handbar { position: static; }
  .bigdie { width: 70px; height: 70px; padding: 9px; border-radius: 14px; }
  .dicestage .sum { font-size: 3.2rem; }
  .drawer { position: fixed; }
}

/* link back to the other punatic.org games */
.moregames { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 6px; color: var(--umber); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.menu .moregames { border: 1.5px dashed #8a6c4f; }
.moregames:hover { background: #0000000d; }
.dialog .row .moregames { margin-left: auto; }
