/* Room Bomb – styles. Dark, warm glow, team colours only on cards. */
:root {
  --bg: #0d0e12; --panel: rgba(255,255,255,.045); --panel-2: rgba(255,255,255,.08); --line: rgba(255,255,255,.10);
  --text: #f3f1ee; --muted: #a7a4ad; --accent: #3d7bff; --accent-2: #2a5fe0;
  --blue: #2f6bff; --blue-d: #1a3f9e; --red: #ff3b30; --red-d: #8f1712; --grey: #8a8d96; --grey-d: #4b4e56;
  --green: #3fbf5a; --green-d: #1d6b2e; --purple: #9b5cff; --purple-d: #4d2694; --warn: #ffb648;
  --r: 18px; --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --title: 'Archivo Black', 'Inter', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.45; overscroll-behavior-y: none;
  background-image: radial-gradient(ellipse at 50% -10%, rgba(255,80,40,.18), transparent 55%), radial-gradient(ellipse at 50% 120%, rgba(60,90,255,.12), transparent 55%); background-attachment: fixed; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.screen { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); animation: in .35s ease; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; } h2 { font-size: 22px; } h3 { font-size: 16px; }
p { margin: 6px 0; } .small { font-size: 14px; } .muted { color: var(--muted); } .center { text-align: center; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap { gap: 8px; } .gap > * { flex: 1; }

/* logo */
.logo { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.logo.sm { margin: 0 0 12px; } .logo.sm .bomb { width: 36px; height: 36px; } .logo.sm .lt { font-size: 20px; }
.bomb { position: relative; width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555 0, #1c1c1f 55%, #000 100%); box-shadow: 0 6px 20px rgba(0,0,0,.6); flex: none; }
.fuse { position: absolute; top: -8px; right: 4px; width: 16px; height: 16px; border: 3px solid #c8a26a; border-color: #c8a26a transparent transparent transparent; border-radius: 50%; transform: rotate(40deg); }
.spark { position: absolute; top: -12px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: #ffcf4a; box-shadow: 0 0 12px 4px #ff8a00; animation: spark .5s infinite alternate; }
@keyframes spark { to { transform: scale(1.5); opacity: .6; } }
.lt { font-family: var(--title); font-size: 30px; letter-spacing: 1px; }
.ls { color: var(--muted); font-size: 14px; }

/* panels & buttons */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 12px 0; backdrop-filter: blur(6px); }
details.panel > summary { list-style: none; cursor: pointer; } details.panel > summary h3 { display: inline; } details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ' ▾'; color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px; padding: 12px 16px; font-weight: 600; transition: transform .1s, background .2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:active { transform: scale(.97); } .btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(61,123,255,.35); }
.btn.ghost { background: transparent; } .btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; margin: 8px 0; } .btn.huge { display: flex; width: 100%; padding: 17px; font-size: 18px; margin: 12px 0; border-radius: 16px; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; } .btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 40px; }
.topbar > :last-child, .topbar > :first-child { min-width: 64px; } .topbar > :last-child { text-align: right; }

/* inputs */
.in, select.in { width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin: 6px 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 6px; } .stepper button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 20px; }
.stepper b { min-width: 26px; text-align: center; } .stepper.big button { width: 46px; height: 46px; font-size: 24px; } .stepper.big b { font-size: 28px; min-width: 44px; }
.stepper.sb b { color: #8fb0ff; } .stepper.sr b { color: #ff8c84; }
.switch { display: flex; align-items: center; gap: 4px 10px; margin: 10px 0; cursor: pointer; flex-wrap: wrap; } .switch small { color: var(--muted); flex-basis: 100%; padding-left: 54px; margin-top: -2px; }
.switch input { display: none; } .switch span { width: 44px; height: 26px; border-radius: 13px; background: #3a3b42; position: relative; flex: none; transition: .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::after { left: 21px; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .name-in { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-width: 0; }

/* presets & chips */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; transition: .2s; }
.preset .pi { font-size: 24px; } .preset small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.preset.on { border-color: var(--accent); background: rgba(61,123,255,.18); box-shadow: 0 0 0 1px var(--accent) inset; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 13px; padding: 5px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.chip.t-blue { background: rgba(47,107,255,.22); } .chip.t-red { background: rgba(255,59,48,.22); } .chip.t-green { background: rgba(63,191,90,.22); } .chip.t-purple { background: rgba(155,92,255,.22); }
.bal { display: flex; height: 28px; border-radius: 10px; overflow: hidden; font-size: 12px; font-weight: 700; }
.bal span { display: flex; align-items: center; justify-content: center; min-width: 28px; } .bb { background: var(--blue); } .br { background: var(--red); } .bg { background: var(--grey-d); }
.warn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,182,72,.12); color: #ffd79a; font-size: 14px; }

/* role rows */
.rrow, .erow { border-top: 1px solid var(--line); padding: 8px 0; } .rrow:first-of-type { border-top: 0; }
.rrow summary, .erow summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; } summary::-webkit-details-marker { display: none; }
.rrow p { margin: 6px 0 4px 46px; font-size: 14px; }
.ri { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; background: var(--panel-2); }
.ri.t-blue { background: linear-gradient(135deg, var(--blue), var(--blue-d)); } .ri.t-red { background: linear-gradient(135deg, var(--red), var(--red-d)); }
.ri.t-grey { background: linear-gradient(135deg, var(--grey), var(--grey-d)); } .ri.t-green { background: linear-gradient(135deg, var(--green), var(--green-d)); }
.ri.t-purple { background: linear-gradient(135deg, var(--purple), var(--purple-d)); } .ri.t-both { background: linear-gradient(135deg, var(--blue) 50%, var(--red) 50%); }
.rn { flex: 1; font-weight: 600; } .rn em { font-style: normal; font-size: 11px; color: var(--warn); margin-left: 6px; border: 1px solid rgba(255,182,72,.4); padding: 1px 5px; border-radius: 6px; }
.rt { font-size: 12px; color: var(--muted); }
.erow { display: flex; align-items: flex-start; gap: 8px; } .erow details { flex: 1; min-width: 0; } .erow p { margin: 6px 0 0 46px; }
.steps2 { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.sub { margin: 12px 0 2px; font-weight: 600; font-size: 14px; } .sub small { color: var(--muted); font-weight: 400; }
.elist { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px 8px; }
.echk { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; } .echk:last-child { border: 0; }
.echk input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.echk span { display: flex; flex-direction: column; } .echk small { color: var(--muted); font-size: 12px; }

/* rules */
.win2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .win2 > div { padding: 10px; border-radius: 12px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.win-b { background: rgba(47,107,255,.2); } .win-r { background: rgba(255,59,48,.2); }
.rounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.rounds > div { background: var(--panel-2); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.rounds span { font-size: 22px; font-weight: 800; } .rounds small { color: var(--muted); font-size: 12px; }
.steps, .tight { padding-left: 20px; margin: 6px 0; } .steps li, .tight li { margin: 6px 0; font-size: 15px; }

/* deal */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { aspect-ratio: 3/4; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, #26272e, #15161b); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 34px; transition: .2s; }
.tile span { font-size: 14px; font-weight: 600; } .tile small { font-size: 11px; color: var(--muted); }
.tile.done { opacity: .5; font-size: 26px; } .tile:not(.done):active { transform: scale(.95); }
.bigemo { font-size: 64px; margin: 10px 0; } .shake { animation: shake .6s infinite; }
@keyframes shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.qr-box { background: #fff; border-radius: 18px; padding: 10px; width: min(78vw, 330px); aspect-ratio: 1; margin: 12px auto; display: flex; align-items: center; justify-content: center; }
.qr-box svg { width: 100%; height: 100%; } .qr-box p { color: #333; }
.spinner { width: 36px; height: 36px; border: 4px solid #ddd; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

/* flip card */
.holdwrap, .tapwrap { perspective: 1200px; margin: 10px auto; width: min(82vw, 330px); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.flip { position: relative; aspect-ratio: 5/7; transition: transform .55s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.show .flip { transform: rotateY(180deg); }
.front, .back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; } .back { transform: rotateY(180deg); }
.cover { height: 100%; border-radius: 22px; background: repeating-linear-gradient(45deg, #1d1e24 0 14px, #23242b 14px 28px); border: 2px solid #34353d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 70px; text-align: center; }
.cover span { font-size: 16px; color: var(--muted); padding: 0 16px; }
.holdbtn { margin-top: 14px; width: 100%; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-2); font-size: 18px; font-weight: 700; touch-action: none; }
.holdwrap.show .holdbtn { background: var(--accent); }
.rcard { height: 100%; border-radius: 22px; padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.55); overflow: hidden; position: relative; }
.rcard::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.22), transparent 55%); }
.rcard > * { position: relative; }
.rcard.t-blue { background: linear-gradient(160deg, var(--blue), var(--blue-d)); } .rcard.t-red { background: linear-gradient(160deg, var(--red), var(--red-d)); }
.rcard.t-grey { background: linear-gradient(160deg, var(--grey), var(--grey-d)); } .rcard.t-green { background: linear-gradient(160deg, var(--green), var(--green-d)); }
.rcard.t-purple { background: linear-gradient(160deg, var(--purple), var(--purple-d)); }
.rc-top { width: 100%; display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; opacity: .9; }
.rc-icon { font-size: 92px; margin: auto 0 6px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
.show .rc-icon { animation: pop .6s .3s both; } @keyframes pop { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }
.rc-you { text-transform: uppercase; letter-spacing: 3px; font-size: 12px; opacity: .85; }
.rc-name { font-family: var(--title); font-size: 28px; line-height: 1.1; margin: 2px 0 10px; }
.rc-goal { font-size: 13px; line-height: 1.35; background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px 10px; margin-bottom: auto; }
.howto { margin: 10px 0; text-align: left; } .howto summary { color: var(--muted); cursor: pointer; text-align: center; }

/* rooms */
.roomgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .room { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.room div { padding: 5px 0; border-bottom: 1px solid var(--line); } .room div:last-child { border: 0; }

/* game */
.rdots { display: flex; gap: 6px; } .rdots span { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.rdots .past { background: rgba(61,123,255,.35); color: #fff; } .rdots .now { background: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(61,123,255,.3); }
.announce { min-height: 22px; font-size: 14px; color: var(--muted); text-align: center; margin: 4px 0 8px; }
.announce.pop { animation: apop .5s; color: var(--text); } @keyframes apop { from { transform: scale(1.06); } }
.ringwrap { display: flex; justify-content: center; margin: 20px 0; }
.ring { --p: 0; width: min(76vw, 300px); aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--bg) 84%, transparent 85%), conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); transition: background .3s; }
.ring.hot { background: radial-gradient(closest-side, var(--bg) 84%, transparent 85%), conic-gradient(var(--red) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); animation: hot 1s infinite; }
@keyframes hot { 50% { transform: scale(1.02); } }
.clock { font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; } .ring small { color: var(--muted); }
.steplist { margin: 12px 0; } .stp { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; opacity: .55; }
.stp.now { opacity: 1; border-color: rgba(61,123,255,.6); } .stp.ok { opacity: .7; } .stp p { font-size: 14px; color: var(--muted); }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: in .2s; }
.sheet .panel { width: 100%; max-width: 560px; margin: 0; border-radius: 22px 22px 0 0; background: #17181d; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* result */
.result { text-align: center; padding: 26px 16px; border-radius: 22px; margin: 10px 0; animation: res .8s; }
.result h1 { font-family: var(--title); font-size: 38px; } .r-red { background: linear-gradient(160deg, var(--red), var(--red-d)); } .r-blue { background: linear-gradient(160deg, var(--blue), var(--blue-d)); } .r-none { background: var(--panel-2); }
@keyframes res { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.05); } }
.q { margin-bottom: 12px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: #2a2b32; padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .3s; z-index: 30; font-size: 14px; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
