/* PolyRun viewer stylesheet: circa-2015 CSS 3, flexbox only, flat lean-paint for Tizen 2.4 / Mali-400 & smartphones. */
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #1d4e89;
    color: #f8fafc;
    font-family: "Trebuchet MS", "Segoe UI", Arial, Helvetica, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#world, #world canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#world {
    touch-action: none;
}

/* Top-Left Brand + Compact Info Panel */
.hud-left-col {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 8;
    pointer-events: none;
}

.hud-title-bar {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    height: 34px;
    white-space: nowrap;
}

.hud-brand-icon {
    display: block;
    width: 28px;
    height: 28px;
    margin-right: 8px;
    border-radius: 6px;
    -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.hud-brand-name {
    font-size: 21px;
    font-weight: bold;
    letter-spacing: 0.4px;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.78), 0 1px 2px rgba(0, 0, 0, 0.65);
    line-height: 1;
}

.hud-info-panel {
    margin-top: 6px;
    width: 316px;
    max-width: 92vw;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(14, 22, 38, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.22);
    pointer-events: none;
}

.hud-runner-head {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 5px;
}

.runner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #ffffff;
    background: #f59e0b;
    margin-right: 6px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.runner-name {
    -webkit-flex: 1;
    flex: 1;
    font-size: 13px;
    font-weight: bold;
    color: #ffffff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.biome-pill {
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 213, 79, 0.22);
    border: 1px solid rgba(255, 213, 79, 0.65);
    color: #ffe082;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.4px;
    margin-left: 6px;
    white-space: nowrap;
}

.hud-stats-row {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    padding: 4px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    font-family: monospace;
    font-size: 12px;
}

.stat-item { white-space: nowrap; }
.stat-k {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 9px;
    font-weight: bold;
    color: #93c5fd;
    margin-right: 2px;
}

.hud-divider {
    display: inline-block;
    width: 1px;
    height: 11px;
    margin: 0 5px;
    background: rgba(255, 255, 255, 0.22);
}

.combo-chip {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 4px;
    border-radius: 4px;
    background: #f59e0b;
    color: #1c1203;
    font-size: 9px;
    font-weight: bold;
}

.hud-sub-row {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 11px;
}

.tier-text {
    font-weight: bold;
    color: #86efac;
    letter-spacing: 0.4px;
}

.donut-stat {
    font-family: monospace;
    color: #ffd54f;
    font-weight: bold;
}

.hud-powers {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 11px;
}

.pow-pill {
    display: inline-block;
    margin: 2px 4px 0 0;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: bold;
    color: #0f172a;
    background: #38bdf8;
}
.pow-pill.is-magnet { background: #fb7185; color: #ffffff; }
.pow-pill.is-shield { background: #38bdf8; color: #082f49; }
.pow-pill.is-jetpack { background: #f97316; color: #ffffff; }
.pow-pill.is-double { background: #facc15; color: #271a04; }

.party-hud {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.p-row {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    padding: 3px 6px;
    margin-bottom: 3px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 11px;
}

.p-row.is-active {
    background: rgba(245, 158, 11, 0.28);
    border: 1px solid #fbbf24;
}

.p-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #ffffff;
    margin-right: 6px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.p-name {
    -webkit-flex: 1;
    flex: 1;
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.p-score {
    font-family: monospace;
    color: #fde047;
    font-weight: bold;
    margin-left: 6px;
}

/* Top-Right Action & Utility Bar */
.hud-actions-bar {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 8;
    height: 34px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    white-space: nowrap;
    pointer-events: none;
}

.hud-btn {
    pointer-events: auto;
    display: inline-block;
    margin: 0 0 0 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: rgba(14, 22, 38, 0.84);
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.hud-btn-primary { background: #ea580c; border-color: #fdba74; }
.hud-btn-exit { background: #991b1b; border-color: #fca5a5; }
.hud-btn:active { background: #1e293b; }
.hud-btn-primary:active { background: #c2410c; }

#scene-controls {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    pointer-events: none;
}

.scene-button {
    pointer-events: auto;
    width: 30px;
    height: 30px;
    padding: 5px;
    margin: 0 0 0 6px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 7px;
    background: rgba(14, 22, 38, 0.84);
    color: #ffffff;
    cursor: pointer;
}

.scene-button svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sound-off, .is-muted .sound-on { display: none; }
.is-muted .sound-off { display: block; }
.fullscreen-exit, .is-fullscreen .fullscreen-enter { display: none; }
.is-fullscreen .fullscreen-exit { display: block; }

/* Centered Top Banner */
.hud-notices {
    position: fixed;
    top: 52px;
    left: 10px;
    right: 10px;
    z-index: 9;
    text-align: center;
    pointer-events: none;
}

.center-banner {
    display: inline-block;
    max-width: 94%;
    padding: 7px 16px;
    border-radius: 10px;
    background: rgba(14, 22, 38, 0.92);
    border: 2px solid #facc15;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.center-banner.is-power { background: #0c4a6e; border-color: #38bdf8; }
.center-banner.is-biome { background: #581c87; border-color: #f472b6; }
.center-banner.is-cheer { background: #14532d; border-color: #4ade80; }

/* Center Cards: Turn Ready & Wipeout Summary */
.center-card {
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    z-index: 9;
    width: 470px;
    max-width: 92%;
    max-height: 86%;
    overflow-y: auto;
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.94);
    border: 3px solid #fbbf24;
    text-align: center;
}

.card-eyebrow {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1.4px;
    color: #fde047;
    text-transform: uppercase;
}

.turn-player {
    margin-top: 4px;
    font-size: 32px;
    font-weight: bold;
    color: #ffffff;
}

.turn-char {
    margin-top: 2px;
    font-size: 15px;
    color: #bae6fd;
}

.turn-count {
    margin: 8px 0;
    font-family: monospace;
    font-size: 54px;
    font-weight: bold;
    line-height: 1;
    color: #4ade80;
}

.turn-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #cbd5e1;
}

.summary-card.is-highscore {
    background: rgba(44, 24, 6, 0.96);
    border-color: #facc15;
}

.summary-quip {
    margin-top: 6px;
    font-size: 18px;
    font-weight: bold;
    color: #fca5a5;
}

.summary-card.is-highscore .summary-quip { color: #fde047; }

.summary-player {
    margin-top: 4px;
    font-size: 15px;
    font-weight: bold;
    color: #e2e8f0;
}

.summary-score {
    margin: 4px 0;
    font-family: monospace;
    font-size: 40px;
    font-weight: bold;
    color: #4ade80;
}

.summary-card.is-highscore .summary-score { color: #facc15; }

.summary-meta {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.summary-board {
    text-align: left;
    margin: 8px 0 10px 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.summary-next {
    font-size: 14px;
    font-weight: bold;
    color: #7dd3fc;
    margin-bottom: 10px;
}

.summary-actions, .turn-actions, .overlay-actions {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-justify-content: center;
    justify-content: center;
    margin: 0 -5px;
}

/* Lobby Overlay */
.overlay-card {
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    z-index: 8;
    width: 548px;
    max-width: 92%;
    max-height: 85%;
    overflow-y: auto;
    padding: 18px 20px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.30);
    color: #f8fafc;
}

.overlay-header {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 12px;
}

.overlay-icon {
    width: 60px;
    height: 60px;
    padding: 2px;
    border-radius: 12px;
    margin-right: 14px;
    background: #ffffff;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.overlay-eyebrow {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.2px;
    color: #fcd34d;
}

.overlay-title {
    margin: 2px 0 0 0;
    font-size: 32px;
    line-height: 1.05;
}

.mode-banner {
    padding: 9px 12px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: #1e3a5f;
    border: 1px solid #38bdf8;
}

.mode-banner-tag {
    font-size: 12px;
    font-weight: bold;
    color: #fde047;
    letter-spacing: 0.6px;
}

.mode-banner-sub {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
    color: #e0f2fe;
}

.roster-grid {
    margin: 0 -4px 10px -4px;
    font-size: 0;
}

.roster-slot {
    display: inline-block;
    vertical-align: top;
    width: 50%;
    padding: 4px;
    font-size: 13px;
}

.roster-card {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    padding: 7px 9px;
    border-radius: 8px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.roster-card.is-human {
    background: #173a4c;
    border-color: #38bdf8;
}

.roster-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 8px;
    border: 1px solid #ffffff;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.roster-info {
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
}

.roster-name {
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.roster-char {
    font-size: 11px;
    color: #bae6fd;
}

.roster-role {
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}

.roster-card.is-human .roster-role {
    background: #0284c7;
    color: #ffffff;
}

.local-char-bar {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 7px 10px;
    border-radius: 9px;
    background: #1e293b;
    border: 1px solid #475569;
}

.local-char-lbl {
    font-size: 12px;
    color: #cbd5e1;
    margin-right: 8px;
}

.local-char-name {
    min-width: 140px;
    text-align: center;
    font-size: 14px;
    color: #fde047;
}

.char-btn {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 0;
    border-radius: 7px;
    border: 1px solid #64748b;
    background: #334155;
    color: #ffffff;
    cursor: pointer;
}

.btn-svg-sm {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-big {
    -webkit-flex: 1;
    flex: 1;
    min-width: 136px;
    margin: 5px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
}

.btn-start { background: #16a34a; border-color: #86efac; }
.btn-start:active { background: #15803d; }
.btn-local { background: #ea580c; border-color: #fdba74; }
.btn-local:active { background: #c2410c; }

.overlay-hint {
    margin: 10px 0 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: #cbd5e1;
    text-align: center;
}

/* On-Screen Play Dual-Thumb Controls Bar (Left/Right on left, Jump/Duck on right!) */
.local-touch-bar {
    position: fixed;
    bottom: 14px;
    left: 12px;
    right: 12px;
    z-index: 7;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: flex-end;
    align-items: flex-end;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    pointer-events: none;
}

.touch-lr-group {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    pointer-events: auto;
}

.touch-jd-group {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    pointer-events: auto;
}

.touch-act-btn {
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.54);
    background: rgba(15, 23, 42, 0.76);
    color: #ffffff;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

.touch-lr {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    padding: 0;
}

.btn-arrow-svg {
    display: block;
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.touch-lr:first-child {
    margin-right: 10px;
}

.touch-jump, .touch-duck {
    width: 104px;
    height: 48px;
    font-size: 14px;
    letter-spacing: 0.9px;
}

.touch-jump { margin-bottom: 8px; background: rgba(22, 163, 74, 0.86); border-color: #86efac; }
.touch-duck { background: rgba(234, 88, 12, 0.86); border-color: #fdba74; }
.touch-act-btn:active { background: #38bdf8; color: #0f172a; }

.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Canonical Standard RCWeb QR Panel (copied verbatim from v/style.css, content-box restored!) */
#qrPanel {
    position: fixed;
    bottom: 14px;
    right: 14px;
    z-index: 6;
    width: 166px;
    -webkit-transform-origin: bottom right;
    transform-origin: bottom right;
    -webkit-transform: scale(0.62);
    transform: scale(0.62);
}

#qrPanel.is-compact {
    bottom: 14px;
    -webkit-transform: scale(0.44);
    transform: scale(0.44);
    opacity: 0.82;
}

.rcRoomQrCodeLink, .rcRoomQrCodeLink * {
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin-left: auto;
    margin-right: auto;
    border: solid 8px #fff;
    border-radius: 8px;
    color: #fff;
    background-color: #fff;
    text-align: center;
    -webkit-transition: opacity 1s ease;
    transition: opacity 1s ease;
    text-decoration: none;
    -webkit-transform-origin: center;
    transform-origin: center;
    -webkit-transform: scale(1);
    transform: scale(1);
}

.rcTechLabel {
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    margin: 0 0 8px 0;
    padding: 4px;
    letter-spacing: 0.2em;
    border-radius: 8px 8px 0 0;
}

.rcRoomQrCode {
    width: 150px;
    height: 150px;
}

.rcRoomId {
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    padding: 4px;
    margin: 8px 0 0 0;
    letter-spacing: 0.25em;
    border-radius: 0 0 8px 8px;
}

.conn-status {
    position: fixed;
    left: 14px;
    bottom: 12px;
    z-index: 9;
    font-size: 13px;
    color: #fde047;
    pointer-events: none;
}

#diagnostics {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 10;
    margin: 0;
    padding: 8px 10px;
    background: #0f172a;
    color: #ffffff;
    font: 12px monospace;
    pointer-events: none;
}

.no-script {
    position: fixed;
    top: 40%;
    width: 100%;
    text-align: center;
}

/* Lean-Paint Mode (Tizen 2.4 / Mali-400): flat solid colours, zero shadows/transitions */
body.is-lean .hud-brand-icon { -webkit-box-shadow: none; box-shadow: none; }
body.is-lean .hud-brand-name { text-shadow: none; }
body.is-lean .hud-info-panel { background: #10192b; }
body.is-lean .overlay-card,
body.is-lean .center-card,
body.is-lean .center-banner { background: #0f172a; }
body.is-lean .summary-card.is-highscore { background: #2c1806; }
body.is-lean .hud-btn,
body.is-lean .scene-button,
body.is-lean .touch-act-btn { background: #172338; }
body.is-lean .hud-btn-primary { background: #ea580c; }
body.is-lean .hud-btn-exit { background: #991b1b; }
body.is-lean .touch-jump { background: #16a34a; }
body.is-lean .touch-duck { background: #ea580c; }
body.is-lean .rcRoomQrCodeLink { -webkit-transition: none; transition: none; }

/* Compact Landscape (e.g. 960x540 Tizen TV) */
@media (max-height: 580px) {
    .hud-left-col { top: 8px; left: 8px; }
    .hud-actions-bar { top: 8px; right: 8px; height: 30px; }
    .hud-title-bar { height: 30px; }
    .hud-brand-icon { width: 24px; height: 24px; margin-right: 6px; }
    .hud-brand-name { font-size: 18px; }
    .hud-info-panel { width: 288px; padding: 6px 8px; }
    .overlay-card, .center-card { padding: 12px 14px; }
    .overlay-icon { width: 46px; height: 46px; }
    .overlay-title { font-size: 24px; }
    .turn-count { font-size: 42px; }
    .summary-score { font-size: 30px; }
    #qrPanel { -webkit-transform: scale(0.48); transform: scale(0.48); }
    #qrPanel.is-compact { bottom: 10px; -webkit-transform: scale(0.36); transform: scale(0.36); }
}

/* Landscape smartphone (height <= 460px): hide QR and keep controls compact */
@media (max-height: 460px) {
    #qrPanel { display: none !important; }
    .hud-info-panel { width: 254px; padding: 5px 8px; }
    .local-touch-bar { bottom: 8px; left: 10px; right: 10px; }
    .touch-lr { width: 64px; height: 64px; font-size: 24px; }
    .touch-jump, .touch-duck { width: 92px; height: 40px; font-size: 12px; }
}

/* Narrow Portrait & Smartphone (<= 720px) */
@media (max-width: 720px) {
    .hud-left-col { top: 6px; left: 6px; right: 6px; }
    .hud-title-bar { height: 28px; }
    .hud-brand-icon { width: 22px; height: 22px; margin-right: 6px; }
    .hud-brand-name { font-size: 17px; }
    .hud-actions-bar { top: 6px; right: 6px; height: 28px; }
    .hud-btn { padding: 4px 8px; font-size: 11px; margin-left: 4px; }
    .scene-button { width: 26px; height: 26px; padding: 4px; margin-left: 4px; }
    .hud-info-panel { width: 100%; max-width: 100%; margin-top: 6px; }
    .roster-slot { width: 100%; }
    .turn-player { font-size: 26px; }
    #qrPanel { display: none !important; }
}
