/* Od ráje k ráji – Hopla (ink #16203A, sun #FFC93C, balloon #C8321F). */
:root { --ink: #16203A; --sun: #FFC93C; --muted: #5d5546; --paper: #fbf6ea; --line: #dccfb3; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: 'Alegreya Sans', system-ui, sans-serif; color: var(--ink); background: #d9c79e; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
#app { position: relative; display: flex; flex-direction: column; height: 100%; }

.bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--ink); color: #fff; }
.ico { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 2px solid #0b1124; border-radius: 10px; background: #2B3758; color: #fff; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.players { flex: 1; display: flex; gap: 6px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.pchip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 99px; border: 2px solid transparent; background: rgba(255,255,255,.08); font-size: 14px; white-space: nowrap; }
.pchip i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.pchip b { color: var(--sun); font-variant-numeric: tabular-nums; }
.pchip small { color: #b9c2d6; }
.pchip.on { border-color: var(--sun); background: rgba(255,201,60,.18); }
.round { color: #9AA6C2; font-size: 13px; white-space: nowrap; }

.stage { position: relative; flex: 1 1 auto; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dock { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: rgba(251,246,234,.95); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); }
.who { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 6px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: 0 0 auto; }
.die { width: 46px; height: 46px; border-radius: 10px; background: #fff; border: 2.5px solid var(--ink); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px; }
.die span { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); place-self: center; }
.die.spin { animation: spin .5s ease-out; }
@keyframes spin { 0% { transform: rotate(0) scale(.8); } 60% { transform: rotate(320deg) scale(1.1); } 100% { transform: rotate(360deg) scale(1); } }
.roll { padding: 10px 16px; border: 3px solid var(--ink); border-radius: 14px; background: var(--sun); font-weight: 800; font-size: 17px; box-shadow: 0 4px 0 var(--ink); }
.home { padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 14px; }
.undo { width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 20px; line-height: 1; }
.dlg h3.titles { margin: 12px 0 4px; font-family: 'Alegreya', serif; font-size: 19px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.dlg ul.titles { list-style: none; padding: 0; margin: 0 0 6px; font-size: 15px; }
.dlg ul.titles li { padding: 2px 0; }
.roll:disabled { opacity: .45; cursor: default; }
.roll:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.banner { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); padding: 10px 24px; border: 3px solid var(--ink); border-radius: 18px; background: var(--sun); font-family: 'Alegreya', serif; font-weight: 800; font-size: 26px; text-align: center; box-shadow: 0 6px 0 var(--ink); pointer-events: none; animation: pop .35s cubic-bezier(.2,1.6,.4,1); max-width: 90%; }
.banner small { display: block; font-family: 'Alegreya Sans', sans-serif; font-size: 15px; font-weight: 700; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.7); opacity: 0; } }

.screen { position: absolute; inset: 0; z-index: 20; display: flex; padding: 16px; background: rgba(22,32,58,.55); overflow: auto; }
.panel { width: min(520px, 100%); margin: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 #0b1124; padding: 20px 22px; }
h1 { margin: 0; font-family: 'Alegreya', Georgia, serif; font-weight: 800; font-size: clamp(36px, 9vw, 52px); line-height: 1; text-align: center; color: #3f8f4f; }
h1 span { color: #c08a14; }
h2.sub { margin: 16px 0 6px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tag { color: var(--muted); text-align: center; margin: 8px 0 4px; line-height: 1.4; }
.note { color: var(--muted); font-size: 14px; }
.center { text-align: center; margin: 8px 0 0; }
.pcount { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pcount button { padding: 8px 0; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 800; font-size: 20px; }
.pcount button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.opt span { font-weight: 700; }
.seg { display: flex; gap: 4px; }
.seg button { padding: 5px 10px; border: 2px solid var(--line); border-radius: 9px; background: #fff; font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); }
.dlg .btns button small { font-weight: 500; font-size: 13px; }
.dlg table.score { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.dlg table.score th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dlg table.score td, .dlg table.score th { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.dlg table.score i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; gap: 6px; align-items: center; }
.prow input { flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 7px 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.prow .sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); flex: 0 0 auto; }
.prow .x { width: 34px; height: 34px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 18px; line-height: 1; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.small { padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; }
.big { display: block; width: 100%; margin-top: 16px; padding: 12px; border: 3px solid var(--ink); border-radius: 14px; background: var(--sun); font-weight: 800; font-size: 20px; box-shadow: 0 4px 0 var(--ink); }
.big.alt { background: #fff; margin-top: 12px; }

.dlg-wrap { position: absolute; inset: 0; z-index: 30; display: flex; padding: 16px; background: rgba(22,32,58,.5); overflow: auto; }
.dlg { width: min(440px, 100%); margin: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 0 #0b1124; animation: pop2 .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop2 { from { transform: scale(.85) rotate(-2deg); opacity: 0; } }
.dlg .top { background: var(--c, #16203A); color: #fff; padding: 8px 14px; display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; }
.dlg .body { padding: 16px 18px 6px; font-size: 19px; line-height: 1.4; }
.dlg .body h2 { margin: 0 0 6px; font-family: 'Alegreya', serif; font-size: 26px; line-height: 1.1; }
.dlg .term { font-family: 'Alegreya', serif; font-weight: 800; font-size: 30px; text-align: center; margin: 6px 0; }
.dlg .eff { display: inline-block; margin: 4px 18px 0; padding: 3px 10px; border-radius: 8px; border: 2px solid currentColor; font-weight: 800; font-size: 16px; }
.dlg .eff.O { color: #2f7d4a; } .dlg .eff.T { color: #a8322d; } .dlg .eff.S { color: #8a5f08; }
.dlg .btns { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px 18px; }
.dlg .btns button { flex: 1 1 auto; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 16px; }
.dlg .btns button.main { background: var(--sun); }
.dlg .timer { font-family: 'Alegreya', serif; font-weight: 800; font-size: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.dlg .timer.low { color: #a8322d; }
.dlg ul { margin: 4px 0; padding-left: 20px; font-size: 16px; }
.dlg .rank { list-style: none; padding: 0; }
.dlg .rank li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.dlg .rank i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
