* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: #eee; font-family: -apple-system, system-ui, sans-serif; touch-action: manipulation; overscroll-behavior: none; }
.hidden { display: none !important; }
.view { position: fixed; inset: 0; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
button { font: inherit; color: inherit; border: 0; border-radius: 14px; background: #222; padding: 14px 18px; }
button:active { filter: brightness(1.4); }
button:disabled { opacity: .4; }
button.primary { background: #2a6df4; }
button.danger { background: #5a1f1f; }

header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 56px; }
header .title { flex: 1; text-align: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbtn { padding: 10px 14px; font-size: 15px; background: #1b1b1b; }
.status { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; min-width: 70px; justify-content: flex-end; color: #aaa; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c33; }
.dot.ok { background: #3c6; }

.stage { flex: 1; display: flex; flex-direction: column; padding: 0 12px; gap: 6px; min-height: 0; }
.label { font-size: 12px; letter-spacing: 2px; color: #777; margin-top: 6px; }
.slide { background: #111; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; aspect-ratio: 16 / 9; border: 3px solid transparent; }
.slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide .txt { padding: 10px; white-space: pre-wrap; font-size: 15px; color: #ccc; }
.slide.big { width: 100%; max-height: 38vh; margin: 0 auto; border-color: #2a6df4; }
.slide.small { width: 55%; margin: 0 auto 0 0; opacity: .85; }
.slide.end { color: #777; font-size: 14px; }

.pad { display: grid; grid-template-columns: 1fr 2.6fr; gap: 10px; padding: 10px 12px 14px; height: 32vh; min-height: 150px; }
.back { background: #1d1d1d; font-size: 20px; }
.next { background: #2a6df4; font-size: 34px; font-weight: 700; border-radius: 20px; }

.grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px; align-content: start; -webkit-overflow-scrolling: touch; }
.cell { position: relative; background: #111; border-radius: 10px; overflow: hidden; border: 3px solid transparent; padding: 0; text-align: left; }
.cell .slide { border: 0; border-radius: 0; }
.cell .meta { display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px; font-size: 12px; color: #999; }
.cell.live { border-color: #3c6; }
.cell.sel { border-color: #f5a623; }
.cell .stripe { height: 4px; background: #444; }
.bar { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding: 10px 12px; border-top: 1px solid #222; background: #0a0a0a; }
.banner { background: #4a3a10; color: #f5d68a; text-align: center; padding: 8px; font-size: 14px; }

.tree { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.tree .grp { color: #777; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin: 14px 0 4px; }
.tree button.item { display: block; width: 100%; text-align: left; margin: 4px 0; background: #161616; }
.tree button.item.sel { outline: 2px solid #f5a623; }
.tree .confirm { display: grid; grid-template-columns: 1fr; padding: 4px 0 8px; }

#pair { align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; }
#pair h1 { margin: 0; }
#pair input { font-size: 34px; text-align: center; letter-spacing: 6px; width: 100%; max-width: 340px; padding: 12px; border-radius: 14px; border: 1px solid #333; background: #111; color: #fff; }
#pair button { font-size: 20px; width: 100%; max-width: 340px; }
.err { color: #f66; min-height: 22px; }

.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 70px); transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 15px; z-index: 10; }
