:root {
    --petrol-950: #061f27;
    --petrol-900: #082d34;
    --petrol-800: #0e3e44;
    --petrol-700: #17545a;
    --cream-50: #fffaf0;
    --cream-100: #f8efd9;
    --cream-200: #eadcc1;
    --ink: #183238;
    --muted: #5e6c6b;
    --coral: #c84940;
    --coral-dark: #a93630;
    --gold: #e9b84e;
    --gold-light: #f8d77e;
    --green: #3f8a68;
    --red: #a93630;
    --shadow: 0 20px 55px rgba(0, 15, 20, 0.28);
    --shadow-soft: 0 9px 24px rgba(0, 21, 25, 0.16);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --focus: #ffd56f;
    font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    overflow-x: hidden;
    background: var(--petrol-950);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--cream-50);
    background:
        radial-gradient(circle at 12% 6%, rgba(41, 112, 111, 0.36), transparent 30rem),
        radial-gradient(circle at 90% 82%, rgba(200, 73, 64, 0.15), transparent 34rem),
        var(--petrol-950);
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: 0.13;
    pointer-events: none;
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.52) 0 0.7px, transparent 0.8px),
        linear-gradient(120deg, transparent 48%, rgba(255, 255, 255, 0.08) 49%, transparent 50%);
    background-size: 13px 13px, 31px 31px;
}

button,
input {
    font: inherit;
}

button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 10px;
    left: 10px;
    padding: 10px 14px;
    color: var(--petrol-950);
    background: var(--gold-light);
    border-radius: 10px;
    font-weight: 800;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-shell {
    display: flex;
    width: min(100%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    flex-direction: column;
}

.site-header {
    display: flex;
    width: 100%;
    min-height: 84px;
    padding: max(16px, env(safe-area-inset-top)) clamp(16px, 4vw, 56px) 12px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: inline-flex;
    min-height: 48px;
    color: inherit;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: clamp(1.12rem, 3vw, 1.38rem);
    letter-spacing: -0.025em;
}

.brand small {
    margin-top: 1px;
    color: rgba(255, 250, 240, 0.7);
    font-size: 0.72rem;
}

.brand-mark {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    padding: 8px;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    border-radius: 13px;
    background: var(--cream-50);
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.25);
    transform: rotate(-5deg);
}

.brand-mark i {
    display: block;
    width: 6px;
    height: 6px;
    align-self: center;
    justify-self: center;
    border-radius: 50%;
    background: var(--coral);
}

.brand-mark i:nth-child(1) { grid-area: 1 / 1; }
.brand-mark i:nth-child(2) { grid-area: 1 / 3; }
.brand-mark i:nth-child(3) { grid-area: 2 / 2; }
.brand-mark i:nth-child(4) { grid-area: 3 / 1; }
.brand-mark i:nth-child(5) { grid-area: 3 / 3; }

.connection-status {
    display: inline-flex;
    min-height: 36px;
    padding: 8px 11px;
    color: rgba(255, 250, 240, 0.82);
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.13);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px rgba(233, 184, 78, 0.15);
}

.connection-status.is-live .connection-dot {
    background: #66c494;
    box-shadow: 0 0 0 4px rgba(102, 196, 148, 0.14);
}

.connection-status.is-stale .connection-dot,
.connection-status.is-offline .connection-dot {
    background: #f19a86;
    box-shadow: 0 0 0 4px rgba(241, 154, 134, 0.14);
}

.global-message {
    width: calc(100% - 32px);
    max-width: 1180px;
    margin: 4px auto 12px;
    padding: 12px 15px;
    color: #42130f;
    border: 1px solid #f4aa9f;
    border-radius: 13px;
    background: #ffe4df;
    box-shadow: var(--shadow-soft);
    font-size: 0.9rem;
    font-weight: 700;
}

.global-message.is-warning {
    color: #4a3307;
    border-color: #e9c260;
    background: #fff1c9;
}

.global-message.is-success {
    color: #113c2a;
    border-color: #82c8a7;
    background: #ddf4e7;
}

main {
    width: 100%;
    flex: 1;
    padding: 12px clamp(16px, 4vw, 56px) 40px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    line-height: 1.05;
    letter-spacing: -0.04em;
}

h1 {
    margin-bottom: 18px;
    font-size: clamp(2.3rem, 7vw, 5.2rem);
}

h2 {
    margin-bottom: 10px;
    font-size: clamp(1.55rem, 4vw, 2.2rem);
}

.eyebrow {
    margin-bottom: 9px;
    color: var(--coral);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 48px;
    padding: 12px 20px;
    color: var(--cream-50);
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 850;
    line-height: 1.2;
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.button:active:not(:disabled) {
    transform: translateY(0);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.button-primary {
    color: #fff;
    background: var(--coral);
    box-shadow: 0 9px 18px rgba(169, 54, 48, 0.26);
}

.button-primary:hover:not(:disabled) {
    background: var(--coral-dark);
}

.button-secondary {
    color: var(--petrol-950);
    background: var(--gold);
    box-shadow: 0 9px 18px rgba(131, 91, 12, 0.2);
}

.button-secondary:hover:not(:disabled) {
    background: var(--gold-light);
}

.button-ghost {
    color: var(--cream-50);
    border-color: rgba(255, 255, 255, 0.27);
    background: rgba(255, 255, 255, 0.08);
}

.button-quiet {
    color: inherit;
    border-color: rgba(23, 84, 90, 0.22);
    background: transparent;
}

.room-bar .button-quiet {
    color: rgba(255, 250, 240, 0.77);
    border-color: rgba(255, 255, 255, 0.18);
}

.button-small {
    min-height: 44px;
    padding: 9px 13px;
    font-size: 0.84rem;
}

.button-wide {
    width: 100%;
}

.button-icon {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 11px;
    color: var(--red);
    border: 1px solid rgba(169, 54, 48, 0.25);
    background: transparent;
    font-size: 0.76rem;
}

.button-icon:hover:not(:disabled) {
    background: rgba(169, 54, 48, 0.08);
}

.landing-layout {
    display: grid;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    gap: clamp(30px, 6vw, 80px);
}

.landing-hero {
    max-width: 760px;
    padding: clamp(28px, 6vw, 70px) 0 4px;
}

.landing-hero h1 {
    max-width: 760px;
}

.hero-copy {
    max-width: 650px;
    margin-bottom: 24px;
    color: rgba(255, 250, 240, 0.75);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.65;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hero-chips span {
    padding: 8px 12px;
    color: rgba(255, 250, 240, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    font-weight: 750;
}

.entry-grid {
    display: grid;
    gap: 16px;
}

.entry-card {
    position: relative;
    min-width: 0;
    padding: clamp(22px, 5vw, 32px);
    color: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-xl);
    background: var(--cream-50);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.entry-card::after {
    position: absolute;
    right: -30px;
    bottom: -46px;
    width: 150px;
    height: 150px;
    content: "";
    border: 28px solid rgba(200, 73, 64, 0.055);
    border-radius: 50%;
    pointer-events: none;
}

.entry-card-accent::after {
    border-color: rgba(233, 184, 78, 0.12);
}

.entry-card > * {
    position: relative;
    z-index: 1;
}

.entry-card h2 {
    padding-right: 48px;
}

.entry-card p:not(.field-error) {
    min-height: 44px;
    margin-bottom: 20px;
    color: var(--muted);
    line-height: 1.5;
}

.card-number {
    position: absolute;
    top: 24px;
    right: 24px;
    color: rgba(24, 50, 56, 0.19);
    font-size: 1.25rem;
    font-weight: 950;
}

label,
.field-label {
    display: block;
    margin: 14px 0 7px;
    color: var(--ink);
    font-size: 0.79rem;
    font-weight: 850;
}

.entry-card input:not(.code-box) {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    color: var(--ink);
    border: 1px solid #b8b4a8;
    border-radius: 12px;
    background: #fffef9;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.entry-card input::placeholder {
    color: #7c8582;
}

.entry-card input:focus {
    border-color: var(--petrol-700);
}

.code-boxes {
    display: grid;
    width: 100%;
    margin-bottom: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.code-box {
    width: 100%;
    min-width: 0;
    height: 56px;
    padding: 0;
    color: var(--petrol-900);
    border: 2px solid #c5bdad;
    border-radius: 12px;
    background: #fffef9;
    font-size: clamp(1.3rem, 6vw, 1.65rem);
    font-weight: 950;
    text-align: center;
    text-transform: uppercase;
}

.code-box:focus {
    border-color: var(--coral);
}

.field-error {
    min-height: 22px;
    margin: 8px 0 7px;
    color: var(--red);
    font-size: 0.82rem;
    font-weight: 750;
}

.field-error[hidden] {
    display: block;
    visibility: hidden;
}

.game-page {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
}

.room-bar {
    display: flex;
    min-height: 64px;
    margin-bottom: 16px;
    padding: 10px 0 14px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.room-identity {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 9px;
}

.room-identity span {
    color: rgba(255, 250, 240, 0.6);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.room-identity strong {
    color: var(--gold-light);
    font-size: clamp(1.25rem, 4vw, 1.7rem);
    letter-spacing: 0.16em;
}

.room-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.lobby-card,
.dice-card,
.scorecard,
.start-roll-card,
.finished-card {
    color: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-xl);
    background: var(--cream-50);
    box-shadow: var(--shadow);
}

.lobby-card,
.finished-card {
    max-width: 810px;
    margin: 22px auto 0;
    padding: clamp(24px, 5vw, 48px);
}

.section-heading,
.dice-heading,
.scorecard-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.section-intro {
    max-width: 620px;
    margin-bottom: 24px;
    color: var(--muted);
    line-height: 1.6;
}

.player-count,
.total-pill,
.roll-count {
    flex: 0 0 auto;
    padding: 8px 11px;
    color: var(--petrol-800);
    border: 1px solid rgba(14, 62, 68, 0.15);
    border-radius: 999px;
    background: rgba(14, 62, 68, 0.07);
    font-size: 0.78rem;
    font-weight: 850;
}

.player-list {
    display: grid;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
    gap: 8px;
}

.player-row {
    display: grid;
    min-height: 68px;
    padding: 10px 12px;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    border: 1px solid #ddd4c2;
    border-radius: var(--radius-md);
    background: #fffdf7;
}

.player-row.is-self {
    border-color: rgba(200, 73, 64, 0.43);
    background: #fff8f3;
}

.player-avatar {
    display: inline-flex;
    width: 44px;
    height: 44px;
    color: var(--cream-50);
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--petrol-700);
    font-weight: 900;
}

.player-info {
    min-width: 0;
}

.player-info strong,
.player-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-info small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
}

.host-badge {
    grid-column: 2;
    width: max-content;
    max-width: 100%;
    padding: 4px 7px;
    color: #60430c;
    border-radius: 999px;
    background: #fae8b7;
    font-size: 0.67rem;
    font-weight: 850;
}

.presence {
    display: inline-flex;
    min-height: 28px;
    color: #28694e;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 850;
}

.presence::before {
    width: 7px;
    height: 7px;
    margin-right: 6px;
    content: "";
    border-radius: 50%;
    background: #4ba675;
}

.presence.is-away {
    color: #745a2b;
}

.presence.is-away::before {
    background: #c9963b;
}

.player-row .button-icon {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.lobby-start {
    display: grid;
    justify-items: center;
}

.lobby-start .button {
    max-width: 420px;
}

.helper-text {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 0.79rem;
    text-align: center;
}

.waiting-card {
    display: flex;
    padding: 15px;
    color: var(--muted);
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 13px;
    background: var(--cream-100);
}

.waiting-card p {
    margin: 0;
}

.waiting-pulse,
.turn-marker {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 5px rgba(233, 184, 78, 0.17);
}

.turn-banner {
    display: flex;
    min-height: 74px;
    margin: 10px 0 16px;
    padding: 14px 18px;
    color: rgba(255, 250, 240, 0.87);
    align-items: center;
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
}

.turn-banner.is-own-turn {
    color: var(--petrol-950);
    border-color: var(--gold-light);
    background: var(--gold-light);
    box-shadow: 0 10px 28px rgba(109, 71, 0, 0.2);
}

.turn-banner strong,
.turn-banner span:not(.turn-marker) {
    display: block;
}

.turn-banner strong {
    margin-bottom: 3px;
    font-size: 1.03rem;
}

.turn-banner span:not(.turn-marker) {
    color: inherit;
    font-size: 0.79rem;
    opacity: 0.78;
}

.turn-banner.is-own-turn .turn-marker {
    background: var(--coral);
    box-shadow: 0 0 0 5px rgba(200, 73, 64, 0.16);
}

.play-layout {
    display: grid;
    min-width: 0;
    gap: 16px;
}

.dice-card,
.scorecard {
    min-width: 0;
    padding: clamp(18px, 4vw, 30px);
}

.dice-heading h2,
.scorecard-heading h2 {
    margin-bottom: 0;
}

.dice-row {
    display: grid;
    width: 100%;
    margin: clamp(24px, 7vw, 44px) auto 24px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(5px, 1.5vw, 13px);
}

.die {
    display: flex;
    min-width: 0;
    min-height: 78px;
    padding: 0;
    color: var(--muted);
    flex-direction: column;
    align-items: center;
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
}

.die:disabled {
    cursor: default;
}

.die-face {
    display: grid;
    width: 100%;
    max-width: 92px;
    aspect-ratio: 1;
    padding: clamp(7px, 2vw, 13px);
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    border: 2px solid #d7ccba;
    border-radius: clamp(12px, 3vw, 20px);
    background: #fffefa;
    box-shadow: 0 8px 0 #d8cbb5, 0 13px 22px rgba(31, 42, 39, 0.18);
    transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.die:not(:disabled):hover .die-face {
    transform: translateY(-3px);
}

.die.is-held .die-face {
    border-color: var(--coral);
    background: #fff0e9;
    box-shadow: 0 8px 0 #c84940, 0 13px 22px rgba(169, 54, 48, 0.22);
    transform: translateY(-4px);
}

.pip {
    display: block;
    width: clamp(5px, 1.8vw, 11px);
    height: clamp(5px, 1.8vw, 11px);
    align-self: center;
    justify-self: center;
    border-radius: 50%;
    background: var(--petrol-800);
    opacity: 0;
}

.pip.is-visible {
    opacity: 1;
}

.hold-label {
    width: 100%;
    min-height: 27px;
    margin-top: 13px;
    font-size: clamp(0.58rem, 1.8vw, 0.74rem);
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
}

.die.is-held .hold-label {
    color: var(--coral-dark);
}

.roll-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.roll-actions .button {
    flex: 0 0 auto;
}

.roll-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.45;
}

.score-tabs {
    display: flex;
    width: 100%;
    margin: 18px 0 14px;
    padding: 3px 2px 7px;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.score-tab {
    min-height: 44px;
    padding: 8px 12px;
    flex: 0 0 auto;
    color: var(--muted);
    border: 1px solid #d7ccba;
    border-radius: 999px;
    background: #fffef9;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
}

.score-tab.is-selected {
    color: #fff;
    border-color: var(--petrol-700);
    background: var(--petrol-700);
}

.score-summary {
    display: grid;
    margin-bottom: 16px;
    padding: 13px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border-radius: var(--radius-md);
    background: var(--cream-100);
}

.score-summary > div {
    min-width: 0;
    padding: 8px;
}

.score-summary span,
.score-summary strong {
    display: block;
}

.score-summary span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
}

.score-summary strong {
    font-size: 0.92rem;
}

.score-summary progress {
    width: 100%;
    height: 6px;
    margin-top: 7px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: #d8cdb9;
}

.score-summary progress::-webkit-progress-bar { background: #d8cdb9; }
.score-summary progress::-webkit-progress-value { background: var(--coral); }
.score-summary progress::-moz-progress-bar { background: var(--coral); }

.score-summary .score-total {
    color: var(--cream-50);
    border-radius: 11px;
    background: var(--petrol-800);
}

.score-summary .score-total span {
    color: rgba(255, 250, 240, 0.68);
}

.score-summary .score-total strong {
    color: var(--gold-light);
    font-size: 1.2rem;
}

.score-table-wrap {
    width: 100%;
    overflow: hidden;
    border: 1px solid #ddd4c2;
    border-radius: var(--radius-md);
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ink);
    font-size: 0.81rem;
}

.score-table th,
.score-table td {
    height: 45px;
    padding: 7px 11px;
    border-bottom: 1px solid #e3dbc9;
    text-align: left;
}

.score-table thead th {
    height: 39px;
    color: var(--muted);
    background: #f3ead7;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.score-table th:last-child,
.score-table td:last-child {
    width: 42%;
    text-align: right;
}

.score-table tbody tr:last-child th,
.score-table tbody tr:last-child td {
    border-bottom: 0;
}

.score-section-row th {
    height: 32px;
    color: var(--petrol-700);
    background: #f7f0e2;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-align: left !important;
    text-transform: uppercase;
}

.score-value {
    font-weight: 850;
}

.score-open {
    color: #4c5b58;
}

.score-choice {
    min-width: 92px;
    min-height: 44px;
    padding: 7px 10px;
    color: #fff;
    border-radius: 10px;
    background: var(--coral);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 850;
}

.score-choice:hover {
    background: var(--coral-dark);
}

.start-roll-card {
    display: grid;
    max-width: 940px;
    margin: 22px auto 0;
    padding: clamp(25px, 6vw, 52px);
    gap: 30px;
}

.single-die-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
}

.single-die-illustration .die-face {
    width: clamp(120px, 36vw, 190px);
    max-width: none;
    padding: clamp(18px, 5vw, 28px);
    border-radius: 30px;
    box-shadow: 0 14px 0 #d8cbb5, 0 28px 45px rgba(31, 42, 39, 0.21);
    transform: rotate(-5deg);
}

.single-die-illustration .pip {
    width: clamp(13px, 4vw, 20px);
    height: clamp(13px, 4vw, 20px);
}

.start-roll-copy > p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.55;
}

.start-roll-list {
    display: grid;
    margin: 22px 0;
    padding: 0;
    list-style: none;
    gap: 6px;
}

.start-roll-list li {
    display: flex;
    min-height: 46px;
    padding: 8px 11px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #ddd4c2;
    border-radius: 11px;
    background: #fffdf7;
}

.start-roll-list li.is-current {
    border-color: var(--gold);
    background: #fff5d8;
}

.start-roll-list strong {
    display: inline-flex;
    width: 32px;
    height: 32px;
    color: #fff;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--petrol-700);
}

.pending-roll {
    color: var(--muted);
    font-size: 0.74rem;
}

.finished-card {
    position: relative;
    text-align: center;
    overflow: hidden;
}

.finished-card h1 {
    margin-bottom: 10px;
    font-size: clamp(2.5rem, 8vw, 4.7rem);
}

.finished-card .section-intro {
    margin-right: auto;
    margin-left: auto;
}

.celebration-mark {
    display: flex;
    height: 34px;
    margin-bottom: 12px;
    align-items: flex-end;
    justify-content: center;
    gap: 9px;
}

.celebration-mark i {
    display: block;
    width: 8px;
    height: 24px;
    border-radius: 999px;
    background: var(--coral);
    transform: rotate(-28deg);
}

.celebration-mark i:nth-child(2) {
    height: 32px;
    background: var(--gold);
    transform: none;
}

.celebration-mark i:nth-child(3) {
    background: var(--petrol-700);
    transform: rotate(28deg);
}

.podium {
    display: flex;
    margin: 28px 0 20px;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}

.podium-place {
    display: flex;
    width: min(31%, 170px);
    min-height: 115px;
    padding: 14px 8px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddcfb5;
    border-radius: 17px 17px 8px 8px;
    background: #f7edd7;
}

.podium-place.place-1 {
    min-height: 150px;
    border-color: #e8b84e;
    background: #fff1c7;
    order: 2;
}

.podium-place.place-2 { order: 1; }
.podium-place.place-3 { order: 3; }

.podium-rank {
    display: inline-flex;
    width: 36px;
    height: 36px;
    margin-bottom: 7px;
    color: #fff;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--petrol-700);
    font-weight: 900;
}

.place-1 .podium-rank {
    color: #4e3300;
    background: var(--gold);
}

.podium-place strong,
.podium-place span:last-child {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-place strong {
    margin-bottom: 5px;
    font-size: 0.83rem;
}

.podium-place span:last-child {
    color: var(--muted);
    font-size: 0.69rem;
}

.ranking-list {
    display: grid;
    max-width: 570px;
    margin: 0 auto 26px;
    padding: 0;
    list-style: none;
    gap: 7px;
}

.ranking-list li {
    display: grid;
    min-height: 52px;
    padding: 10px 13px;
    align-items: center;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    gap: 9px;
    border: 1px solid #ddd4c2;
    border-radius: 12px;
    background: #fffdf7;
    text-align: left;
}

.ranking-number {
    color: var(--coral-dark);
    font-weight: 900;
}

.ranking-list strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-total {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.you-badge {
    padding: 3px 6px;
    color: var(--petrol-700);
    border-radius: 999px;
    background: #dceceb;
    font-size: 0.66rem;
    font-weight: 850;
}

.modal-backdrop {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: grid;
    padding: 18px;
    place-items: center;
    background: rgba(2, 19, 24, 0.76);
    backdrop-filter: blur(5px);
}

.modal {
    width: min(100%, 470px);
    padding: clamp(24px, 6vw, 36px);
    color: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    background: var(--cream-50);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

.modal p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    margin-top: 24px;
    flex-wrap: wrap-reverse;
    justify-content: flex-end;
    gap: 9px;
}

.modal .button-quiet {
    color: var(--ink);
}

.copy-fallback {
    position: fixed;
    left: -10000px;
}

.loading-view {
    display: flex;
    min-height: 55vh;
    color: rgba(255, 250, 240, 0.7);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.loading-die {
    width: 54px;
    height: 54px;
    border: 8px double rgba(255, 250, 240, 0.72);
    border-radius: 15px;
    animation: loading-turn 1.2s ease-in-out infinite;
}

.noscript-message {
    margin: 20px;
    padding: 14px;
    color: #42130f;
    border-radius: 12px;
    background: #ffe4df;
    text-align: center;
}

.site-footer {
    width: 100%;
    padding: 18px 16px max(24px, env(safe-area-inset-bottom));
    color: rgba(255, 250, 240, 0.68);
    font-size: 0.68rem;
    text-align: center;
}

.site-footer p {
    margin: 0;
}

@keyframes loading-turn {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(98deg); }
}

@keyframes die-roll {
    0% { transform: rotate(0) scale(0.92); }
    45% { transform: rotate(8deg) scale(1.05); }
    100% { transform: rotate(0) scale(1); }
}

.die.is-rolling .die-face {
    animation: die-roll 420ms ease-out both;
}

.dice-stage {
    position: relative;
    min-height: 214px;
    margin: 18px 0 8px;
    overflow: hidden;
    border: 1px solid rgba(14, 62, 68, 0.13);
    border-radius: 20px;
    background: linear-gradient(145deg, #eef1e7 0%, #e2e9dd 100%);
}

.dice-stage .dice-row {
    position: relative;
    margin: 34px auto 12px;
}

.start-dice-stage {
    min-height: 230px;
}

.start-dice-stage .dice-row {
    grid-template-columns: minmax(120px, 190px);
    justify-content: center;
}

.start-dice-stage .die-face {
    max-width: 180px;
    border-radius: 30px;
}

.finished-actions {
    display: flex;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.finished-actions .waiting-card {
    width: 100%;
    margin: 0;
}

/* Variant 1 keeps the game surface focused on the active turn. */
.game-page .eyebrow,
.landing-hero .eyebrow,
.hero-chips,
.card-number,
.host-badge {
    display: none;
}

.modal-backdrop {
    backdrop-filter: none;
    background: rgba(2, 19, 24, 0.72);
}

@media (min-width: 620px) {
    .entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .start-roll-card {
        grid-template-columns: minmax(190px, 0.75fr) minmax(300px, 1.25fr);
        align-items: center;
    }

    .score-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .player-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    }

    .host-badge,
    .player-row .button-icon {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (min-width: 980px) {
    .play-layout {
        grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
        align-items: start;
    }

    .dice-card {
        position: sticky;
        top: 16px;
    }
}

@media (min-width: 1120px) {
    .landing-layout {
        min-height: min(680px, calc(100vh - 170px));
        grid-template-columns: minmax(0, 0.95fr) minmax(560px, 1.05fr);
        align-items: center;
    }

    .landing-hero {
        padding-top: 0;
    }
}

@media (max-width: 480px) {
    .brand small {
        display: none;
    }

    .connection-status {
        padding: 8px;
    }

    .connection-status span:last-child {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .room-actions .button {
        padding-right: 10px;
        padding-left: 10px;
    }

    .roll-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .roll-actions p {
        text-align: center;
    }

    .die-face {
        box-shadow: 0 5px 0 #d8cbb5, 0 9px 14px rgba(31, 42, 39, 0.16);
    }

    .die.is-held .die-face {
        box-shadow: 0 5px 0 #c84940, 0 9px 14px rgba(169, 54, 48, 0.2);
    }

    .modal-actions .button {
        width: 100%;
    }

    .ranking-list li {
        grid-template-columns: 28px minmax(0, 1fr) auto;
    }

    .you-badge {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.score-summary {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
