:root {
    --bg: #070915;
    --bg-2: #101225;
    --ink: #f8fbff;
    --muted: #a9b1c7;
    --line: rgba(255, 255, 255, .12);
    --panel: rgba(18, 22, 39, .82);
    --panel-strong: rgba(24, 29, 51, .96);
    --primary: #8a35ff;
    --primary-dark: #6722d8;
    --cyan: #04c7d9;
    --pink: #ff416f;
    --orange: #ff9e18;
    --green: #19c37d;
    --gold: #ffc247;
    --shadow: 0 18px 45px rgba(0, 0, 0, .42);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(255, 65, 111, .2), transparent 28%),
        linear-gradient(225deg, rgba(4, 199, 217, .16), transparent 34%),
        linear-gradient(180deg, #060814 0%, #111428 58%, #070915 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(7, 9, 21, .72);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    color: white;
    font-size: 20px;
    font-weight: 900;
}

nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

nav a {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 8px 11px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
}

nav a:hover {
    color: white;
    background: rgba(255, 255, 255, .1);
}

.session-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.session-bar a {
    color: #d9c4ff;
}

.session-bar button {
    min-height: 34px;
    padding: 0 10px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--line);
    box-shadow: none;
}

.install-button[hidden] {
    display: none;
}

.account-strip {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.account-strip span {
    margin-right: auto;
    color: white;
}

.account-strip a,
.account-strip button {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 8px;
    background: rgba(255, 255, 255, .05);
    color: #d9c4ff;
    box-shadow: none;
    font-size: 12px;
}

.account-logout {
    margin: 0;
}

.nav-new {
    width: 44px;
    min-width: 44px;
    border: 0;
    background: linear-gradient(135deg, #a83dff, #641cff);
    color: white;
    font-size: 26px;
    font-weight: 600;
    box-shadow: 0 12px 26px rgba(138, 53, 255, .38);
}

.page {
    width: min(820px, 100%);
    margin: 0 auto;
    padding: 16px;
}

.hero,
.panel,
.game-hero,
.player-hero {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    background: var(--panel);
    backdrop-filter: blur(18px);
}

.panel.select-open,
.game-hero.select-open,
.player-hero.select-open {
    z-index: 200;
}

.hero {
    min-height: 210px;
    display: grid;
    align-content: end;
    gap: 8px;
    padding: 20px;
    overflow: hidden;
    background:
        linear-gradient(160deg, rgba(126, 49, 255, .36), transparent 48%),
        linear-gradient(30deg, rgba(4, 199, 217, .22), transparent 46%),
        rgba(10, 13, 29, .94);
}

.hero h1 {
    font-size: 38px;
    letter-spacing: 0;
    margin-bottom: 0;
}

.hero p {
    max-width: 420px;
    color: #e9edff;
    font-size: 16px;
}

.hero-art {
    position: absolute;
    inset: 18px 18px auto auto;
    width: 138px;
    height: 100px;
    transform: rotate(-7deg);
}

.piece,
.dice {
    position: absolute;
    display: grid;
    place-items: center;
    border-radius: 8px;
    box-shadow: 0 18px 30px rgba(0, 0, 0, .34);
}

.piece {
    width: 36px;
    height: 58px;
}

.piece.teal {
    left: 18px;
    bottom: 12px;
    background: linear-gradient(180deg, #0ed5d9, #057c91);
}

.piece.amber {
    left: 72px;
    top: 10px;
    background: linear-gradient(180deg, #ffc247, #f37b12);
}

.dice {
    right: 14px;
    bottom: 20px;
    width: 48px;
    height: 48px;
    background: #f1e8dc;
    color: #151521;
    font-size: 20px;
    font-weight: 900;
}

.panel {
    padding: 16px;
}

.auth-shell {
    min-height: calc(100vh - 98px);
    display: grid;
    place-items: center;
    padding: 24px 0;
}

.auth-card {
    width: min(460px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background:
        linear-gradient(145deg, rgba(255, 158, 24, .16), transparent 40%),
        linear-gradient(35deg, rgba(4, 199, 217, .15), transparent 46%),
        var(--panel-strong);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 42px;
}

.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: white;
    font-weight: 800;
}

.notice.error {
    background: rgba(255, 65, 111, .16);
    border-color: rgba(255, 65, 111, .42);
}

.notice.success {
    background: rgba(25, 195, 125, .16);
    border-color: rgba(25, 195, 125, .42);
}

.auth-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
    color: #d9c4ff;
    font-size: 13px;
    font-weight: 850;
}

.local-reset-link {
    display: grid;
    gap: 6px;
    overflow-wrap: anywhere;
    font-size: 12px;
}

.passkey-login {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.passkey-status {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.passkey-row > span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.passkey-row {
    align-items: center;
}

.passkey-row small {
    overflow-wrap: anywhere;
}

.passkey-name-form {
    display: grid;
    grid-template-columns: minmax(110px, 180px) auto;
    gap: 6px;
}

.passkey-name-form input {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 13px;
}

.compact-action {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    box-shadow: none;
}

.game-hero {
    display: grid;
    grid-template-columns: 238px 1fr;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 65, 111, .16), rgba(138, 53, 255, .12)),
        var(--panel-strong);
}

.game-cover {
    aspect-ratio: 1;
    min-height: 0;
    background: linear-gradient(135deg, var(--orange), var(--pink));
}

.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cover-placeholder {
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    color: white;
    font-size: 74px;
    font-weight: 900;
}

.game-hero-content {
    display: grid;
    align-content: center;
    gap: 10px;
    padding: 20px;
}

.player-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background:
        linear-gradient(135deg, rgba(4, 199, 217, .18), rgba(255, 65, 111, .14)),
        var(--panel);
}

.eyebrow,
.badge,
.result-pill {
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(25, 195, 125, .16);
    color: #74ffc3;
    font-size: 12px;
    font-weight: 850;
}

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

h1 {
    font-size: 30px;
    line-height: 1.05;
    margin-bottom: 8px;
}

h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

p,
small {
    color: var(--muted);
}

.primary-action,
.ghost-action,
button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    background: linear-gradient(135deg, #a83dff, #641cff);
    color: white;
    font-weight: 850;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(138, 53, 255, .34);
}

.ghost-action {
    background: rgba(255, 255, 255, .08);
    color: white;
    border: 1px solid var(--line);
    box-shadow: none;
}

button:hover,
.primary-action:hover {
    filter: brightness(1.08);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.filter-tabs.two-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 10px;
    align-items: end;
}

.games-toolbar {
    display: grid;
    grid-template-columns: 170px 1fr auto;
    gap: 10px;
    align-items: end;
}

.scope-menu {
    position: relative;
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    z-index: 1;
}

.scope-menu.scope-open {
    z-index: 220;
}

.scope-menu > button {
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: none;
}

.scope-menu > button::after {
    content: "▾";
    color: var(--muted);
    font-size: 12px;
}

.scope-options {
    position: absolute;
    z-index: 230;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    background: #111426;
    box-shadow: var(--shadow);
}

.scope-options a {
    display: flex;
    min-height: 38px;
    align-items: center;
    border-radius: 8px;
    padding: 0 10px;
    color: white;
}

.scope-options a.active,
.scope-options a:hover {
    background: rgba(138, 53, 255, .24);
}

.typeahead {
    position: relative;
}

.typeahead-results {
    position: absolute;
    z-index: 8;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    background: rgba(12, 15, 32, .98);
    box-shadow: var(--shadow);
}

.typeahead-results[hidden] {
    display: none;
}

.typeahead-results button {
    justify-content: flex-start;
    min-height: 40px;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    text-align: left;
}

.typeahead-results button:hover {
    background: rgba(255, 255, 255, .08);
}

.filter-tabs a {
    display: grid;
    min-height: 46px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    text-align: center;
}

.filter-tabs a.active {
    background: linear-gradient(135deg, rgba(138, 53, 255, .32), rgba(4, 199, 217, .14));
    color: white;
    border-color: rgba(138, 53, 255, .7);
}

.filter-tabs span {
    color: inherit;
    opacity: .75;
    font-size: 11px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .08);
    color: white;
    font: inherit;
    outline: none;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, .42);
}

select option {
    color: #111827;
}

.native-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.custom-select {
    position: relative;
    width: 100%;
    z-index: 1;
}

.custom-select.custom-select-open {
    z-index: 240;
}

.custom-select-toggle {
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    padding: 0 36px 0 12px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: none;
    text-align: left;
}

.custom-select-toggle::after {
    content: "▾";
    position: absolute;
    right: 14px;
    color: var(--muted);
    font-size: 12px;
}

.custom-select-menu {
    position: absolute;
    z-index: 250;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: grid;
    gap: 4px;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    background: #111426;
    box-shadow: var(--shadow);
}

.custom-select-menu button {
    justify-content: flex-start;
    min-height: 36px;
    border-radius: 8px;
    padding: 0 10px;
    background: transparent;
    box-shadow: none;
    color: white;
    text-align: left;
}

.custom-select-menu button.active,
.custom-select-menu button:hover {
    background: rgba(138, 53, 255, .24);
}

input[type="file"] {
    padding: 9px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.field-hint {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

legend {
    color: var(--muted);
    padding: 0 6px;
    font-weight: 850;
}

.stack {
    display: grid;
    gap: 12px;
}

.password-rules {
    display: grid;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    font-size: 12px;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr 48px 48px;
    gap: 8px;
}

.color-input {
    padding: 4px;
}

.role-avatar {
    background: linear-gradient(135deg, #04c7d9, #8a35ff);
}

.role-avatar.admin-role {
    background: linear-gradient(135deg, #ffc247, #ff416f);
}

.home-actions {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.home-action {
    position: relative;
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 2px 12px;
    min-height: 84px;
    align-items: center;
    border-radius: 8px;
    padding: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.home-action strong {
    font-size: 18px;
}

.home-action small {
    color: rgba(255, 255, 255, .86);
}

.home-action.orange {
    background: linear-gradient(135deg, #ffb12c, #ff7a14);
}

.home-action.pink {
    background: linear-gradient(135deg, #ff5e87, #e92a61);
}

.home-action.cyan {
    background: linear-gradient(135deg, #08c9d7, #087a96);
}

.home-action.violet {
    background: linear-gradient(135deg, #9c3cff, #5d18da);
}

.action-icon {
    grid-row: span 2;
    display: grid;
    min-height: 48px;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .18);
    color: white;
    font-size: 13px;
    font-weight: 900;
}

.quick-grid,
.scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.tile,
.card,
.score-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.tile {
    display: grid;
    min-height: 86px;
    align-content: center;
    gap: 2px;
    text-align: center;
}

.tile strong {
    font-size: 26px;
}

.tile:nth-child(1) {
    border-bottom: 4px solid var(--orange);
}

.tile:nth-child(2) {
    border-bottom: 4px solid var(--cyan);
}

.tile:nth-child(3) {
    border-bottom: 4px solid var(--primary);
}

.section-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-title-row h2 {
    margin-bottom: 0;
}

.game-stat-tiles .tile {
    min-height: 68px;
    padding: 10px;
}

.game-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mini-board {
    display: grid;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, .04);
}

.mini-board h3 {
    margin: 0 0 2px;
    color: white;
    font-size: 13px;
}

.mini-board p {
    margin-bottom: 0;
    font-size: 13px;
}

.mini-stat-row {
    display: flex;
    min-height: 28px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.mini-stat-row span {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-stat-row b {
    color: white;
    white-space: nowrap;
}

.campaign-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.campaign-status-form {
    display: grid;
    grid-template-columns: minmax(130px, 170px) auto;
    gap: 8px;
    align-items: center;
}

.campaign-status-form select {
    min-height: 36px;
    padding: 6px 10px;
}

.list {
    display: grid;
    gap: 10px;
}

.card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.game-list-card {
    min-height: 86px;
}

.player-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
}

.player-row strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-row span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;
}

.game-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.game-card-side {
    display: grid;
    justify-items: end;
    gap: 8px;
    flex: 0 0 auto;
}

.game-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-picker {
    display: grid;
    gap: 10px;
}

.selected-game-card,
.game-result {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, .06);
    color: white;
    box-shadow: none;
    text-align: left;
}

.selected-game-card {
    background: linear-gradient(135deg, rgba(138, 53, 255, .2), rgba(4, 199, 217, .1));
}

.game-results {
    display: grid;
    max-height: 360px;
    overflow: auto;
    gap: 8px;
}

.game-result strong,
.selected-game-card strong {
    display: block;
    margin-bottom: 3px;
}

.game-result:hover {
    background: rgba(255, 255, 255, .1);
}

.game-thumb.small,
.game-thumb.mini-thumb {
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.small-action {
    min-height: 34px;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 12px;
    box-shadow: none;
}

.game-thumb {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 158, 24, .14), rgba(255, 65, 111, .14)),
        rgba(255, 255, 255, .06);
    color: white;
    font-size: 26px;
    font-weight: 900;
}

.game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card h2 {
    margin-bottom: 4px;
}

.compact {
    justify-content: flex-start;
}

.compact > div:nth-child(2) {
    min-width: 0;
    flex: 1 1 auto;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
}

.delete-inline {
    margin-top: 12px;
}

.request-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 12px 0;
}

.request-card:first-of-type {
    border-top: 0;
}

.request-card strong,
.request-card small {
    display: block;
}

.status-chip {
    display: inline-flex;
    width: fit-content;
    min-height: 26px;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.status-chip.pending {
    background: rgba(255, 194, 71, .16);
    color: #ffe0a0;
}

.status-chip.active {
    background: rgba(25, 195, 125, .16);
    color: #74ffc3;
}

.status-chip.rejected {
    background: rgba(255, 65, 111, .16);
    color: #ffb1c2;
}

.row,
.metric,
.download-strip,
.stat-line,
.play-row,
.play-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    border-top: 1px solid var(--line);
}

.row:first-child,
.metric:first-of-type,
.stat-line:first-of-type,
.play-row:first-of-type,
.play-history-row:first-of-type {
    border-top: 0;
}

.download-strip {
    border: 1px solid rgba(4, 199, 217, .22);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(4, 199, 217, .08);
}

.download-strip a,
.metric.linked:hover,
.card:hover,
.stat-line:hover,
.play-row:hover,
.play-history-row:hover {
    color: white;
}

.empty-state {
    display: grid;
    gap: 12px;
}

.empty-state p {
    margin-bottom: 0;
}

.compact-empty {
    padding: 8px 0;
}

.quick-create {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, .04);
}

.quick-create summary {
    cursor: pointer;
    color: white;
    font-weight: 850;
}

.quick-create[open] summary {
    margin-bottom: 10px;
}

.play-history-row strong,
.play-history-row small,
.play-history-row span {
    display: block;
}

.play-history-row span {
    max-width: 42%;
    overflow: hidden;
    color: white;
    font-size: 13px;
    font-weight: 850;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-actions {
    gap: 8px;
}

.avatar,
.dot {
    display: inline-block;
    border-radius: 50%;
    flex: 0 0 auto;
}

.avatar {
    width: 38px;
    height: 38px;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .2);
    object-fit: cover;
}

.avatar.xl {
    width: 72px;
    height: 72px;
}

.avatar.mini {
    width: 24px;
    height: 24px;
}

.danger-panel {
    border-color: rgba(255, 65, 111, .34);
    background:
        linear-gradient(135deg, rgba(255, 65, 111, .12), rgba(255, 158, 24, .06)),
        var(--panel);
}

.danger-action {
    background: linear-gradient(135deg, #ff416f, #c91f4c);
    box-shadow: 0 14px 28px rgba(255, 65, 111, .24);
}

.dot {
    width: 12px;
    height: 12px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.player-picker {
    display: grid;
    gap: 10px;
}

.player-picker-tools {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.selection-count {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    border-radius: 8px;
    padding: 0 12px;
    background: rgba(138, 53, 255, .18);
    color: #d9c4ff;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.player-list {
    max-height: 280px;
    overflow: auto;
    padding-right: 4px;
}

.new-player-grid,
.counter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.counter-editor {
    display: grid;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.counter-editor:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.counter-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
}

.icon-picker {
    position: relative;
    align-self: end;
    z-index: 1;
}

.icon-picker.icon-picker-open {
    z-index: 240;
}

.icon-picker-toggle {
    width: 100%;
    min-height: 46px;
}

.icon-picker-menu {
    position: absolute;
    z-index: 250;
    top: calc(100% + 6px);
    left: 0;
    width: min(360px, calc(100vw - 40px));
    max-height: 340px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #111426;
    box-shadow: var(--shadow);
}

.icon-picker-group {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.icon-picker-group:last-child {
    margin-bottom: 0;
}

.icon-picker-group > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.icon-picker-group > div {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.icon-picker-group button {
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    padding: 0 8px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid var(--line);
    box-shadow: none;
    color: white;
    font-size: 13px;
    font-weight: 850;
}

.icon-picker-group button:hover {
    background: rgba(138, 53, 255, .26);
}

.counter-icon {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    vertical-align: middle;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.counter-icon.text {
    color: white;
    font-size: 17px;
    font-weight: 900;
}

.score-total {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.check-pill {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, .06);
    color: white;
}

.check-pill:has(input:checked) {
    border-color: rgba(138, 53, 255, .8);
    background: linear-gradient(135deg, rgba(138, 53, 255, .24), rgba(4, 199, 217, .12));
}

.check-pill input {
    width: auto;
    min-height: auto;
}

.add-player-button {
    margin-top: 10px;
    width: 100%;
}

.play-head,
.replay-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.replay-panel {
    background:
        linear-gradient(135deg, rgba(255, 194, 71, .14), rgba(255, 65, 111, .12)),
        var(--panel);
}

.replay-panel p {
    margin-bottom: 0;
}

.score-card {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 92px;
}

.score-card h2 {
    margin: 0;
}

.score-card strong {
    font-size: 30px;
}

.score-card.winner {
    border-color: rgba(255, 194, 71, .7);
    box-shadow: inset 0 0 0 1px rgba(255, 194, 71, .36), var(--shadow);
}

.score-card.loser {
    border-color: rgba(255, 65, 111, .45);
    opacity: .82;
}

.round-line {
    display: grid;
    grid-template-columns: 1fr 112px;
    gap: 10px;
    align-items: end;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.round-line:first-of-type {
    border-top: 0;
}

.scoring-panel {
    padding: 10px;
}

.score-entry-list {
    display: grid;
    gap: 6px;
}

.score-entry-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, .05);
}

.score-entry-row strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-stepper {
    display: grid;
    grid-template-columns: 34px 30px 42px 30px 34px;
    gap: 3px;
    align-items: center;
}

.score-stepper button,
.score-stepper input {
    min-height: 30px;
    padding: 4px 6px;
    text-align: center;
    border-radius: 7px;
}

.score-stepper button {
    min-width: 0;
    padding: 0;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--line);
    box-shadow: none;
}

.score-stepper input {
    width: 42px;
}

.score-entry-total {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 58px;
    color: white;
}

.score-entry-total b {
    font-size: 18px;
}

.score-entry-row > input,
.score-entry-row > select {
    width: min(120px, 100%);
    min-height: 32px;
    justify-self: end;
    padding: 4px 8px;
}

.mode-choice .check-pill {
    flex: 1 1 180px;
}

.score-entry-list.readonly .score-entry-row {
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
}

.score-entry-row.winner {
    border-color: rgba(255, 194, 71, .7);
    background: rgba(255, 194, 71, .1);
}

.score-entry-row.loser {
    opacity: .78;
}

.submit-score {
    width: 100%;
    margin-top: 10px;
}

.round-history {
    display: grid;
    gap: 8px;
}

.round-card {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.round-card:first-child {
    border-top: 0;
    padding-top: 0;
}

.round-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.round-card time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.round-score-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.round-score-chip {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, .05);
}

.round-score-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.round-score-chip b {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.round-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.round-summary > div {
    display: grid;
    min-height: 54px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
    text-align: center;
}

.round-summary strong {
    font-size: 22px;
}

.round-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.stat-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-numbers {
    display: grid;
    justify-items: end;
    gap: 2px;
    text-align: right;
}

.stat-numbers span,
.play-row strong,
.stat-line strong {
    font-weight: 850;
}

.result-pill {
    flex: 0 0 auto;
    background: rgba(138, 53, 255, .18);
    color: #d9c4ff;
}

.result-pill.win {
    background: rgba(25, 195, 125, .16);
    color: #74ffc3;
}

.result-pill.loss {
    background: rgba(255, 65, 111, .16);
    color: #ffb1c2;
}

@media (max-width: 620px) {
    body {
        padding-bottom: 64px;
    }

    .topbar {
        position: fixed;
        inset: auto 0 0 0;
        top: auto;
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        align-items: center;
        min-height: 52px;
        border-top: 1px solid rgba(255, 255, 255, .1);
        border-bottom: 0;
        border-radius: 0;
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
        background: #080a16;
        box-shadow: 0 -8px 18px rgba(0, 0, 0, .38);
    }

    .brand {
        display: none;
    }

    nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
        gap: 2px;
        font-size: 10px;
    }

    nav a {
        min-height: 38px;
        padding: 4px 2px;
        background: transparent;
        border: 0;
    }

    .nav-new {
        min-height: 46px;
        width: 46px;
        min-width: 46px;
        justify-self: center;
        margin-top: -15px;
        border-radius: 50%;
        font-size: 28px;
    }

    .session-bar {
        display: none;
    }

    .page {
        padding: 10px 10px 8px;
    }

    .account-strip {
        justify-content: flex-start;
        gap: 6px;
        margin-bottom: 8px;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 11px;
    }

    .account-strip span {
        margin-right: 0;
    }

    .account-strip a {
        min-height: 24px;
        padding: 0 7px;
    }

    .account-strip button {
        min-height: 24px;
        padding: 0 7px;
        font-size: 11px;
    }

    .hero {
        min-height: 122px;
        gap: 6px;
        padding: 14px 16px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .hero p {
        max-width: 250px;
        font-size: 14px;
        line-height: 1.2;
    }

    .hero-art {
        inset: 10px 14px auto auto;
        transform: scale(.58) rotate(-7deg);
        transform-origin: top right;
    }

    h1 {
        font-size: 25px;
    }

    .game-hero {
        grid-template-columns: 1fr;
    }

    .game-cover,
    .game-cover img,
    .cover-placeholder {
        min-height: 0;
    }

    .scoreboard {
        grid-template-columns: 1fr;
    }

    .quick-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .section-title-row {
        display: grid;
        gap: 3px;
    }

    .game-stats-grid {
        grid-template-columns: 1fr;
    }

    .campaign-card,
    .campaign-status-form,
    .passkey-name-form {
        grid-template-columns: 1fr;
    }

    .passkey-row {
        display: grid;
        align-items: stretch;
    }

    .game-stat-tiles .tile {
        min-height: 58px;
    }

    .game-stat-tiles .tile strong {
        font-size: 22px;
    }

    .check-grid {
        grid-template-columns: 1fr;
    }

    .new-player-grid,
    .counter-grid {
        grid-template-columns: 1fr;
    }

    .player-picker-tools {
        grid-template-columns: 1fr;
    }

    .selection-count {
        justify-content: center;
    }

    .play-head,
    .replay-panel,
    .player-hero,
    .stat-line,
    .play-row {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-tabs {
        grid-template-columns: 1fr;
    }

    .panel-actions {
        display: grid;
    }

    .stats-filters {
        grid-template-columns: 1fr;
    }

    .games-toolbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .games-toolbar label {
        gap: 5px;
    }

    .games-toolbar input,
    .scope-menu > button {
        min-height: 40px;
    }

    .games-toolbar button {
        min-height: 40px;
    }

    .game-list-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        min-height: 76px;
        padding: 10px;
    }

    .game-card-side {
        justify-items: end;
        align-self: stretch;
        align-content: center;
        gap: 6px;
    }

    .game-card-actions {
        display: flex;
        justify-content: flex-end;
    }

    .game-card-main {
        gap: 10px;
    }

    .game-list-card .game-thumb {
        width: 58px;
        height: 58px;
        font-size: 24px;
    }

    .game-card-main h2 {
        margin-bottom: 2px;
        font-size: 18px;
    }

    .game-card-main p {
        margin-bottom: 0;
        font-size: 14px;
    }

    .game-card-side .badge {
        padding: 4px 8px;
        font-size: 11px;
    }

    .game-card-actions .small-action {
        min-height: 30px;
        min-width: 54px;
        padding: 0 9px;
        font-size: 11px;
    }

    .player-row {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        gap: 8px;
        min-height: 52px;
        padding: 8px 10px;
    }

    .player-row .avatar {
        width: 32px;
        height: 32px;
    }

    .player-row strong {
        font-size: 15px;
    }

    .player-row span {
        max-width: 128px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 12px;
    }

    .selected-game-card {
        align-items: center;
        flex-direction: row;
    }

    .stat-numbers {
        justify-items: start;
        text-align: left;
    }

    .request-card,
    .user-admin-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .user-admin-card {
        display: grid;
    }

    .admin-actions {
        justify-content: stretch;
        margin-left: 0;
    }

    .admin-actions form,
    .admin-actions button {
        width: 100%;
    }

    .play-history-row {
        min-height: 46px;
    }

    .play-history-row span {
        max-width: 36%;
        font-size: 12px;
    }

    .panel {
        padding: 12px;
        margin-bottom: 10px;
    }

    .home-actions {
        gap: 8px;
    }

    .home-action {
        min-height: 64px;
        grid-template-columns: 46px 1fr;
        padding: 10px;
    }

    .action-icon {
        min-height: 38px;
        font-size: 11px;
    }

    .player-list {
        max-height: none;
    }

    .check-pill {
        min-height: 38px;
        padding: 6px 8px;
    }

    .scoring-panel {
        padding: 8px;
    }

    .score-entry-row {
        grid-template-columns: 22px minmax(0, 1fr) auto auto;
        min-height: 36px;
        gap: 6px;
        padding: 4px 5px;
    }

    .score-stepper {
        grid-column: auto;
        grid-template-columns: 28px 38px 28px;
        gap: 3px;
    }

    .score-stepper button,
    .score-stepper input {
        min-height: 28px;
        padding: 0 3px;
        font-size: 13px;
    }

    .score-stepper .wide-step {
        display: none;
    }

    .score-stepper input {
        width: 38px;
    }

    .score-entry-total {
        min-width: 38px;
    }

    .score-entry-total b {
        font-size: 16px;
    }

    .score-entry-list.readonly .score-entry-row {
        grid-template-columns: 24px minmax(0, 1fr) auto auto;
    }

    .counter-icon {
        width: 24px;
        height: 24px;
        border-radius: 7px;
        font-size: 14px;
    }

    .play-head {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .play-head h1 {
        margin-bottom: 4px;
    }

    .play-head p {
        margin-bottom: 0;
        font-size: 12px;
    }

    .play-head button {
        min-height: 36px;
        padding: 0 10px;
    }
}
