:root {
  --gold: #d9b45a; --gold-hi: #f5dc8e; --gold-lo: #8a6a26;
  --lapis: #1d3a73; --lapis-deep: #0e1d3d; --ivory: #f1e6c8;
  --ink: #0b0906; --glass: rgba(14, 11, 7, .78); --line: rgba(217, 180, 90, .35);
  --red: #e2563b; --green: #57d98a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--ivory); font-family: 'Lato', system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
#canvas-container { position: fixed; inset: 0; }
canvas { display: block; touch-action: none; }
.hidden { display: none !important; }
.muted { color: #a99c80; font-size: .85rem; }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(0,0,0,.65) 100%); }

/* ---------- buttons ---------- */
button {
  position: relative; overflow: hidden; cursor: pointer; border: 0; border-radius: 3px;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 1rem; letter-spacing: .06em; color: #1a1206;
  padding: 12px 26px; background: linear-gradient(160deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo));
  box-shadow: 0 0 0 1px rgba(255,235,170,.35) inset, 0 6px 18px rgba(0,0,0,.45);
  transition: transform .12s, filter .2s, box-shadow .2s;
}
button::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; pointer-events: none; }
button:hover:not(:disabled)::after { transform: translateX(120%); }
button:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255,235,170,.5) inset, 0 0 24px rgba(217,180,90,.35), 0 8px 20px rgba(0,0,0,.5); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { background: #3a342a; color: #7d7462; cursor: default; box-shadow: none; }
button small { display: block; font-family: 'Lato', sans-serif; font-weight: 400; font-size: .72rem; letter-spacing: .02em; opacity: .75; margin-top: 2px; }
button.ghost { background: rgba(255,255,255,.03); color: var(--gold); box-shadow: 0 0 0 1px var(--line) inset; }
button.ghost:hover:not(:disabled) { background: rgba(217,180,90,.1); }
button.small { padding: 6px 14px; font-size: .8rem; }
button.big { padding: 16px 44px; font-size: 1.2rem; }
button.icon { padding: 0; width: 42px; height: 42px; font-size: 1.1rem; background: var(--glass); color: var(--gold); box-shadow: 0 0 0 1px var(--line) inset; font-family: system-ui; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
#gate { background: radial-gradient(ellipse at 50% 40%, #1b140a 0%, #050403 70%); gap: 14px; transition: opacity 1s; }
#gate.leaving { opacity: 0; pointer-events: none; }
.sigil { width: 120px; color: var(--gold); filter: drop-shadow(0 0 18px rgba(217,180,90,.45)); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { filter: drop-shadow(0 0 34px rgba(217,180,90,.75)); transform: scale(1.03); } }
.gate-title, #title-card h1, .logo { font-family: 'Cinzel Decorative', 'Cinzel', serif; }
.gate-title { margin: 6px 0 0; font-size: clamp(1.8rem, 5vw, 3.4rem); color: var(--gold); letter-spacing: .06em; text-shadow: 0 0 30px rgba(217,180,90,.35); }
.gate-sub { margin: 0 0 18px; font-family: 'Cinzel', serif; color: #b9a678; letter-spacing: .2em; font-size: .85rem; text-transform: uppercase; }
.gate-hint { color: #7d7058; font-size: .8rem; letter-spacing: .1em; }
#loading { position: absolute; bottom: calc(24px + var(--safe-b)); color: #6f6450; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; }

/* ---------- cinematic ---------- */
#fade { position: fixed; inset: 0; background: #000; z-index: 40; pointer-events: none; opacity: 0; transition: opacity 1.5s; }
#letterbox .bar { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 41; transition: height 1.2s cubic-bezier(.7,0,.2,1); }
#letterbox .top { top: 0; } #letterbox .bottom { bottom: 0; }
#letterbox.on .bar { height: 11vh; }
#caption { position: fixed; left: 50%; bottom: 14vh; transform: translateX(-50%); z-index: 42; width: min(92vw, 820px); padding: 14px 28px; text-align: center; font-family: 'Cinzel', serif; font-weight: 600; font-size: clamp(1rem, 2.6vw, 1.5rem); color: #f6ead0; letter-spacing: .08em; text-shadow: 0 0 2px #000, 0 2px 4px #000, 0 0 18px rgba(0,0,0,.9); background: radial-gradient(ellipse at center, rgba(0,0,0,.72) 0%, rgba(0,0,0,.45) 55%, transparent 80%); opacity: 0; transition: opacity 1.1s, letter-spacing 4s; pointer-events: none; }
#caption.on { opacity: 1; letter-spacing: .12em; }
#title-card { position: fixed; inset: 0; z-index: 42; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 1.4s;
  /* dark scrim so the title reads over the bright, gilded board */
  background: radial-gradient(ellipse 75% 50% at 50% 50%, rgba(4,3,1,.88) 0%, rgba(4,3,1,.7) 40%, rgba(4,3,1,.25) 70%, transparent 90%); }
#title-card.on { opacity: 1; }
#title-card .t-pre { font-family: 'Cinzel', serif; font-weight: 700; color: #f0dca4; letter-spacing: .6em; font-size: clamp(.9rem, 2.2vw, 1.25rem); text-transform: uppercase; text-shadow: 0 0 2px #000, 0 2px 6px #000; }
#title-card h1 { margin: 6px 0; font-size: clamp(2.2rem, 8vw, 6rem); line-height: 1; text-align: center;
  background: linear-gradient(100deg, #c9962b 0%, #f5dc8e 30%, #fff6d6 45%, #f0cd70 60%, #c9962b 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 1px rgba(40,25,5,.55);
  filter: drop-shadow(0 2px 0 #3a2708) drop-shadow(0 6px 14px rgba(0,0,0,.95)) drop-shadow(0 0 28px rgba(217,180,90,.35)); letter-spacing: .3em; transition: letter-spacing 3s cubic-bezier(.2,.7,.2,1); }
#title-card.on h1 { letter-spacing: .04em; animation: shimmer 4s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.t-rule { width: 0; height: 2px; margin: 14px 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); transition: width 2s 0.5s; }
#title-card.on .t-rule { width: min(60vw, 520px); }
.t-sub { font-family: 'Cinzel', serif; font-weight: 600; color: #f6ead0; letter-spacing: .14em; font-size: clamp(.85rem, 2vw, 1.15rem); text-shadow: 0 0 2px #000, 0 2px 6px #000, 0 0 16px rgba(0,0,0,.9); opacity: 0; transition: opacity 1.5s 1.2s; text-align: center; padding: 0 16px; }
#title-card.on .t-sub { opacity: 1; }
#skip-intro { position: fixed; right: 18px; bottom: calc(13vh + var(--safe-b)); z-index: 43; }

/* ---------- menu ---------- */
#menu { justify-content: center; align-items: flex-start; padding-left: clamp(16px, 7vw, 120px); background: linear-gradient(90deg, rgba(5,4,3,.9) 0%, rgba(5,4,3,.55) 38%, transparent 65%); }
.menu-panel { width: min(400px, 92vw); display: flex; flex-direction: column; gap: 12px; text-align: left; animation: rise .8s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.logo { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.02; color: var(--gold); text-shadow: 0 0 28px rgba(217,180,90,.35); margin-bottom: 6px; }
.logo span { display: block; font-family: 'Cinzel', serif; font-size: .9rem; letter-spacing: .5em; color: #b9a678; text-transform: uppercase; }
.menu-page { display: flex; flex-direction: column; gap: 10px; animation: rise .35s ease-out; }
.menu-page h3 { margin: 4px 0; font-family: 'Cinzel', serif; color: var(--gold); letter-spacing: .08em; font-weight: 600; }
.menu-page > button { text-align: left; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-family: 'Cinzel', serif; font-size: .8rem; color: #b9a678; letter-spacing: .08em; }
.field input[type=text], .field input:not([type]), .join-row input, select {
  font: 600 1rem 'Cinzel', serif; color: var(--ivory); background: rgba(0,0,0,.45); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; letter-spacing: .05em; }
select { appearance: none; cursor: pointer; }
input[type=range] { accent-color: var(--gold); width: 100%; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: #cfc2a0; }
.join-row { display: flex; gap: 8px; } .join-row input { flex: 1; text-transform: uppercase; text-align: center; letter-spacing: .4em; min-width: 0; }
.home-link { align-self: flex-start; color: #b9a678; font-size: .8rem; letter-spacing: .04em; text-underline-offset: .25em; padding: 4px 0; }
.home-link:hover { color: var(--gold-hi); }
.menu-foot { margin-top: 10px; color: #6f6450; font-size: .72rem; letter-spacing: .04em; }
.room-code { font: 700 2.6rem 'Cinzel', serif; letter-spacing: .3em; color: var(--gold-hi); text-shadow: 0 0 20px rgba(217,180,90,.5); margin: 4px 0 10px; }
.seeker { display: flex; gap: 8px; margin: 6px 0 12px; } .seeker i { width: 10px; height: 10px; background: var(--gold); transform: rotate(45deg); animation: seek 1.2s ease-in-out infinite; } .seeker i:nth-child(2) { animation-delay: .2s; } .seeker i:nth-child(3) { animation-delay: .4s; }
@keyframes seek { 50% { opacity: .2; transform: rotate(45deg) scale(.6); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > *, #hud button { pointer-events: auto; }
#hud-top { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; right: 14px; display: flex; align-items: flex-start; gap: 12px; pointer-events: none; }
#hud-top > * { pointer-events: auto; }
.player-badge { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; background: var(--glass); border: 1px solid rgba(255,255,255,.08); border-radius: 40px; backdrop-filter: blur(6px); transition: all .35s; opacity: .6; position: relative; }
.player-badge.active { opacity: 1; border-color: var(--gold); box-shadow: 0 0 22px rgba(217,180,90,.35); transform: scale(1.04); }
#p2-badge { margin-left: auto; flex-direction: row-reverse; padding: 8px 8px 8px 14px; text-align: right; }
.emblem { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.e1 { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Ccircle r='46' fill='%23b33a19' stroke='%23d4af37' stroke-width='6'/%3E%3Cpolygon fill='%23f0cd70' points='0,-36 7,-7 36,0 7,7 0,36 -7,7 -36,0 -7,-7'/%3E%3Cpolygon fill='%23f0cd70' points='22,-22 9,0 22,22 0,9 -22,22 -9,0 -22,-22 0,-9'/%3E%3Ccircle r='8' fill='%23b33a19' stroke='%23f0cd70' stroke-width='3'/%3E%3C/svg%3E") center/contain no-repeat; filter: drop-shadow(0 0 4px rgba(217,180,90,.5)); }
.e2 { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Ccircle r='46' fill='%23141117' stroke='%23c8ccd4' stroke-width='6'/%3E%3Cg fill='%23e6e8ee'%3E%3Crect x='-30' y='9' width='60' height='14'/%3E%3Crect x='-21' y='-3' width='42' height='12'/%3E%3Crect x='-13' y='-13' width='26' height='10'/%3E%3Crect x='-6' y='-21' width='12' height='8'/%3E%3C/g%3E%3Crect x='-2.5' y='-13' width='5' height='36' fill='%23141117'/%3E%3C/svg%3E") center/contain no-repeat; filter: drop-shadow(0 0 4px rgba(200,204,212,.45)); }
.pname { font-family: 'Cinzel', serif; font-weight: 700; font-size: .95rem; letter-spacing: .04em; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.pips { display: flex; gap: 4px; margin-top: 4px; } #p2-badge .pips { justify-content: flex-end; }
.pips i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #6b6048; }
.pips i.board { border-color: var(--gold); background: rgba(217,180,90,.25); }
.pips i.off { border-color: var(--gold-hi); background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.presence { position: absolute; top: 4px; width: 8px; height: 8px; border-radius: 50%; display: none; }
#p1-badge .presence { left: 34px; } #p2-badge .presence { right: 34px; }
.online .presence { display: block; background: var(--green); box-shadow: 0 0 6px var(--green); }
.online .presence.off { background: var(--red); box-shadow: 0 0 6px var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#center-top { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 4px; pointer-events: none !important; }
#turn-banner { font-family: 'Cinzel', serif; font-weight: 700; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-size: .9rem; text-shadow: 0 2px 8px #000; transition: opacity .3s; text-align: center; }
#room-chip { font: 600 .72rem 'Cinzel', serif; letter-spacing: .12em; color: #b9a678; background: var(--glass); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); }
#corner { display: flex; gap: 8px; }

#dice-panel { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(22px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 18px 14px; background: var(--glass); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(6px); min-width: 190px; }
#dice-value { font: 700 1.1rem 'Cinzel', serif; color: #e6d7ad; letter-spacing: .08em; min-height: 1.3em; }
#roll-btn { width: 100%; }
#roll-btn.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px rgba(255,235,170,.5) inset, 0 0 28px rgba(217,180,90,.75); } }
#timer { width: 100%; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; visibility: hidden; }
#timer.on { visibility: visible; } #timer div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transform-origin: left; }
#emotes { position: absolute; right: 14px; bottom: calc(22px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; }
#emotes button { padding: 6px 12px; font-size: .75rem; background: var(--glass); color: var(--gold); box-shadow: 0 0 0 1px var(--line) inset; }

.bubble { position: fixed; z-index: 30; padding: 8px 14px; background: var(--ivory); color: #1a1206; font: 700 .85rem 'Cinzel', serif; border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: bubble 2.6s forwards; pointer-events: none; }
@keyframes bubble { 0% { opacity: 0; transform: translateY(6px) scale(.8); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }

/* ---------- announcer ---------- */
#announce { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 20; pointer-events: none; text-align: center; width: 92vw; }
#announce .a { font-family: 'Cinzel Decorative', 'Cinzel', serif; font-weight: 900; font-size: clamp(1.6rem, 6vw, 3.6rem); letter-spacing: .06em; animation: announce 1.7s cubic-bezier(.2,.9,.2,1) forwards; }
#announce .a small { display: block; font-family: 'Cinzel', serif; font-size: .38em; letter-spacing: .25em; font-weight: 700; margin-top: 4px; }
#announce .gold { color: var(--gold-hi); text-shadow: 0 0 24px rgba(245,220,142,.8), 0 3px 0 #6a4f16; }
#announce .red { color: #ff8a6e; text-shadow: 0 0 24px rgba(226,86,59,.85), 0 3px 0 #5a1406; }
#announce .ivory { color: var(--ivory); text-shadow: 0 0 18px rgba(0,0,0,.9); }
#announce .big { font-size: clamp(2.4rem, 10vw, 6rem); }
@keyframes announce { 0% { opacity: 0; transform: scale(1.8); filter: blur(8px); } 14% { opacity: 1; transform: scale(1); filter: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px) scale(.96); } }

#toasts { position: fixed; top: calc(80px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--glass); border: 1px solid var(--line); padding: 8px 16px; border-radius: 20px; font-size: .85rem; animation: rise .3s ease-out; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(4,3,2,.72); backdrop-filter: blur(4px); animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
.card { width: min(440px, 92vw); max-height: 88vh; overflow: auto; padding: 28px; background: linear-gradient(180deg, #19130b, #0e0b07); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 0 60px rgba(217,180,90,.15), 0 30px 60px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 12px; text-align: center; animation: rise .4s cubic-bezier(.2,.8,.2,1); }
.card h2 { margin: 0; font-family: 'Cinzel Decorative', serif; color: var(--gold); font-size: 2rem; }
.rules { text-align: left; width: min(560px, 94vw); } .rules ol { padding-left: 20px; margin: 0; line-height: 1.55; color: #ddd0b0; } .rules li { margin-bottom: 8px; } .rules b { color: var(--gold-hi); }
.end h2 { font-size: clamp(2.4rem, 8vw, 3.6rem); }
.end.lose h2 { color: #c8bfae; }
.end-kicker { font-family: 'Cinzel', serif; letter-spacing: .3em; text-transform: uppercase; font-size: .75rem; color: #b9a678; }
#end-stats { width: 100%; border-collapse: collapse; font-size: .9rem; }
#end-stats th { font: 700 .8rem 'Cinzel', serif; color: var(--gold); padding: 6px; letter-spacing: .06em; }
#end-stats td { padding: 6px; border-top: 1px solid rgba(217,180,90,.15); color: #e6d9b8; }
#end-stats td:first-child { text-align: left; color: #a99c80; }

/* ---------- mobile ---------- */
@media (max-width: 760px), (max-height: 520px) {
  #menu { padding: 16px; align-items: center; background: linear-gradient(180deg, rgba(5,4,3,.55), rgba(5,4,3,.9)); }
  .menu-foot { display: none; }
  #hud-top { left: 8px; right: 8px; top: calc(8px + var(--safe-t)); gap: 6px; }
  .player-badge { padding: 4px 10px 4px 4px; gap: 6px; } #p2-badge { padding: 4px 4px 4px 10px; }
  .emblem { width: 24px; height: 24px; } .pname { font-size: .72rem; max-width: 22vw; }
  .pips i { width: 6px; height: 6px; } .pips { gap: 2px; }
  #turn-banner { font-size: .65rem; } #room-chip { display: none; }
  button.icon { width: 34px; height: 34px; font-size: .9rem; }
  #center-top { position: absolute; top: 52px; left: 0; right: 0; }
  #dice-panel { left: 10px; transform: none; bottom: calc(10px + var(--safe-b)); min-width: 0; padding: 8px 10px; gap: 6px; }
  #dice-value { font-size: .9rem; } #roll-btn { padding: 8px 18px; font-size: .9rem; }
  #emotes { right: 8px; bottom: calc(10px + var(--safe-b)); } #emotes button { padding: 4px 8px; font-size: .65rem; }
  #letterbox.on .bar { height: 7vh; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; transition-duration: .01s !important; } }

/* ---------- player name ---------- */
.name-field { display: flex; flex-direction: column; gap: 6px; font-family: 'Cinzel', serif; font-size: .8rem; color: #b9a678; letter-spacing: .08em; border-radius: 6px; }
.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1; min-width: 0; font: 600 1rem 'Cinzel', serif; color: var(--ivory); background: rgba(0,0,0,.45); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; letter-spacing: .05em; }
.name-row input.auto { border-style: dashed; color: #e9dcbd; }
#name-shuffle { width: 44px; height: 44px; flex: none; }
.name-hint { font-family: 'Lato', sans-serif; letter-spacing: 0; font-size: .78rem; color: #a99c80; line-height: 1.35; }
.name-field.nudge { animation: nudge 1.6s ease-out 2; }
@keyframes nudge { 0% { box-shadow: 0 0 0 0 rgba(245,220,142,.55); } 100% { box-shadow: 0 0 0 14px rgba(245,220,142,0); } }

/* ---------- invite ---------- */
#room-box { display: flex; flex-direction: column; gap: 10px; }
#copy-link { width: 100%; }
#copy-link.done { background: linear-gradient(160deg, #b8f0c8, var(--green) 50%, #2f8f55); }
.invite-url { width: 100%; font: 400 .85rem 'Lato', sans-serif; color: #cfc2a0; background: rgba(0,0,0,.35); border: 1px solid rgba(217,180,90,.2); border-radius: 3px; padding: 8px 10px; user-select: all; -webkit-user-select: all; }

/* ---------- HUD icons, lock ---------- */
button.icon { display: inline-flex; align-items: center; justify-content: center; }
button.icon svg { display: block; }
#lock-btn.on { color: #1a1206; background: linear-gradient(160deg, var(--gold-hi), var(--gold)); }
.plevel { font: 600 .68rem 'Lato', sans-serif; color: #b9a678; letter-spacing: .04em; margin-top: 1px; }
.plevel:empty { display: none; }

/* ---------- pause + settings ---------- */
.pause-levels { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 4px; border-top: 1px solid rgba(217,180,90,.18); }
.pause-levels .row button { padding: 10px 6px; }
.card.settings { text-align: left; }
.card.settings > button { align-self: stretch; }
.card.settings .field input, .card.settings select { font: 600 1rem 'Cinzel', serif; color: var(--ivory); background: rgba(0,0,0,.45); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; }

/* ---------- coach tips ---------- */
.coach { position: fixed; z-index: 35; max-width: min(360px, 88vw); padding: 14px 16px 12px; background: var(--ivory); color: #1a1206; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 10px; animation: rise .3s ease-out; }
.coach p { margin: 0; font: 400 .95rem/1.45 'Lato', sans-serif; }
.coach button { align-self: flex-end; padding: 6px 16px; font-size: .8rem; }
.coach::after { content: ''; position: absolute; width: 14px; height: 14px; background: var(--ivory); transform: rotate(45deg); }
.coach.at-dice { left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); }
.coach.at-dice::after { left: calc(50% - 7px); bottom: -7px; }
.coach.at-corner { right: 14px; top: calc(70px + var(--safe-t)); }
.coach.at-corner::after { right: 24px; top: -7px; }
@media (max-width: 760px), (max-height: 520px) {
  .coach.at-dice { left: 10px; transform: none; bottom: calc(118px + var(--safe-b)); }
  .coach.at-dice::after { left: 40px; }
  .coach.at-corner { right: 52px; top: calc(52px + var(--safe-t)); }
  .coach.at-corner::after { right: -7px; top: 14px; }
  /* five round buttons don't fit beside both badges on a phone: stack them down the right edge */
  #corner { position: fixed; right: 8px; top: calc(52px + var(--safe-t)); flex-direction: column; gap: 6px; }
}

.name-set { display: flex; gap: 6px; }
.name-set button { flex: 1; padding: 6px 8px; font-size: .72rem; letter-spacing: .06em; }
.name-set button.on { background: rgba(217,180,90,.22); color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold) inset; }
.credits { font-size: .75rem; line-height: 1.4; margin: 0; }

/* ---------- progress: menu strip, daily, turns, collection, rewards ---------- */
#menu { overflow-y: auto; }
.menu-panel { padding: 24px 0; }
@media (max-height: 820px) { #menu { justify-content: flex-start; } }
.pstrip { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px 14px; font: 400 .85rem 'Lato', sans-serif; letter-spacing: 0; color: var(--ivory);
  background: rgba(14, 11, 7, .72); box-shadow: 0 0 0 1px var(--line) inset; }
.pstrip:hover:not(:disabled) { background: rgba(30, 23, 12, .85); }
.ps-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ps-title { font: 700 1rem 'Cinzel', serif; color: var(--gold); letter-spacing: .04em; }
.ps-next { color: #a99c80; font-size: .78rem; text-align: right; }
.ps-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.ps-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.ps-streak { display: flex; align-items: center; gap: 6px; color: #d8c9a3; }
.ps-streak svg { color: var(--gold); flex: none; }
.ps-streak.risk svg { color: #ff9a40; }
.ps-streak b { color: var(--ivory); }
.ps-freeze { display: inline-flex; align-items: center; gap: 2px; color: #9fc4ff; margin-left: 4px; }
#daily-btn { background: linear-gradient(160deg, #ffe7a6, #e9b94a 45%, #a2741e); }
#daily-btn.done { background: rgba(255,255,255,.03); color: var(--gold); box-shadow: 0 0 0 1px var(--line) inset; }
.badge { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--red); color: #fff;
  font: 700 .8rem/24px 'Lato', sans-serif; letter-spacing: 0; text-align: center; animation: pulse 2s infinite; }
.dc-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: rgba(14, 11, 7, .6); }
.dc-card b { font: 700 1.1rem 'Cinzel', serif; color: var(--gold); }
.dc-card p { margin: 6px 0 0; font-size: .9rem; color: #e6d9b8; }
.dc-result { margin: 0; font-size: 1rem; }
table.lb { width: 100%; border-collapse: collapse; font-size: .88rem; background: rgba(14, 11, 7, .6); }
table.lb caption { text-align: left; color: #a99c80; font-size: .8rem; padding: 4px 0; }
table.lb th { font: 700 .75rem 'Cinzel', serif; color: var(--gold); text-align: left; padding: 5px 8px; }
table.lb td { padding: 5px 8px; border-top: 1px solid rgba(217,180,90,.12); text-align: left; }
table.lb td:last-child, table.lb th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.lb tr.you td { color: var(--gold-hi); font-weight: 700; background: rgba(217,180,90,.08); }
#turns-list { display: flex; flex-direction: column; gap: 8px; }
.turn-row { text-align: left; }
.turn-row.over { padding: 8px 14px; color: #a99c80; font-size: .9rem; border: 1px dashed rgba(217,180,90,.2); border-radius: 3px; }
#turns-invite { display: flex; flex-direction: column; gap: 8px; }
.card.progress { width: min(520px, 94vw); text-align: left; }
.card.progress > button { align-self: stretch; }
#pm-tabs button[aria-selected="true"] { background: rgba(217,180,90,.18); color: var(--gold-hi); }
#pm-body h4 { margin: 8px 0 6px; font: 700 .9rem 'Cinzel', serif; color: var(--gold); }
ul.ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
ul.ach li { padding: 8px 10px; border: 1px solid rgba(217,180,90,.15); border-radius: 4px; color: #7d7462; font-size: .82rem; }
ul.ach li b { display: block; font: 700 .85rem 'Cinzel', serif; color: #8a8070; }
ul.ach li.got { border-color: var(--line); background: rgba(217,180,90,.08); color: #d8c9a3; }
ul.ach li.got b { color: var(--gold-hi); }
.coll-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coll { text-align: left; font-size: .85rem; padding: 10px 12px; display: flex; flex-direction: column; }
.coll small { margin-top: 4px; }
.sw { display: block; height: 22px; border-radius: 11px; margin-bottom: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset; }
.sw-stones-classic { background: linear-gradient(90deg, #b33a19 50%, #17141a 50%); }
.sw-stones-lapis { background: linear-gradient(90deg, #1d3a8a 50%, #e8e0cc 50%); }
.sw-stones-gold { background: linear-gradient(90deg, #d4a93c 50%, #b9bec7 50%); }
.sw-stones-royal { background: linear-gradient(90deg, #7a1428 50%, #0d2a5c 50%); }
.sw-boards-classic { background: linear-gradient(90deg, #c9b38a, #4a3418); border-radius: 3px; }
.sw-boards-night { background: linear-gradient(90deg, #8fa6e0, #1a2440); border-radius: 3px; }
.sw-boards-gilded { background: linear-gradient(90deg, #fff0c8, #8a6a20); border-radius: 3px; }
.reward { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: 4px; background: rgba(217,180,90,.06); animation: rise .5s cubic-bezier(.2,.8,.2,1); }
.reward p { margin: 0; font-size: .88rem; line-height: 1.45; color: #e6d9b8; }
.reward p svg { color: var(--gold); vertical-align: -3px; margin-right: 4px; }
.reward p button { margin-left: 6px; vertical-align: middle; }
.rw-xp { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rw-xp b { font: 700 1.3rem 'Cinzel', serif; color: var(--gold-hi); }
.rw-xp span { font-size: .8rem; color: #a99c80; text-align: right; }
.rw-up b, .rw-ach b, .rw-unlock b { color: var(--gold-hi); }
.rw-ach b { display: block; }
@media (max-width: 480px) { ul.ach, .coll-grid { grid-template-columns: 1fr; } }
#progress-modal { z-index: 80; } /* opens over the end screen ("Use it") */
