:root {
    --bg: #f5f5ef;
    --panel: #ffffff;
    --ink: #171717;
    --muted: #62625b;
    --line: #deded2;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --red: #b42318;
    --amber: #b45309;
    --blue: #1d4ed8;
    --shadow: 0 12px 32px rgba(23, 23, 23, .08);
}

.dark-theme {
    --bg: #0f1317;
    --panel: #151b20;
    --ink: #eef2f4;
    --muted: #a6b0b8;
    --line: #29333b;
    --shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 48px);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand { font-weight: 800; letter-spacing: 0; }

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav a,
.nav-user > button,
.btn,
button,
input[type="submit"] {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 12px;
    font: inherit;
    cursor: pointer;
}

.nav a.active,
.admin-sidebar a.active { color: var(--teal); font-weight: 700; }

.btn,
button.primary,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--teal);
    color: #fff;
    border-color: var(--teal);
    font-weight: 700;
}

.btn.alt { background: #fff; color: var(--teal); }
.btn.danger, button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.warning { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.small { min-height: 32px; padding: 6px 10px; }
.btn:disabled, button:disabled { opacity: .55; cursor: not-allowed; }

.nav-toggle { display: none; background: #fff; color: var(--ink); border-color: var(--line); }

.nav-user { position: relative; }
.nav-user > button { display: flex; align-items: center; gap: 8px; background: #fff; border-color: var(--line); }
.user-icon {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--teal);
    border-radius: 50%;
}
.user-icon:before {
    content: "";
    position: absolute;
    left: 5px;
    top: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--teal);
}
.user-icon:after {
    content: "";
    position: absolute;
    left: 3px;
    bottom: 3px;
    width: 8px;
    height: 5px;
    border-radius: 8px 8px 0 0;
    background: var(--teal);
}
.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 44px;
    min-width: 190px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 8px;
}
.nav-user.open .dropdown { display: grid; gap: 2px; }
.user-menu {
    width: min(310px, calc(100vw - 28px));
    min-width: 280px;
    overflow: hidden;
    padding: 0;
}
.user-menu-pages {
    display: grid;
    grid-template-columns: 100% 100%;
    grid-auto-flow: column;
    width: 200%;
    transition: transform .28s cubic-bezier(.19, 1, .22, 1);
}
.user-menu[data-menu-active="finance"] .user-menu-pages {
    transform: translateX(-50%);
}
.user-menu-page {
    display: grid;
    align-content: start;
    gap: 2px;
    min-height: 370px;
    max-height: min(72vh, 430px);
    overflow-y: auto;
    padding: 8px;
}
.user-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 6px 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.user-menu-head strong {
    font-size: 13px;
}
.user-menu-head button {
    min-height: 30px;
    padding: 5px 9px;
    border-color: var(--line);
    background: #fafaf6;
    color: var(--ink);
    font-size: 12px;
}
.user-menu a {
    display: grid;
    gap: 2px;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 6px;
}
.user-menu a:hover {
    background: #f4f5ef;
}
.user-menu a span {
    font-weight: 800;
}
.user-menu a small {
    color: var(--muted);
    font-size: 11px;
}
.user-menu .logout-link {
    color: var(--red);
}

.main {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 56px;
}

.section {
    margin: 28px 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 24px;
    align-items: stretch;
    min-height: 420px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 0;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: 0; margin: 0 0 14px; }
h1 { font-size: clamp(34px, 6vw, 64px); }
h2 { font-size: 26px; }
h3 { font-size: 18px; }
p { color: var(--muted); margin: 0 0 16px; }

.panel,
.room-card,
.stat,
.auth-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel { padding: 20px; }
.auth-box { width: min(480px, 100%); margin: 24px auto; padding: 24px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.stat { padding: 16px; }
.stat-link {
    display: block;
    transition: transform .16s ease, border-color .16s ease;
}
.stat-link:hover {
    transform: translateY(-1px);
    border-color: var(--teal);
}
.stat strong { display: block; font-size: 24px; }
.stat span { color: var(--muted); }

.rooms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
.room-card { overflow: hidden; display: flex; flex-direction: column; }
.room-image {
    height: 150px;
    background: linear-gradient(135deg, #0f766e, #1d4ed8 55%, #b45309);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
}
.room-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-card .body { padding: 16px; flex: 1; display: grid; gap: 10px; }
.room-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}
.room-title-row h3 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}
.room-mode-badge {
    flex: 0 0 auto;
    max-width: 118px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eef5ff;
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
}
.room-market-card {
    position: relative;
    height: 172px;
    overflow: hidden;
    display: block;
    padding: 12px;
    background: #0b0f14;
}
.room-market-card:before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 10%, rgba(15,118,110,.32), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(180,83,9,.34), transparent 30%),
        linear-gradient(135deg, rgba(29,78,216,.20), rgba(11,15,20,.92));
    pointer-events: none;
}
.room-market-top,
.room-market-bottom {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.room-market-top strong {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room-online-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}
.room-online-pill:before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00c087;
    box-shadow: 0 0 0 5px rgba(0,192,135,.16);
}
.room-mini-chart {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 112px;
    margin-top: -2px;
}
.mini-grid line {
    stroke: rgba(255,255,255,.08);
    stroke-width: 1;
}
.mini-up line,
.mini-up rect {
    stroke: #00c087;
    fill: #00c087;
}
.mini-down line,
.mini-down rect {
    stroke: #f23645;
    fill: #f23645;
}
.mini-volume {
    opacity: .18;
    stroke: none;
}
.mini-line-up,
.mini-line-down {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px rgba(255,255,255,.18));
}
.mini-line-up { stroke: #00c087; }
.mini-line-down { stroke: #f23645; }
.room-market-bottom {
    margin-top: -8px;
    font-size: 13px;
}
.room-market-bottom span {
    color: rgba(255,255,255,.78);
}
.room-card-stats {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 8px;
}
.room-card-stats span {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafaf6;
    color: var(--muted);
    font-size: 12px;
}
.room-card-stats strong {
    color: var(--ink);
    font-size: 15px;
}
.room-pool-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px;
    border: 1px solid #b8ddd5;
    border-radius: 6px;
    background: #e6f6ef;
}
.room-pool-stat span {
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 800;
}
.room-pool-stat strong {
    color: var(--teal-dark);
    font-size: 16px;
}
.room-live-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.room-live-labels span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 8px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.card-live-labels {
    margin-top: 2px;
}
.room-card-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.room-card-actions .btn {
    width: 100%;
}
.room-live-labels:empty {
    display: none;
}
.stat-flash {
    animation: statFlash 1.1s ease-out;
}
@keyframes statFlash {
    0% { background: rgba(15,118,110,.18); border-radius: 4px; }
    100% { background: transparent; }
}
.home-featured-market {
    margin-top: 0;
    padding: 14px;
    overflow: hidden;
    border: 1px solid #202a32;
    border-radius: 8px;
    background: #0b0f14;
    color: #d6dde3;
    box-shadow: var(--shadow);
}
.home-featured-head,
.home-featured-foot,
.home-control-head,
.home-flow-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.home-featured-head h2 {
    margin: 3px 0 0;
    color: #fff;
    font-size: 22px;
}
.home-featured-market .meta {
    color: #8f9ba5;
    font-weight: 800;
}
.home-featured-chart {
    display: block;
    width: 100%;
    height: 238px;
    margin: -14px 0 0;
}
.home-featured-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}
.home-chart-grid line {
    stroke: rgba(255,255,255,.08);
    stroke-width: 1;
}
.home-line-up,
.home-line-down {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 6px rgba(255,255,255,.18));
}
.home-line-up { stroke: #00c087; }
.home-line-down { stroke: #f23645; }
.home-featured-foot {
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #202a32;
}
.home-featured-foot div {
    display: grid;
    gap: 2px;
}
.home-featured-foot span {
    color: #8f9ba5;
    font-size: 12px;
    font-weight: 800;
}
.home-featured-foot strong {
    color: #fff;
    font-size: 18px;
}
.home-control {
    display: grid;
    align-content: start;
    gap: 14px;
}
.home-control-head h2 {
    margin-bottom: 3px;
}
.home-control-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.home-control-stats .stat {
    padding: 12px;
}
.home-control-stats .stat strong {
    font-size: 21px;
}
.home-flow-head strong {
    font-size: 14px;
}
.home-flow {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 9px;
    height: 250px;
    overflow: hidden;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fafaf6 0%, #fff 45%, #fafaf6 100%);
}
.home-flow:before,
.home-flow:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    height: 30px;
    pointer-events: none;
}
.home-flow:before {
    top: 0;
    background: linear-gradient(180deg, #fafaf6, rgba(250,250,246,0));
}
.home-flow:after {
    bottom: 0;
    background: linear-gradient(0deg, #fafaf6, rgba(250,250,246,0));
}
.home-flow-item {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    min-height: 72px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 18px rgba(23, 23, 23, .05);
    transition: transform .7s ease, opacity .7s ease, border-color .7s ease;
}
.home-flow-item.is-new {
    animation: feedSlowSlide 1.45s cubic-bezier(.19, 1, .22, 1);
}
.home-flow-item.is-leaving {
    opacity: 0;
    transform: translateY(-24px);
}
.flow-up { border-left: 4px solid var(--teal); }
.flow-down { border-left: 4px solid var(--red); }
.flow-up .feed-icon { background: var(--teal); }
.flow-down .feed-icon { background: var(--red); }
.home-flow-body {
    min-width: 0;
    display: grid;
    gap: 5px;
}
.home-flow-empty {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 13px;
}
.meta { color: var(--muted); font-size: 13px; }

form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, textarea, select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compact-thresholds { gap: 10px; }
.help { color: var(--muted); font-size: 13px; }
.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.checkline input { width: auto; min-height: auto; }
.inline-search,
.filter-form {
    display: flex;
    flex-direction: row;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}
.inline-search input,
.filter-form input,
.filter-form select { min-width: 160px; }
.row-actions {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.row-actions input,
.row-actions select { width: auto; min-width: 120px; }

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: #fff;
}
.alert-error { border-color: #f4b4ad; color: var(--red); }
.alert-success { border-color: #97d5c7; color: var(--teal-dark); }
.alert-info { border-color: #aac5fb; color: var(--blue); }

.table-tools {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; background: #fafaf6; }
tr:last-child td { border-bottom: 0; }
.positive { color: var(--teal); font-weight: 800; }
.negative { color: var(--red); font-weight: 800; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 12px; background: #ededdf; }
.badge.open { color: var(--blue); }
.badge.closed, .badge.approved { color: var(--teal); }
.badge.pending { color: var(--amber); }
.badge.rejected, .badge.frozen { color: var(--red); }
.badge.risk-high { color: var(--red); background: #fff0ed; }
.badge.risk-medium { color: var(--amber); background: #fff7e8; }
.badge.risk-low { color: var(--teal); background: #e6f6ef; }

.pagination { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pagination a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pagination a.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.table-submeta {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { background: #fff; color: var(--ink); border-color: var(--line); }
.tabs button.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.live-pager {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
}
.live-pnl {
    transition: background-color .2s ease, color .2s ease;
}
.live-pnl.flash-up {
    background: #e6f6ef;
}
.live-pnl.flash-down {
    background: #fff0ed;
}

.play-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
.play-page {
    margin-top: 12px;
}
.play-room-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.play-room-copy {
    min-width: 0;
}
.play-room-copy h1 {
    margin-bottom: 6px;
    font-size: clamp(28px, 4vw, 44px);
}
.play-room-copy p {
    max-width: 760px;
    margin-bottom: 0;
}
.play-room-stats {
    grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
    gap: 10px;
}
.play-room-stats .stat {
    padding: 10px 12px;
    box-shadow: none;
}
.play-room-stats .stat strong {
    font-size: 18px;
}
.play-room-stats .stat span {
    font-size: 12px;
}
.play-main-column {
    min-width: 0;
    display: grid;
    gap: 14px;
}
.chart-box {
    position: relative;
    min-height: clamp(470px, calc(100vh - 230px), 680px);
    overflow: hidden;
    border: 1px solid #202a32;
    border-radius: 8px;
    background: #0b0f14;
    display: grid;
    grid-template-rows: auto minmax(340px, 1fr) auto;
}
.play-page .panel.section {
    margin: 0;
}
.game-chart-head {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 12px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #202a32;
    background: #0f151b;
    color: #d6dde3;
}
.chart-title-block {
    display: grid;
    gap: 5px;
}
.chart-symbol-row,
.chart-price-row,
.chart-ohlc {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.chart-symbol {
    font-size: 15px;
    letter-spacing: .02em;
}
.live-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #8ee8d8;
    font-size: 12px;
    font-weight: 800;
}
.live-dot:before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0fbd8c;
    box-shadow: 0 0 0 5px rgba(15,189,140,.12);
    animation: livePulse 1.2s infinite ease-out;
}
@keyframes livePulse {
    0% { transform: scale(.9); opacity: .6; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(.9); opacity: .6; }
}
.game-chart-head strong {
    display: block;
    line-height: 1.1;
}
.chart-price-row > strong {
    font-size: 28px;
    color: #f2f5f7;
}
.chart-change {
    min-width: 86px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,.06);
}
.chart-change.up { color: #00c087; background: rgba(0,192,135,.11); }
.chart-change.down { color: #f23645; background: rgba(242,54,69,.11); }
.chart-toolbar {
    display: flex;
    align-items: start;
    justify-content: flex-end;
    gap: 6px;
}
.chart-toolbar button {
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #151d25;
    border-color: #25313b;
    color: #aeb9c2;
    font-size: 12px;
}
.chart-toolbar button.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}
.chart-toolbar button:hover {
    border-color: #3b82f6;
    color: #fff;
}
.chart-ohlc {
    grid-column: 1 / -1;
    gap: 12px;
    color: #8f9ba5;
    font-size: 12px;
}
.chart-ohlc strong {
    display: inline;
    color: #d6dde3;
}
#game_chart {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 390px;
    background: #0b0f14;
    cursor: crosshair;
}
.chart-detail {
    position: absolute;
    z-index: 8;
    width: 260px;
    max-width: calc(100% - 20px);
    padding: 12px;
    border: 1px solid #33414d;
    border-radius: 8px;
    background: rgba(15, 21, 27, .96);
    color: #d6dde3;
    box-shadow: 0 18px 42px rgba(0,0,0,.35);
    backdrop-filter: blur(10px);
}
.chart-detail strong,
.chart-detail span {
    display: block;
}
.chart-detail > strong {
    color: #fff;
    margin-bottom: 8px;
}
.chart-detail span {
    color: #9aa7b2;
    font-size: 12px;
    line-height: 1.45;
}
.chart-detail span strong {
    display: inline;
    color: #d6dde3;
}
.chart-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid #202a32;
    background: #0f151b;
    color: #8f9ba5;
    font-size: 13px;
}
.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chart-legend span:before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.legend-up:before { background: var(--teal); }
.legend-down:before { background: var(--red); }
.chart-pulse {
    animation: chartPulse .28s ease-out;
}
@keyframes chartPulse {
    from { transform: scale(1.008); }
    to { transform: scale(1); }
}
.trade-form {
    position: sticky;
    top: 82px;
    align-self: start;
}
.balance-link {
    display: block;
    padding: 14px;
    border-radius: 8px;
    background: #171717;
    color: #fff;
    font-weight: 800;
    margin-bottom: 12px;
}
.player-progress-card,
.room-boss-card {
    margin-bottom: 12px;
}
.room-tournament-card {
    margin-bottom: 12px;
    border-color: rgba(37, 99, 235, .28);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
}
.level-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 6px 9px;
    border-radius: 999px;
    background: #171717;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}
.xp-bar {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #ededdf;
}
.xp-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--teal), var(--blue));
    transition: width .45s ease;
}
.progress-meta,
.boss-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}
.boss-body {
    align-items: flex-start;
    padding: 10px;
    border-radius: 7px;
    background: #fafaf6;
}
.boss-body strong {
    color: var(--ink);
    font-size: 16px;
}
.boss-body span {
    text-align: right;
}
.leaderboard-list {
    display: grid;
    gap: 7px;
}
.leader-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}
.leader-row span {
    font-weight: 900;
}
.reward-list {
    display: grid;
    gap: 5px;
    padding: 10px;
    border: 1px solid rgba(20, 162, 114, .28);
    border-radius: 8px;
    background: #fbfffd;
    color: var(--muted);
    font-size: 12px;
}
.reward-list strong {
    color: var(--ink);
    font-size: 13px;
}
.direction-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.direction-control label { display: block; }
.direction-control input { position: absolute; opacity: 0; pointer-events: none; }
.direction-control span {
    display: block;
    text-align: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}
.direction-control input:checked + span.up { background: #e6f6ef; border-color: var(--teal); color: var(--teal-dark); }
.direction-control input:checked + span.down { background: #fff0ed; border-color: var(--red); color: var(--red); }
.feed-panel {
    display: grid;
    gap: 10px;
}
.feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.feed-head h3 {
    margin-bottom: 3px;
}
.feed-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e6f6ef;
    color: var(--teal-dark);
    font-size: 11px;
    font-weight: 900;
}
.feed-status:before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 5px rgba(15, 118, 110, .12);
}
.feed-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}
.feed-filters button {
    min-height: 30px;
    padding: 5px 7px;
    border-color: var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.feed-filters button.active {
    background: #171717;
    border-color: #171717;
    color: #fff;
}
.feed {
    position: relative;
    height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fafaf6 0%, #fff 45%, #fafaf6 100%);
}
.feed:before,
.feed:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    height: 32px;
    pointer-events: none;
}
.feed:before {
    top: 0;
    background: linear-gradient(180deg, #fafaf6, rgba(250,250,246,0));
}
.feed:after {
    bottom: 0;
    background: linear-gradient(0deg, #fafaf6, rgba(250,250,246,0));
}
.feed-item {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    min-height: 78px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 8px 18px rgba(23, 23, 23, .05);
    transition: transform .7s ease, opacity .7s ease, border-color .7s ease;
}
.feed-item.is-new {
    animation: feedSlowSlide 1.45s cubic-bezier(.19, 1, .22, 1);
}
.feed-item.is-leaving {
    opacity: 0;
    transform: translateY(-24px);
}
.feed-up { border-left: 4px solid var(--teal); }
.feed-down { border-left: 4px solid var(--red); }
.feed-closed { border-left: 4px solid var(--blue); }
.feed-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #171717;
    color: #fff;
    font-weight: 900;
    font-size: 16px;
}
.feed-up .feed-icon { background: var(--teal); }
.feed-down .feed-icon { background: var(--red); }
.feed-closed .feed-icon { background: var(--blue); }
.feed-body {
    min-width: 0;
    display: grid;
    gap: 5px;
}
.feed-line,
.feed-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}
.feed-line strong {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.feed-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: #ededdf;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}
.feed-amount {
    margin-left: auto;
    font-weight: 900;
}
.feed-body p {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
}
.feed-meta {
    color: var(--muted);
    font-size: 12px;
}
.room-side-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}
.room-chat-panel {
    margin-top: 12px;
}
.room-chat {
    display: grid;
    align-content: end;
    gap: 8px;
    height: 250px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafaf6;
}
.chat-message {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.chat-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #171717;
    color: #fff;
    font-weight: 900;
}
.chat-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.chat-head strong {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-level,
.chat-streak,
.chat-time {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.chat-streak {
    color: var(--teal-dark);
}
.chat-message p {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.chat-message.chat-system {
    border-color: #b8ddd5;
    background: #e6f6ef;
}
.chat-message.chat-system .chat-avatar {
    background: var(--teal);
    color: #fff;
}
.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.chat-reactions button {
    min-height: 24px;
    padding: 3px 7px;
    border-color: var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 11px;
}
.chat-reaction-count {
    padding: 3px 7px;
    border-radius: 999px;
    background: #ededdf;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.room-player strong[data-player-card] {
    cursor: pointer;
    color: var(--teal);
}
.player-card-toast {
    min-width: 280px;
}
.chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.mini-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.mode-card {
    background: linear-gradient(180deg, #ffffff, #f8fbf8);
}
.mode-settings-form {
    gap: 18px;
}
.mode-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    align-items: start;
}
.mode-settings-card {
    display: grid;
    gap: 12px;
    box-shadow: none;
}
.mode-settings-card header {
    display: grid;
    gap: 4px;
}
.mode-settings-card header h2 {
    margin: 0;
    font-size: 19px;
}
.mode-settings-card header p {
    margin: 0;
    font-size: 13px;
}
.mode-setting-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.mode-setting-fields label {
    min-width: 0;
    font-size: 13px;
}
.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.mode-directory-card .body {
    align-content: start;
}
.mode-detail {
    display: grid;
    gap: 18px;
}
.mode-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
    gap: 16px;
    align-items: stretch;
}
.mode-detail-copy {
    display: grid;
    align-content: center;
    gap: 12px;
    min-height: 260px;
}
.mode-room-list,
.mode-extra-list {
    display: grid;
    gap: 9px;
}
.mode-row-card {
    display: grid;
    gap: 4px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    transition: border-color .16s ease, transform .16s ease;
}
.mode-row-card:hover {
    border-color: var(--teal);
    transform: translateY(-1px);
}
.mode-row-card strong {
    overflow-wrap: anywhere;
}
.mode-row-card span,
.mode-row-card small {
    color: var(--muted);
}
.mode-monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.mode-monitor-card {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafaf6;
}
.mode-monitor-card:hover {
    border-color: var(--teal);
}
.mode-monitor-card strong {
    font-size: 15px;
}
.mode-monitor-card small {
    color: var(--teal-dark);
    font-weight: 900;
}
.mode-monitor-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.mode-monitor-stats span {
    min-width: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}
.alert-list {
    display: grid;
    gap: 10px;
}
.game-alert {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 8px;
    background: #fff;
}
.game-alert span {
    color: var(--muted);
    font-size: 13px;
}
.game-alert.low { border-left-color: var(--teal); }
.game-alert.medium { border-left-color: var(--amber); }
.game-alert.high { border-left-color: var(--red); }
.mode-flow {
    min-height: 250px;
}
.mode-highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.mode-highlight {
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafaf6;
}
.mode-highlight strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
    overflow-wrap: anywhere;
}
.mode-highlight span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}
.team-meter {
    position: relative;
    height: 32px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(242,54,69,.20), rgba(242,54,69,.12));
}
.team-meter span {
    display: block;
    height: 100%;
    min-width: 3%;
    background: linear-gradient(90deg, rgba(0,192,135,.78), rgba(0,150,110,.92));
    transition: width 900ms cubic-bezier(.19, 1, .22, 1);
}
.team-meter strong {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 0 12px;
    color: var(--ink);
    font-size: 12px;
    text-align: center;
}
.room-player-list,
.room-leader-list {
    display: grid;
    gap: 8px;
}
.room-player,
.room-leader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafaf6;
}
.room-player span,
.room-leader span {
    color: var(--muted);
    font-size: 12px;
}
@keyframes feedSlowSlide {
    0% {
        opacity: 0;
        transform: translateY(42px) scale(.985);
    }
    55% {
        opacity: .94;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: grid; gap: 8px; max-width: 320px; }
.toast { padding: 12px 14px; background: #171717; color: #fff; border-radius: 8px; box-shadow: var(--shadow); }
.toast strong,
.toast span,
.toast a {
    display: block;
}
.toast .toast-detail {
    color: rgba(255,255,255,.74);
    font-size: 13px;
    margin-top: 3px;
}
.toast a {
    color: #8ee8d8;
    font-weight: 800;
    margin-top: 8px;
}
.admin-toast {
    border-left: 4px solid var(--teal);
}

.pwa-install-banner {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 950;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    width: min(390px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid rgba(15, 118, 110, .26);
    border-radius: 8px;
    background: rgba(255, 255, 255, .97);
    color: var(--ink);
    box-shadow: 0 18px 44px rgba(23, 23, 23, .16);
    backdrop-filter: blur(14px);
}
.pwa-install-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--teal);
    color: #fff;
    font-size: 22px;
    font-weight: 900;
}
.pwa-install-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.pwa-install-copy strong {
    font-size: 14px;
    line-height: 1.25;
}
.pwa-install-copy span {
    color: var(--muted);
    font-size: 12px;
}
.pwa-install-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.pwa-install-actions button {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
}
.pwa-install-primary {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}
.pwa-install-secondary {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}
.dark-theme .pwa-install-banner {
    background: rgba(21, 27, 32, .97);
}

.admin-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
.admin-sidebar { display: grid; align-content: start; gap: 6px; }
.admin-sidebar a { padding: 10px 12px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.admin-content { min-width: 0; }
.system-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.health-card {
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.health-card.ok { border-color: rgba(20, 162, 114, .35); }
.health-card.fail { border-color: rgba(214, 75, 64, .45); background: #fff8f7; }
.health-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.commission-stats {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    min-width: min(420px, 100%);
}
.security-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 14px;
}
.security-tabs {
    margin-top: 8px;
}
.commission-table td > strong,
.commission-table td > span {
    display: block;
}
.member-link {
    color: var(--teal);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.commission-detail {
    display: grid;
    gap: 3px;
    min-width: 190px;
}
.commission-detail span {
    color: var(--muted);
    font-size: 13px;
}
.commission-detail strong {
    color: var(--ink);
}
.dashboard-message {
    min-width: 260px;
    max-width: 520px;
    white-space: normal;
}
.live-row {
    animation: softLive .22s ease-out;
}
@keyframes softLive {
    from { background: #e6f6ef; }
    to { background: #fff; }
}

.profile-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}
.avatar {
    width: 86px;
    height: 86px;
    border-radius: 8px;
    background: #171717;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 34px;
    font-weight: 800;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.wallet-address {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    word-break: break-all;
}
.message-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
}
.folder-list {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}
.folder-list a {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}
.folder-list a.active {
    border-color: var(--teal);
    color: var(--teal);
    font-weight: 800;
}
.notification-list,
.address-list,
.badge-list {
    display: grid;
    gap: 10px;
}
.notification-item,
.address-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.notification-item h3 {
    margin: 6px 0 4px;
}
.notification-item p {
    margin-bottom: 6px;
}
.notification-item.is-read {
    opacity: .72;
}
.notification-list.compact .notification-item {
    align-items: flex-start;
}
.address-item {
    align-items: flex-start;
    flex-direction: column;
}
.badge-list {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.dashboard-xp {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}
.quick-card {
    display: grid;
    gap: 5px;
    color: var(--ink);
}
.quick-card strong {
    font-size: 20px;
}
.quick-card span {
    color: var(--muted);
}
.tournament-grid,
.task-grid {
    align-items: start;
}
.tournament-card,
.task-card {
    display: grid;
    gap: 12px;
}
.tournament-meta {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}
.task-card.done {
    border-color: rgba(20, 162, 114, .32);
    background: #fbfffd;
}
.reward-card,
.achievement-card,
.event-card {
    display: grid;
    gap: 10px;
    align-content: start;
}
.reward-card.claimed,
.achievement-card.done {
    border-color: rgba(20, 162, 114, .32);
    background: #fbfffd;
}
.observer-chart,
.demo-chart-box,
.replay-page .chart-box {
    min-height: 520px;
}
.demo-controls {
    display: grid;
    gap: 14px;
    align-content: start;
}
.support-thread {
    display: grid;
    gap: 10px;
    margin: 14px 0;
}
.support-message {
    max-width: 82%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}
.support-message.admin {
    margin-left: auto;
    border-color: #b8ddd5;
    background: #e6f6ef;
}
.support-message p {
    margin: 6px 0;
}
.reward-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, #101820, #163b48);
    color: #fff;
}
.reward-hero p {
    color: rgba(255,255,255,.78);
}

.footer {
    border-top: 1px solid var(--line);
    padding: 28px clamp(16px, 4vw, 48px);
    background: #fff;
}
.footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 12px;
}
.footer a { color: var(--muted); }
.footer p { font-size: 13px; margin-bottom: 0; }

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0 14px;
}
.section-heading h2 {
    margin: 0 0 6px;
    font-size: 24px;
}
.section-heading p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
}
.rooms-heading {
    margin-top: 30px;
}
.table-game-section {
    margin-top: 18px;
}
.table-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 16px;
}
.table-game-card {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 0;
}
.table-game-card .body {
    display: grid;
    gap: 10px;
    padding: 14px;
    min-width: 0;
}
.table-game-card .room-title-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
    min-width: 0;
}
.table-game-card .room-title-row h3 {
    min-width: 0;
    overflow-wrap: anywhere;
}
.table-game-card .room-card-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}
.table-game-card .room-card-stats span {
    min-width: 0;
    width: auto;
    padding: 10px 9px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
}
.table-game-card .room-mode-badge,
.table-game-card .room-online-pill {
    white-space: nowrap;
}
.table-game-card .room-mode-badge {
    max-width: 100%;
    justify-self: end;
}
.table-game-card .room-pool-stat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 12px 10px;
    min-width: 0;
}
.table-game-card .room-pool-stat span,
.table-game-card .room-pool-stat strong {
    min-width: 0;
    overflow-wrap: anywhere;
}
.table-game-card .room-pool-stat strong {
    text-align: right;
}
.table-game-visual {
    min-height: 146px;
    padding: 18px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(10, 14, 22, .92), rgba(15, 118, 110, .78)),
        repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px 36px);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}
.table-game-visual strong {
    display: block;
    font-size: 21px;
    margin-top: 8px;
}
.table-game-category {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.18);
    font-size: 12px;
    font-weight: 700;
}
.table-game-dice {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    display: flex;
    gap: 8px;
}
.table-game-dice span {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: inset 0 0 0 6px rgba(255,255,255,.04);
}
.table-game-dice span:nth-child(2) {
    transform: translateY(-8px);
}
.table-game-dice span:nth-child(3) {
    transform: translateY(4px);
}
.room-pool-stat.compact {
    margin-top: 8px;
}
.table-game-result {
    min-height: 40px;
    display: grid;
    gap: 6px;
    margin: 12px 0;
}
.table-game-result span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}
.table-game-join {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    min-width: 0;
}
.table-game-join label {
    margin: 0;
    min-width: 0;
}
.table-game-join label span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.table-game-join button {
    grid-column: 1 / -1;
}
.table-game-join input,
.table-game-join select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.comfort-lobby {
    display: grid;
    grid-template-columns: minmax(220px, .9fr) minmax(280px, 1.4fr);
    gap: 14px;
    margin: 16px 0 22px;
}
.dashboard-comfort {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.comfort-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    padding: 16px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.comfort-panel h2 {
    margin: 8px 0 6px;
    font-size: 20px;
}
.comfort-panel p {
    color: var(--muted);
    margin: 0 0 12px;
}
.comfort-quick {
    background: linear-gradient(135deg, #071018, #0f766e);
    color: #fff;
}
.comfort-quick p {
    color: rgba(255,255,255,.8);
}
.comfort-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.comfort-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 11px;
    color: var(--text);
    background: #fff;
    font-weight: 700;
    font-size: 13px;
}
.comfort-chip.active,
.comfort-chip:hover {
    border-color: #0f766e;
    background: #e6fffa;
    color: #0f766e;
}
.comfort-item-list {
    display: grid;
    gap: 8px;
}
.comfort-item-list a {
    display: grid;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: #fff;
}
.comfort-item-list span {
    color: var(--muted);
    font-size: 12px;
}
.table-fav-btn {
    width: fit-content;
    margin: -2px 0 8px;
}
.help-dot {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #0f766e;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}
.comfort-help-pop {
    position: absolute;
    z-index: 1000;
    max-width: 280px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #071018;
    color: #fff;
    box-shadow: var(--shadow);
    font-size: 13px;
    line-height: 1.45;
}
.comfort-preferences {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}
.comfort-preferences h2 {
    margin-top: 0;
}
.mobile-bottom-nav {
    display: none;
}
.compact-cards .room-card .body,
.compact-cards .table-game-card .body,
.compact-cards .panel {
    padding: 12px;
}
.performance-mode .room-mini-chart .mini-volume,
.performance-mode .stat-flash,
.reduce-motion *,
.performance-mode * {
    animation: none !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
}

@media (max-width: 380px) {
    .table-game-card .room-title-row,
    .table-game-card .room-card-stats,
    .table-game-join {
        grid-template-columns: 1fr;
    }
    .table-game-card .room-mode-badge {
        justify-self: start;
    }
}
.table-game-activity {
    margin-top: 18px;
}
.table-game-feed {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
}
.table-game-feed-item {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--panel);
}
.table-game-feed-item.is-win {
    border-left-color: #00a878;
}
.table-game-feed-item.is-loss {
    border-left-color: #dc2626;
}
.table-game-feed-item small {
    color: var(--muted);
}
.inline-admin-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(90px, 1fr));
    gap: 8px;
    align-items: end;
    min-width: 260px;
}
.inline-admin-form label {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}
.inline-admin-form input[type="number"] {
    min-width: 0;
    width: 100%;
    margin-top: 4px;
}
.inline-admin-form .checkline,
.inline-admin-form button {
    align-self: center;
}

@media (max-width: 860px) {
    body {
        padding-bottom: 70px;
    }
    .comfort-lobby,
    .dashboard-comfort {
        grid-template-columns: 1fr;
    }
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        padding: 8px;
        border-top: 1px solid var(--border);
        background: rgba(255,255,255,.96);
        box-shadow: 0 -8px 30px rgba(15,23,42,.12);
    }
    .mobile-bottom-nav a {
        display: grid;
        place-items: center;
        min-height: 42px;
        border-radius: 8px;
        color: var(--text);
        font-size: 12px;
        font-weight: 800;
    }
    .mobile-bottom-nav a.primary {
        background: #0f766e;
        color: #fff;
    }
    .pwa-install-banner {
        left: 12px;
        right: 12px;
        bottom: 82px;
        width: auto;
    }
    .nav-toggle { display: inline-flex; }
    .nav {
        display: none;
        position: absolute;
        left: 16px;
        right: 16px;
        top: 64px;
        padding: 12px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow);
        align-items: stretch;
        flex-direction: column;
    }
    .nav.open { display: flex; }
    .dropdown { position: static; box-shadow: none; margin-top: 6px; }
    .user-menu {
        width: 100%;
        min-width: 0;
    }
    .user-menu-page {
        max-height: 390px;
    }
    .hero, .play-layout, .admin-shell, .message-layout, .grid.cols-2, .grid.cols-3, .grid.cols-4, .stats, .form-row {
        grid-template-columns: 1fr;
    }
    .mode-detail-hero,
    .mode-setting-fields {
        grid-template-columns: 1fr;
    }
    .play-room-head {
        gap: 10px;
    }
    .play-room-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .play-room-stats .stat strong {
        font-size: 16px;
    }
    .chart-box {
        min-height: 500px;
    }
    .sticky-actions {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }
    .trade-form { position: static; }
}
