* {
    box-sizing: border-box;
}

html,
body,
.app-root,
main,
.game-shell {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: #10140f;
    color: #f3efe2;
    font-family: "Segoe UI", system-ui, sans-serif;
}

body.admin-page {
    overflow-y: auto;
    overflow-x: hidden;
}

body.admin-page .app-root,
body.admin-page main {
    height: auto;
    min-height: 100%;
    overflow: visible;
}

:root {
    --frame-image: url("/gfx/ui/frames/window-frame-9slice.png");
    --frame-slice: 128;
    --ui-scale: 1;
    --control-size: calc(44px * var(--ui-scale));
    --control-icon-size: calc(30px * var(--ui-scale));
    --side-panel-width: min(384px, calc(100vw - 24px));
    --tool-panel-reserve: calc((var(--control-size) * 2) + 92px);
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

#worldCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    background: #1b2517;
    contain: strict;
}

.map-overlay {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.territory-border-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

.hex-selection-marker {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    width: var(--selection-size);
    height: var(--selection-size);
    transform: translate3d(var(--selection-x), var(--selection-y), 0) translate(-50%, -50%);
    border-radius: 50%;
    background: transparent;
    border: max(5px, calc(var(--selection-size) * 0.07)) solid #fff2a8;
    box-shadow: 0 0 0 3px rgba(27, 16, 0, 0.96), 0 0 22px rgba(245, 197, 66, 0.95), inset 0 0 18px rgba(245, 197, 66, 0.35);
    will-change: transform;
}

.hex-selection-marker.hidden {
    display: none;
}

.rectangle-selection-overlay {
    position: fixed;
    z-index: 11;
    pointer-events: none;
    border: 2px solid #f5c542;
    background: rgba(245, 197, 66, 0.14);
    box-shadow: 0 0 0 1px rgba(27, 16, 0, 0.9), inset 0 0 18px rgba(245, 197, 66, 0.22);
}

.rectangle-selection-overlay.hidden {
    display: none;
}

.top-bar {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 12;
    min-height: 48px;
    display: grid;
    grid-template-columns: fit-content(240px);
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 12px / 3px round;
    background: rgba(16, 20, 15, 0.9);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    overflow-x: auto;
    scrollbar-width: thin;
}

.top-bar > div,
.top-bar > .top-status-button {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 7px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    font-variant-numeric: tabular-nums;
}

.top-bar > div.status-online,
.top-bar > div.status-offline,
.top-bar > div.status-problem,
.top-bar > div.status-connecting {
    font-weight: 700;
}

.top-bar > div.status-online {
    color: #67ec83;
}

.top-bar > div.status-offline,
.top-bar > div.status-problem {
    color: #ff7c72;
}

.top-bar > div.status-connecting {
    color: #f5c542;
}

#status {
    min-width: 18ch;
    text-align: center;
}

.brand {
    font-weight: 800;
    color: #f5c542;
    max-width: 240px;
}

.top-menu-button {
    width: max-content;
    min-width: 0;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    background: #d7a62a;
    color: #17170e;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.top-status-button {
    border: 1px solid rgba(243, 239, 226, 0.18);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.top-status-button:hover:not(:disabled) {
    border-color: rgba(243, 239, 226, 0.38);
    background: rgba(255, 255, 255, 0.11);
}

.top-status-button:disabled {
    cursor: default;
    opacity: 1;
}

.top-status-button.icbm-ready {
    color: #67ec83;
    border-color: rgba(103, 236, 131, 0.36);
    background: rgba(45, 102, 53, 0.42);
}

.top-status-button.icbm-cooldown {
    color: #ff7c72;
    border-color: rgba(255, 124, 114, 0.34);
    background: rgba(121, 40, 36, 0.42);
}

.top-alert-stack {
    position: fixed;
    top: 82px;
    left: 50%;
    z-index: 20;
    display: grid;
    gap: 8px;
    transform: translateX(-50%);
}

.top-alert {
    min-width: 220px;
    padding: 10px 18px;
    border: 1px solid rgba(243, 239, 226, 0.18);
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.top-alert-danger {
    border-color: rgba(255, 124, 114, 0.5);
    background: rgba(118, 26, 23, 0.92);
    color: #ffd3d0;
}

.top-alert-danger:hover {
    border-color: rgba(255, 160, 151, 0.74);
    background: rgba(156, 36, 32, 0.96);
}

.top-alert-power {
    border-color: rgba(245, 197, 66, 0.46);
    background: linear-gradient(180deg, rgba(97, 74, 12, 0.94), rgba(49, 38, 8, 0.96));
    color: #fff2ba;
}

.top-alert-power:disabled {
    opacity: 1;
    cursor: default;
}

.tool-panel,
.map-controls {
    position: fixed;
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 12px / 3px round;
    background: rgba(16, 20, 15, 0.9);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
}

.tool-panel {
    left: 50%;
    bottom: 12px;
    z-index: 8;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: max-content;
    max-width: max(280px, calc(100vw - 560px));
    overflow-x: auto;
    overflow-y: hidden;
    transform: translateX(-50%);
    scrollbar-width: thin;
}

.tool-hint {
    position: fixed;
    z-index: 11;
    left: 50%;
    right: auto;
    bottom: calc(12px + var(--tool-panel-reserve));
    width: min(calc((var(--control-size) * 14) + 120px), max(280px, calc(100vw - 560px)));
    max-width: max(280px, calc(100vw - 560px));
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid rgba(245, 197, 66, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(22, 28, 19, 0.97), rgba(8, 11, 8, 0.96)),
        radial-gradient(circle at top right, rgba(245, 197, 66, 0.16), transparent 36%);
    color: #c9d2bf;
    font-size: 12px;
    line-height: 16px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 120ms ease, transform 120ms ease;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(243, 239, 226, 0.05);
}

.tool-hint.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.tool-hint > strong {
    display: block;
    margin-bottom: 4px;
    color: #f5c542;
    font-size: 13px;
}

.tool-hint-body {
    display: block;
}

.tool-hint-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tool-hint-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid rgba(243, 239, 226, 0.12);
    border-radius: 999px;
    background: rgba(7, 10, 7, 0.54);
    color: #f3efe2;
    font-size: 11px;
    line-height: 1;
}

.tool-hint-chip strong {
    color: inherit;
    font-size: 11px;
}

.tool-hint-chip-cost {
    border-color: rgba(245, 197, 66, 0.34);
    background: rgba(79, 59, 12, 0.44);
    color: #fff2ba;
}

.tool-hint-chip-power {
    border-color: rgba(124, 188, 255, 0.34);
    background: rgba(18, 48, 79, 0.42);
    color: #cde8ff;
}

.tool-hint-chip-upkeep {
    border-color: rgba(194, 149, 92, 0.32);
    background: rgba(67, 43, 22, 0.42);
    color: #ffd8ad;
}

.tool-hint-chip-ready {
    border-color: rgba(136, 214, 144, 0.32);
    background: rgba(22, 63, 28, 0.4);
    color: #c8f4cd;
}

.tool-hint-chip-warning {
    border-color: rgba(255, 176, 163, 0.34);
    background: rgba(68, 24, 20, 0.44);
    color: #ffd2ca;
}

.map-controls {
    left: 12px;
    bottom: 12px;
    grid-template-columns: repeat(4, var(--control-size));
}

.mini-map-frame {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 8;
    width: min(260px, calc(100vw - 24px));
    padding: 8px 50px 8px 8px;
    border: 12px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 12px / 3px round;
    background: rgba(16, 20, 15, 0.9);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

.mini-map-toolbar {
    position: absolute;
    top: 50%;
    right: 8px;
    display: grid;
    grid-template-rows: 34px 34px 34px;
    grid-template-columns: 34px;
    gap: 6px;
    align-items: center;
    transform: translateY(-50%);
}

.mini-map-zoom-button,
.mini-map-zoom-level {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 999px;
    background: rgba(43, 57, 40, 0.96);
    color: #f3efe2;
    font-weight: 900;
    line-height: 32px;
    text-align: center;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}

.mini-map-zoom-button {
    cursor: pointer;
}

.mini-map-zoom-button:hover:not(:disabled) {
    border-color: rgba(245, 197, 66, 0.66);
    background: #d7a62a;
    color: #17170e;
}

.mini-map-zoom-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.mini-map-zoom-level {
    box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.16);
    color: #f5c542;
    font-size: 12px;
    letter-spacing: 0;
}

.mini-map {
    display: block;
    width: 100%;
    aspect-ratio: 5 / 3;
    border-radius: 6px;
    background: rgba(12, 16, 11, 0.92);
    cursor: crosshair;
    image-rendering: auto;
}

.tool-group {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(215, 166, 42, 0.24);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(28, 35, 25, 0.94), rgba(11, 15, 10, 0.96));
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.tool-group-title {
    color: #fff2ba;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.tool-group-buttons {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, var(--control-size));
    grid-auto-columns: var(--control-size);
    gap: 8px;
}

.tool-panel button,
.map-controls button {
    width: var(--control-size);
    height: var(--control-size);
    position: relative;
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 8px;
    background-color: #2b3928;
    background-position: center;
    background-repeat: no-repeat;
    background-size: var(--control-icon-size) var(--control-icon-size);
    color: #f3efe2;
    font-weight: 800;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
}

.tool-panel button.asset-icon,
.map-controls button.asset-icon {
    color: transparent;
    overflow: hidden;
    text-indent: -999px;
}

.tool-panel button.active,
.tool-panel button:hover,
.map-controls button:hover {
    background-color: #d7a62a;
    color: #17170e;
}

.tool-panel button.asset-icon.active,
.tool-panel button.asset-icon:hover,
.map-controls button.asset-icon:hover {
    color: transparent;
}

.tool-panel button:disabled,
.tool-panel button.unavailable {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.42;
}

.tool-panel button.cooldown-active::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0 26%, rgba(0, 0, 0, 0.78) 27% 56%, rgba(0, 0, 0, 0) 57%),
        conic-gradient(from -90deg, var(--cooldown-accent) 0turn calc(var(--cooldown-completion) * 1turn), rgba(6, 8, 7, 0.18) 0turn 1turn);
    box-shadow:
        inset 0 0 0 1px rgba(243, 239, 226, 0.18),
        0 0 18px color-mix(in srgb, var(--cooldown-accent) 38%, transparent);
    opacity: 0.92;
}

.tool-panel button.research-locked::before {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(120, 0, 0, 0.92), rgba(70, 0, 0, 0.92)),
        var(--science-icon) center / 12px 12px no-repeat;
    box-shadow: 0 0 10px rgba(255, 42, 42, 0.48);
    pointer-events: none;
    z-index: 1;
}

.cell-info {
    position: fixed;
    top: 76px;
    right: 12px;
    z-index: 6;
    width: var(--side-panel-width);
    padding: 14px;
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 16px / 4px round;
    background:
        linear-gradient(180deg, rgba(22, 27, 19, 0.97), rgba(9, 12, 9, 0.93)),
        radial-gradient(circle at top right, rgba(245, 197, 66, 0.14), transparent 34%);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(243, 239, 226, 0.08);
    max-height: min(480px, calc(100vh - 240px));
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 197, 66, 0.72) rgba(8, 12, 8, 0.42);
}

.action-panel {
    position: fixed;
    z-index: 5;
    width: var(--side-panel-width);
    padding: 14px;
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 16px / 4px round;
    background:
        linear-gradient(180deg, rgba(21, 26, 18, 0.98), rgba(9, 12, 9, 0.94)),
        radial-gradient(circle at top right, rgba(245, 197, 66, 0.12), transparent 38%);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(243, 239, 226, 0.08);
    min-height: 260px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 197, 66, 0.72) rgba(8, 12, 8, 0.42);
}

.cell-info::-webkit-scrollbar,
.action-panel::-webkit-scrollbar {
    width: 10px;
}

.cell-info::-webkit-scrollbar-track,
.action-panel::-webkit-scrollbar-track {
    background: rgba(8, 12, 8, 0.42);
    border-radius: 999px;
}

.cell-info::-webkit-scrollbar-thumb,
.action-panel::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(245, 197, 66, 0.9), rgba(161, 112, 20, 0.9));
    background-clip: padding-box;
}

.action-panel.hidden {
    display: none;
}

.cell-info-shell,
.context-action-groups {
    display: grid;
    gap: 10px;
}

.cell-info-header {
    display: grid;
    gap: 8px;
}

.cell-info h2 {
    margin: 0;
    color: #fff7cf;
    font-size: 18px;
    line-height: 1.1;
}

.cell-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cell-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid rgba(243, 239, 226, 0.15);
    border-radius: 999px;
    background: rgba(37, 46, 31, 0.88);
    color: #f3efe2;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.cell-info-badge-icon {
    font-size: 13px;
}

.cell-info-section,
.context-action-group {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(215, 166, 42, 0.26);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(32, 39, 28, 0.88), rgba(11, 16, 10, 0.94));
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.2);
}

.cell-info-section-head strong,
.context-action-group-title {
    color: #fff2ba;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cell-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.cell-info-stat {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
}

.cell-info-stat-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(245, 197, 66, 0.12);
    box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.12);
    font-size: 15px;
}

.cell-info-stat-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.cell-info-stat-label {
    color: #c9d2bf;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cell-info-stat strong {
    overflow: hidden;
    color: #f3efe2;
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-info-notes {
    display: grid;
    gap: 6px;
}

.cell-info-note {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 8px 9px;
    border: 1px solid rgba(243, 239, 226, 0.12);
    border-radius: 8px;
    background: rgba(7, 10, 7, 0.5);
    color: #d7dfcf;
    font-size: 12px;
    line-height: 1.35;
}

.cell-info-note-bonus {
    border-color: rgba(104, 176, 110, 0.26);
    background: rgba(20, 45, 24, 0.38);
}

.cell-info-note-warning {
    border-color: rgba(215, 113, 73, 0.34);
    background: rgba(52, 24, 18, 0.38);
}

.cell-info-empty {
    display: grid;
    gap: 6px;
    color: #c9d2bf;
    text-align: center;
}

.cell-info-empty strong {
    color: #fff2ba;
    font-size: 18px;
}

.action-panel h3 {
    margin: 0 0 4px;
    color: #fff7cf;
    font-size: 16px;
}

.action-panel p {
    margin: 0;
    color: #c9d2bf;
    font-size: 12px;
    line-height: 1.4;
}

.action-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.action-meta-row {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border: 1px solid rgba(243, 239, 226, 0.12);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(22, 28, 19, 0.92), rgba(9, 12, 9, 0.92));
    box-shadow: inset 0 0 0 1px rgba(243, 239, 226, 0.04);
    font-size: 13px;
}

.action-meta-row span:first-child {
    color: #c9d2bf;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.action-meta-row strong {
    color: #fff7cf;
}

.action-meta-row-cost {
    border-color: rgba(245, 197, 66, 0.26);
    background: linear-gradient(180deg, rgba(88, 63, 14, 0.5), rgba(24, 19, 8, 0.9));
}

.action-meta-row-power {
    border-color: rgba(124, 188, 255, 0.24);
    background: linear-gradient(180deg, rgba(18, 49, 83, 0.48), rgba(8, 16, 26, 0.9));
}

.action-meta-row-upkeep {
    border-color: rgba(194, 149, 92, 0.24);
    background: linear-gradient(180deg, rgba(74, 47, 21, 0.48), rgba(17, 11, 8, 0.9));
}

.action-meta-row-ready {
    border-color: rgba(136, 214, 144, 0.24);
    background: linear-gradient(180deg, rgba(24, 68, 32, 0.44), rgba(9, 17, 10, 0.9));
}

.action-meta-row-range,
.action-meta-row-mobility,
.action-meta-row-unit {
    border-color: rgba(243, 239, 226, 0.16);
}

.action-warnings {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.action-warning {
    padding: 9px 11px;
    border: 1px solid rgba(255, 176, 163, 0.28);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(84, 37, 22, 0.46), rgba(41, 18, 12, 0.42));
    color: #ffd2ca;
    font-size: 12px;
    line-height: 1.4;
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.unit-build-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(215, 166, 42, 0.3);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(34, 40, 24, 0.88), rgba(10, 14, 10, 0.92));
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.22);
}

.unit-build-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 28px;
}

.unit-build-header > strong {
    color: #fff2ba;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.unit-build-pager {
    display: inline-grid;
    grid-template-columns: 28px minmax(42px, auto) 28px;
    gap: 4px;
    align-items: center;
}

.unit-build-pager button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(72, 67, 38, 0.98), rgba(25, 28, 18, 0.98));
    color: #f3efe2;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.unit-build-pager button:not(:disabled):hover {
    border-color: rgba(245, 197, 66, 0.75);
    background: #d7a62a;
    color: #17170e;
}

.unit-build-pager button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    filter: grayscale(1);
}

.unit-build-pager span {
    color: #c9d2bf;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.context-actions.context-actions-army {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
}

.context-actions.context-actions-regular {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
}

.context-actions button {
    position: relative;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 6px;
    padding: 7px 28px 7px 9px;
    background:
        linear-gradient(180deg, rgba(58, 72, 42, 0.98), rgba(24, 31, 22, 0.98));
    color: #f3efe2;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 244, 190, 0.12), 0 2px 0 rgba(0, 0, 0, 0.28);
}

.context-action-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    min-width: 0;
    padding: 9px 10px;
}

.context-action-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-action-button strong {
    margin-left: 0;
    color: #f5c542;
    font-size: 12px;
}

.context-action-button small {
    display: none;
}

.context-action-component {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1 1 calc(50% - 6px);
    min-width: 118px;
}

.context-action-component span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    filter: grayscale(1);
}

.context-actions.context-actions-army .unit-build-card {
    display: grid;
    grid-template-rows: 70px auto auto;
    gap: 5px;
    min-height: 128px;
    padding: 7px;
    border-color: rgba(218, 172, 74, 0.38);
    background:
        linear-gradient(180deg, rgba(70, 73, 52, 0.95), rgba(27, 34, 24, 0.98) 58%, rgba(13, 17, 12, 0.98));
    text-align: center;
}

.context-actions.context-actions-research {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.context-actions.context-actions-research .research-card {
    display: grid;
    grid-template-rows: 62px auto auto auto;
    gap: 5px;
    min-height: 152px;
    padding: 8px;
    border-color: rgba(108, 198, 255, 0.34);
    background:
        linear-gradient(180deg, rgba(36, 62, 78, 0.96), rgba(18, 29, 38, 0.98) 58%, rgba(10, 16, 22, 0.98));
    text-align: center;
}

.research-card-frame {
    display: grid;
    place-items: center;
    border: 1px solid rgba(108, 198, 255, 0.32);
    border-radius: 6px;
    background:
        radial-gradient(circle at 50% 34%, rgba(108, 198, 255, 0.18), transparent 46%),
        linear-gradient(180deg, rgba(5, 7, 10, 0.7), rgba(14, 19, 24, 0.94));
}

.research-card-frame img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.research-card-name {
    color: #d9f4ff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
}

.research-card-summary {
    color: rgba(225, 239, 247, 0.86);
    font-size: 10px;
    line-height: 1.25;
}

.research-card-unlocks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    min-height: 22px;
}

.research-unlock-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(243, 239, 226, 0.18);
    border-radius: 5px;
    background: rgba(5, 7, 5, 0.42);
}

.research-unlock-chip img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.research-card-status {
    color: #7bdfff;
    font-size: 11px;
    font-weight: 900;
}

.unit-card-frame {
    display: grid;
    place-items: center;
    min-width: 0;
    border: 1px solid rgba(245, 197, 66, 0.28);
    border-radius: 5px;
    background:
        radial-gradient(circle at 50% 34%, rgba(245, 197, 66, 0.16), transparent 46%),
        linear-gradient(180deg, rgba(5, 7, 5, 0.7), rgba(16, 20, 14, 0.94));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.unit-card-frame img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    image-rendering: auto;
}

.unit-card-name {
    overflow: hidden;
    color: #fff2ba;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unit-card-costs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    min-height: 18px;
}

.unit-cost {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    border: 1px solid rgba(243, 239, 226, 0.16);
    border-radius: 4px;
    background: rgba(5, 7, 5, 0.48);
    color: #f3efe2;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.unit-cost span {
    font-size: 11px;
    line-height: 1;
}

.unit-build-card:not(:disabled):hover .unit-card-frame {
    border-color: rgba(245, 197, 66, 0.72);
    background:
        radial-gradient(circle at 50% 34%, rgba(245, 197, 66, 0.25), transparent 50%),
        linear-gradient(180deg, rgba(8, 10, 6, 0.72), rgba(30, 32, 18, 0.96));
}

.market-console {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid rgba(215, 166, 42, 0.28);
    border-radius: 8px;
    background: rgba(9, 13, 9, 0.48);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.22);
}

.action-shortcut {
    position: absolute;
    top: 4px;
    right: 5px;
    min-width: 18px;
    padding: 1px 5px;
    border: 1px solid rgba(245, 197, 66, 0.55);
    border-radius: 4px;
    background: rgba(10, 12, 9, 0.82);
    color: #fff2a8;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.bank-stock-console {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 11px;
    border: 1px solid rgba(104, 176, 110, 0.34);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(24, 48, 31, 0.94), rgba(8, 17, 11, 0.96));
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.bank-stock-header,
.bank-stock-order-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bank-stock-header strong {
    color: #d8ffd7;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bank-stock-header span,
.bank-stock-order-total span {
    color: #a9c7aa;
    font-size: 11px;
    font-weight: 800;
}

.bank-stock-field {
    display: grid;
    gap: 5px;
    color: #bcd4bd;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bank-stock-field select,
.bank-stock-field input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(216, 255, 215, 0.24);
    border-radius: 7px;
    padding: 9px 10px;
    background: #0b160e;
    color: #f0ffef;
    font-size: 13px;
    font-weight: 800;
}

.bank-stock-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.bank-stock-summary div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(216, 255, 215, 0.12);
    border-radius: 7px;
    background: rgba(4, 11, 6, 0.42);
}

.bank-stock-summary span {
    color: #91ae94;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.bank-stock-summary strong {
    overflow: hidden;
    color: #efffee;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bank-stock-summary .bank-stock-up {
    color: #8fe08f;
}

.bank-stock-summary .bank-stock-down {
    color: #ff9e8c;
}

.bank-stock-order-total {
    padding: 8px 10px;
    border: 1px solid rgba(245, 197, 66, 0.26);
    border-radius: 7px;
    background: rgba(65, 49, 15, 0.32);
}

.bank-stock-order-total strong {
    color: #f5c542;
}

.bank-stock-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.bank-stock-actions button {
    border: 1px solid rgba(143, 224, 143, 0.48);
    border-radius: 7px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(60, 124, 68, 0.98), rgba(25, 70, 31, 0.98));
    color: #f0ffef;
    font-weight: 900;
}

.bank-stock-actions button.sell {
    border-color: rgba(255, 158, 140, 0.48);
    background: linear-gradient(180deg, rgba(128, 67, 55, 0.98), rgba(72, 31, 25, 0.98));
}

.bank-stock-actions button:not(:disabled):hover {
    border-color: rgba(245, 197, 66, 0.8);
    transform: translateY(-1px);
}

.bank-stock-actions button:disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.45;
}

.market-trades {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.market-trade,
.market-quantities button {
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 6px;
    background:
        linear-gradient(180deg, rgba(43, 52, 31, 0.98), rgba(16, 21, 15, 0.98));
    color: #f3efe2;
    box-shadow: inset 0 1px 0 rgba(255, 244, 190, 0.12), 0 2px 0 rgba(0, 0, 0, 0.3);
}

.market-trade {
    display: grid;
    gap: 2px;
    min-height: 44px;
    padding: 6px 7px;
    text-align: left;
}

.market-trade span,
.market-quantities button span {
    font-weight: 800;
}

.market-trade strong,
.market-quantities button strong {
    color: #c9d2bf;
    font-size: 11px;
    font-weight: 700;
}

.market-rate {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.market-trend {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.market-trend-up {
    color: #ffb56b;
}

.market-trend-down {
    color: #8fe08f;
}

.market-trade.active {
    border-color: rgba(245, 197, 66, 0.85);
    background:
        linear-gradient(180deg, rgba(102, 79, 27, 0.98), rgba(51, 35, 16, 0.98));
    color: #fff7cf;
}

.market-quantities {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 6px;
}

.market-quantities button {
    display: grid;
    gap: 2px;
    min-height: 42px;
    padding: 6px 4px;
    text-align: center;
}

.market-quantities[data-market-kind="sell"] button {
    background:
        linear-gradient(180deg, rgba(63, 50, 35, 0.98), rgba(31, 22, 16, 0.98));
}

.market-quantities button:not(:disabled):hover,
.market-trade:not(:disabled):hover,
.context-actions button:not(:disabled):hover {
    border-color: rgba(245, 197, 66, 0.75);
    transform: translateY(-1px);
}

.market-quantities button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    filter: grayscale(1);
}

.action-select,
.action-textarea {
    width: 100%;
    margin-top: 10px;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 10px;
    background: #10140f;
    color: #f3efe2;
}

.action-textarea {
    min-height: 84px;
    resize: vertical;
}

.bounty-controls {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.action-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #c9d2bf;
}

.action-field input {
    width: 100%;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 9px 10px;
    background: #10140f;
    color: #f3efe2;
}

.action-field input[type="range"] {
    padding: 0;
    accent-color: #d7a62a;
}

.action-field strong {
    color: #f3efe2;
}

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.quick-amounts button {
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 7px 6px;
    background: rgba(45, 28, 25, 0.95);
    color: #f3efe2;
    font-weight: 800;
}

.action-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.action-actions button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #d7a62a;
    color: #17170e;
    font-weight: 800;
}

.action-actions button:disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.5;
}

.action-feedback,
.action-disabled,
.action-status {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.action-feedback {
    border: 1px solid rgba(245, 197, 66, 0.24);
    background: rgba(69, 52, 15, 0.36);
    color: #f5c542;
}

.action-feedback-success {
    border-color: rgba(120, 226, 145, 0.3);
    background: rgba(22, 66, 33, 0.42);
    color: #9ef0b0;
}

.action-feedback-error {
    border-color: rgba(255, 176, 163, 0.3);
    background: rgba(68, 24, 20, 0.38);
    color: #ffb0a3;
}

.action-disabled {
    border: 1px solid rgba(255, 176, 163, 0.24);
    background: rgba(68, 24, 20, 0.34);
    color: #ffb0a3;
}

.action-status {
    border: 1px solid rgba(245, 197, 66, 0.24);
    background: rgba(69, 52, 15, 0.36);
    color: #f5c542;
}

.world-panel {
    position: fixed;
    top: 76px;
    left: 12px;
    z-index: 6;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100vh - 164px);
    overflow: auto;
    padding: 12px;
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 16px / 4px round;
    background: rgba(16, 20, 15, 0.9);
    background-clip: padding-box;
    backdrop-filter: blur(10px);
}

.world-panel h2 {
    margin: 0 0 8px;
    font-size: 15px;
}

.world-panel ol {
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

.alliance-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.join-panel.army-dialog-panel {
    box-sizing: border-box;
    width: min(1792px, calc(100vw - 16px));
    max-height: calc(100vh - 48px);
    overflow-x: hidden;
    overflow-y: auto;
}

.army-panel {
    display: grid;
    gap: 10px;
}

.army-panel-summary,
.army-roster-empty,
.army-roster-row {
    border: 1px solid rgba(243, 239, 226, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.army-panel-summary,
.army-roster-empty {
    padding: 10px 12px;
}

.army-panel-summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    color: #d6e1cb;
    font-size: 13px;
}

.army-panel-summary strong {
    color: #f5c542;
}

.army-roster {
    display: grid;
    gap: 6px;
}

.army-roster-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) 124px minmax(160px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 7px 10px;
}

.bounty-roster-row {
    grid-template-columns: minmax(0, 1.2fr) 124px minmax(220px, 1fr) auto;
}

.army-roster-main,
.army-roster-location {
    display: grid;
    gap: 1px;
    min-width: 0;
    line-height: 1.12;
}

.army-roster-main strong,
.army-roster-location strong {
    color: #f3efe2;
    font-size: 13px;
}

.army-roster-main span,
.army-roster-location span,
.army-roster-status small {
    color: #aebaa4;
    font-size: 11px;
}

.army-roster-status {
    display: grid;
    gap: 2px;
    justify-items: start;
}

.army-roster-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(243, 239, 226, 0.16);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.army-roster-badge.combat {
    border-color: rgba(255, 124, 114, 0.42);
    background: rgba(118, 26, 23, 0.78);
    color: #ffd3d0;
}

.army-roster-badge.ready {
    border-color: rgba(103, 236, 131, 0.32);
    background: rgba(36, 92, 47, 0.58);
    color: #d8ffe1;
}

.army-roster-view {
    min-width: 78px;
    min-height: 32px;
    padding: 0 12px;
}

.army-roster-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.army-roster-sell {
    min-width: 74px;
    min-height: 32px;
    padding: 0 12px;
}

.army-roster-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.army-roster-pagination span {
    color: #c9d2bf;
    font-size: 12px;
    font-weight: 700;
}

.army-roster-pagination-actions {
    display: flex;
    gap: 8px;
}

.alliance-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(245, 197, 66, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(77, 54, 24, 0.82), rgba(24, 34, 22, 0.92)),
        rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 32px rgba(0, 0, 0, 0.24);
}

.alliance-banner > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.alliance-banner strong {
    overflow: hidden;
    color: #f5c542;
    font-size: 24px;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alliance-banner small,
.alliance-member-name span,
.alliance-invite span,
.alliance-toggle small {
    color: #aebaa4;
    font-size: 12px;
}

.alliance-kicker,
.alliance-section-heading {
    color: #d6e1cb;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.alliance-toast {
    flex: 0 0 auto;
    max-width: 220px;
    overflow: hidden;
    padding: 6px 10px;
    border: 1px solid rgba(245, 197, 66, 0.36);
    border-radius: 999px;
    background: rgba(245, 197, 66, 0.12);
    color: #ffe28a;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alliance-toast-success {
    border-color: rgba(120, 226, 145, 0.34);
    background: rgba(22, 66, 33, 0.38);
    color: #9ef0b0;
}

.alliance-toast-error {
    border-color: rgba(255, 176, 163, 0.34);
    background: rgba(68, 24, 20, 0.42);
    color: #ffb0a3;
}

.alliance-empty {
    padding: 18px;
    border: 1px solid rgba(243, 239, 226, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #c9d2bf;
    text-align: center;
}

.alliance-section {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(243, 239, 226, 0.13);
    border-radius: 8px;
    background: rgba(7, 11, 7, 0.42);
}

.alliance-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alliance-section-heading strong {
    color: #f5c542;
    font-size: 11px;
}

.alliance-members,
.alliance-invites {
    display: grid;
    gap: 8px;
}

.alliance-member,
.alliance-invite {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 10px;
    border: 1px solid rgba(243, 239, 226, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.alliance-member-main,
.alliance-invite > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.alliance-invite > div {
    display: grid;
    gap: 2px;
}

.alliance-member-name {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.alliance-member-name strong,
.alliance-invite strong {
    overflow: hidden;
    color: #f3efe2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alliance-presence {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(243, 239, 226, 0.26);
    border-radius: 50%;
    background: #5a2622;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.alliance-presence.online {
    border-color: rgba(103, 236, 131, 0.72);
    background: #67ec83;
    box-shadow: 0 0 12px rgba(103, 236, 131, 0.48);
}

.alliance-create-grid,
.alliance-command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) 96px auto;
    gap: 10px;
    align-items: end;
}

.alliance-command-grid {
    grid-template-columns: minmax(0, 1.8fr) 96px auto;
}

.alliance-invite-field {
    grid-column: span 2;
}

.alliance-command-spacer {
    display: none;
}

.alliance-command-danger {
    min-width: 170px;
}

.alliance-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.alliance-field {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #c9d2bf;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.alliance-panel input,
.alliance-panel select {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(243, 239, 226, 0.2);
    border-radius: 8px;
    padding: 10px 11px;
    background: rgba(9, 13, 8, 0.92);
    color: #f3efe2;
    outline: none;
}

.alliance-panel input:focus,
.alliance-panel select:focus {
    border-color: rgba(245, 197, 66, 0.66);
    box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.14);
}

.alliance-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(243, 239, 226, 0.18);
    border-radius: 8px;
    padding: 9px 13px;
    background: #2b3928;
    color: #f3efe2;
    font-weight: 900;
    cursor: pointer;
}

.alliance-button:hover {
    border-color: rgba(245, 197, 66, 0.52);
    background: #3b4c35;
}

.alliance-button-primary {
    border-color: rgba(245, 197, 66, 0.5);
    background: #d7a62a;
    color: #17170e;
}

.alliance-button-danger {
    border-color: rgba(255, 124, 114, 0.34);
    background: #5a2622;
    color: #ffe0dc;
}

.alliance-button-danger:hover {
    background: #71302a;
}

.alliance-button-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.alliance-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 72px;
    padding: 12px;
    border: 1px solid rgba(243, 239, 226, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
}

.alliance-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.alliance-toggle-control {
    position: relative;
    width: 50px;
    height: 28px;
    border: 1px solid rgba(243, 239, 226, 0.18);
    border-radius: 999px;
    background: #3a2a25;
    transition: background 120ms ease, border-color 120ms ease;
}

.alliance-toggle-control::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #d6e1cb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
    transition: transform 120ms ease;
}

.alliance-toggle-control::before {
    content: "Off";
    position: absolute;
    top: 50%;
    right: 8px;
    color: #c9d2bf;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    transform: translateY(-50%);
}

.alliance-toggle input:checked + .alliance-toggle-control {
    border-color: rgba(103, 236, 131, 0.52);
    background: #2d6635;
}

.alliance-toggle input:checked + .alliance-toggle-control::after {
    transform: translateX(22px);
}

.alliance-toggle input:checked + .alliance-toggle-control::before {
    content: "On";
    right: auto;
    left: 8px;
    color: #dfffe5;
}

.alliance-toggle strong {
    display: block;
    color: #f3efe2;
    font-size: 14px;
}

.alliance-toggle:has(input:focus-visible) {
    border-color: rgba(245, 197, 66, 0.54);
    box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.12);
}

.alliance-dialog-panel {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
}

@media (max-width: 720px) {
    .alliance-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .alliance-toast {
        max-width: none;
        text-align: center;
    }

    .alliance-settings-grid,
    .alliance-create-grid,
    .alliance-command-grid {
        grid-template-columns: 1fr;
    }

    .alliance-invite-field {
        grid-column: auto;
    }

    .alliance-member,
    .alliance-invite {
        align-items: stretch;
        flex-direction: column;
    }
}

.leaderboard-item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: start;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.leaderboard-rank {
    min-width: 1.7em;
    color: #8f9a89;
    font-size: 12px;
    line-height: 1.35;
}

.leaderboard-presence {
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #ff7c72;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.leaderboard-presence.online {
    background: #67ec83;
}

.leaderboard-entry {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.leaderboard-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
}

.leaderboard-tag {
    color: #76ecff;
    font-weight: 900;
}

.leaderboard-meta {
    color: #c9d2bf;
    font-size: 12px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item {
    margin-bottom: 8px;
    color: #c9d2bf;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.chat-log {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    max-height: 220px;
    overflow: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #d7a62a rgba(16, 20, 15, 0.9);
}

.chat-log::-webkit-scrollbar {
    width: 12px;
}

.chat-log::-webkit-scrollbar-track {
    border: 1px solid rgba(215, 166, 42, 0.28);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(27, 36, 26, 0.96), rgba(10, 14, 11, 0.96));
    box-shadow:
        inset 0 0 0 1px rgba(255, 245, 204, 0.05),
        inset 0 0 10px rgba(0, 0, 0, 0.35);
}

.chat-log::-webkit-scrollbar-thumb {
    border: 2px solid rgba(20, 16, 7, 0.85);
    border-radius: 999px;
    background:
        linear-gradient(180deg, #f1cc68, #d7a62a 45%, #8e6a18);
    box-shadow:
        inset 0 1px 0 rgba(255, 246, 205, 0.5),
        0 0 8px rgba(215, 166, 42, 0.2);
}

.chat-log::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(180deg, #f6d97f, #e0b640 45%, #9c7418);
}

.chat-item {
    font-size: 13px;
    color: #f3efe2;
    overflow-wrap: anywhere;
}

.chat-item strong {
    color: #c9d2bf;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 10px;
}

.chat-form input {
    min-width: 0;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 10px;
    background: #10140f;
    color: #f3efe2;
}

.chat-form button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #d7a62a;
    color: #17170e;
    font-weight: 800;
}

.chat-status {
    min-height: 18px;
    margin-bottom: 12px;
    color: #c9d2bf;
    font-size: 12px;
}

.admin-shell {
    min-height: 100vh;
    padding: 20px;
    background: #10140f;
}

.admin-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.admin-header h1,
.admin-card h2 {
    margin: 0;
}

.admin-header button,
.admin-form button,
.admin-row button {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #d7a62a;
    color: #17170e;
    font-weight: 800;
}

.admin-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
}

.admin-sidebar,
.admin-card,
.admin-auth-panel {
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 16px / 4px round;
    background: rgba(255, 255, 255, 0.06);
    background-clip: padding-box;
}

.admin-sidebar {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 12px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.admin-tab {
    width: 100%;
    border: 1px solid rgba(243, 239, 226, 0.16);
    border-radius: 10px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.22);
    color: #f3efe2;
    font-weight: 700;
    text-align: left;
}

.admin-tab.is-active {
    background: #d7a62a;
    color: #17170e;
}

.admin-main {
    display: grid;
    gap: 18px;
}

.admin-panel {
    display: none;
    gap: 18px;
}

.admin-panel.is-active {
    display: grid;
}

.admin-card {
    padding: 16px;
}

.admin-card-wide {
    width: 100%;
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.admin-auth-panel {
    max-width: 420px;
    margin-bottom: 18px;
    padding: 18px;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.admin-stat-card {
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
}

.admin-stat-label,
.admin-setting-description,
.admin-setting-default {
    color: #c9d2bf;
    font-size: 12px;
}

.admin-stat-value {
    font-size: 20px;
}

.admin-grid section {
    border: 16px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 16px / 4px round;
    background: rgba(255, 255, 255, 0.06);
    background-clip: padding-box;
}

.admin-auth-copy {
    color: #c9d2bf;
}

.admin-section-copy {
    margin: 6px 0 0;
    color: #c9d2bf;
    font-size: 13px;
}

.admin-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.admin-form input,
.admin-form select,
.admin-inline-form input {
    min-width: 0;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 10px;
    background: #10140f;
    color: #f3efe2;
}

.admin-form-field {
    display: grid;
}

.admin-inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.admin-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.admin-row {
    display: grid;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.admin-row-split {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
    align-items: start;
}

.admin-row-content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.admin-row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: start;
}

.admin-alert-row {
    margin-top: 10px;
    border: 1px solid rgba(215, 166, 42, 0.25);
}

.admin-row code {
    overflow-wrap: anywhere;
    color: #c9d2bf;
}

.admin-phase-row {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    align-items: center;
}

.admin-player-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.admin-access-code {
    white-space: normal;
    overflow-wrap: anywhere;
}

.admin-button-compact {
    padding: 6px 10px !important;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.admin-button-danger {
    background: #7a2f2f !important;
    color: #fff1ec !important;
}

.admin-button-danger:hover:not(:disabled) {
    background: #934040 !important;
}

.admin-settings-form {
    display: grid;
    gap: 16px;
    margin-top: 12px;
}

.admin-settings-categories,
.admin-settings-groups {
    display: grid;
    gap: 16px;
}

.admin-settings-category,
.admin-settings-group {
    display: grid;
    gap: 12px;
}

.admin-settings-category {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-settings-category-title,
.admin-settings-group-title {
    margin: 0;
}

.admin-settings-category-title {
    font-size: 18px;
}

.admin-settings-group {
    padding-top: 4px;
}

.admin-settings-group-title {
    font-size: 14px;
    color: #cfd7c6;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.admin-setting-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
}

.admin-setting-title {
    font-weight: 700;
}

.admin-inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

#adminSettings button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

#adminStatus {
    white-space: pre-wrap;
    margin-top: 16px;
    color: #c9d2bf;
}

@media (max-width: 960px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

.cell-info h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

.cell-info dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    margin: 0;
}

.cell-info dt {
    color: #c9d2bf;
}

.cell-info dd {
    margin: 0;
    text-align: right;
}

.muted {
    color: #c9d2bf;
}

.join-dialog {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: auto auto;
    place-items: center;
    align-content: center;
    gap: 14px;
    padding: 24px;
    background: linear-gradient(rgba(5, 8, 4, 0.58), rgba(5, 8, 4, 0.72));
}

.join-dialog.hidden {
    display: none;
}

.main-menu-logo {
    display: block;
    width: min(520px, 86vw);
    max-height: min(220px, 28vh);
    object-fit: contain;
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}

.join-panel {
    width: min(420px, 100%);
    padding: 24px;
    border: 24px solid transparent;
    border-radius: 8px;
    border-image: var(--frame-image) var(--frame-slice) / 24px / 6px round;
    background: rgba(20, 25, 18, 0.94);
    background-clip: padding-box;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.main-menu {
    display: grid;
    gap: 14px;
}

.menu-section {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(243, 239, 226, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.menu-section-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f5c542;
}

.join-panel h1 {
    margin: 0;
    font-size: 32px;
    color: #f5c542;
}

.join-panel p {
    margin: -8px 0 4px;
    color: #c9d2bf;
}

.casino-dialog {
    z-index: 42;
}

.casino-panel {
    width: min(560px, 96vw);
    display: grid;
    gap: 14px;
    color: #f6f1df;
}

.casino-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.casino-header h2 {
    margin: 0;
    color: #ffd45c;
    font-size: 30px;
    line-height: 1;
}

.casino-header span,
.casino-rule-line,
.casino-status {
    color: #d8d2bf;
    font-size: 13px;
}

.casino-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 212, 92, 0.45);
    border-radius: 6px;
    background: rgba(42, 31, 24, 0.9);
    color: #ffd45c;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.casino-tabs,
.casino-quick-bets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.casino-tabs button,
.casino-quick-bets button,
.casino-spin {
    min-height: 36px;
    border: 1px solid rgba(255, 212, 92, 0.35);
    border-radius: 6px;
    background: rgba(35, 41, 31, 0.92);
    color: #f6f1df;
    font-weight: 800;
}

.casino-tabs button {
    flex: 1 1 140px;
}

.casino-tabs button.active,
.casino-spin {
    background: linear-gradient(180deg, #a93f35, #5f201c);
    border-color: rgba(255, 212, 92, 0.85);
    color: #ffe8a0;
}

.casino-spin:disabled {
    opacity: 0.52;
}

.casino-stage {
    display: grid;
    gap: 12px;
    min-height: 250px;
    place-items: center;
    padding: 18px;
    border: 1px solid rgba(255, 212, 92, 0.22);
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 212, 92, 0.16), transparent 38%),
        linear-gradient(180deg, rgba(41, 22, 30, 0.86), rgba(16, 19, 17, 0.92));
}

.casino-stage-wheel {
    min-height: 430px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 34%, rgba(255, 230, 146, 0.22), transparent 31%),
        radial-gradient(circle at 50% 50%, rgba(169, 63, 53, 0.26), transparent 54%),
        linear-gradient(145deg, rgba(51, 19, 28, 0.94), rgba(12, 18, 17, 0.96));
}

.slot-machine {
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 10px;
    width: min(340px, 100%);
}

.slot-reel {
    aspect-ratio: 0.74;
    display: grid;
    place-items: center;
    position: relative;
    border: 3px solid #d3a336;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 28%),
        #f3ead8;
    box-shadow: inset 0 -14px 24px rgba(77, 38, 25, 0.18), 0 10px 22px rgba(0, 0, 0, 0.26);
    color: #7b1e22;
    overflow: hidden;
}

.slot-symbol {
    width: min(82px, 84%);
    height: min(82px, 84%);
    object-fit: contain;
    filter: drop-shadow(0 5px 5px rgba(42, 18, 10, 0.28));
}

.slot-strip {
    position: absolute;
    inset: 0;
    display: grid;
    grid-auto-rows: 100%;
    justify-items: center;
    align-items: center;
    will-change: transform;
}

.slot-strip .slot-symbol {
    width: min(82px, 84%);
    height: min(82px, 84%);
}

.slot-machine.spinning .slot-strip {
    animation: casino-reel-spin 0.72s linear infinite;
}

.slot-machine.spinning .slot-reel-2 .slot-strip {
    animation-duration: 0.58s;
}

.slot-machine.spinning .slot-reel-3 .slot-strip {
    animation-duration: 0.66s;
}

.casino-wheel-wrap {
    position: relative;
    width: min(350px, 82vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    perspective: 900px;
}

.casino-wheel-shadow {
    position: absolute;
    inset: 9%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.66) 72%);
    filter: blur(12px);
    transform: translateY(20px) scaleX(0.94);
}

.casino-wheel {
    --wheel-rotation: 0deg;
    --wheel-radius: clamp(104px, 31vw, 138px);
    position: absolute;
    inset: 3%;
    border-radius: 50%;
    border: clamp(10px, 3vw, 16px) solid #e5b94e;
    background: conic-gradient(
        #171b18 0deg 30deg,
        #d84735 30deg 60deg,
        #f5c84f 60deg 90deg,
        #2d8d82 90deg 120deg,
        #7449bd 120deg 150deg,
        #246abe 150deg 180deg,
        #171b18 180deg 210deg,
        #c84c91 210deg 240deg,
        #88a84a 240deg 270deg,
        #a86236 270deg 300deg,
        #81919c 300deg 330deg,
        #24a89a 330deg 360deg
    );
    box-shadow:
        inset 0 0 0 3px rgba(255, 255, 255, 0.18),
        inset 0 0 0 19px rgba(31, 16, 9, 0.22),
        inset 0 0 38px rgba(0, 0, 0, 0.36),
        0 20px 36px rgba(0, 0, 0, 0.45),
        0 0 34px rgba(245, 197, 66, 0.2);
    transform: rotate(var(--wheel-rotation, 0deg));
    will-change: transform;
}

.casino-wheel::before,
.casino-wheel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.casino-wheel::before {
    inset: -14px;
    background:
        repeating-conic-gradient(from 7deg, #fff0a8 0deg 3deg, #8b3a1c 3deg 15deg, #fff0a8 15deg 18deg, #7b281d 18deg 30deg);
    box-shadow: inset 0 0 0 8px rgba(55, 24, 15, 0.78);
    z-index: -1;
}

.casino-wheel::after {
    inset: 13%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 28%, rgba(0, 0, 0, 0.18) 72%, rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(255, 244, 198, 0.2);
}

.casino-wheel.spinning {
    filter: saturate(1.12) drop-shadow(0 0 18px rgba(255, 212, 92, 0.34));
}

.casino-wheel-segment {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: clamp(58px, 17vw, 78px);
    min-height: 38px;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 5px 6px;
    border-radius: 10px;
    background: rgba(20, 17, 13, 0.42);
    color: #fff8d5;
    text-align: center;
    line-height: 1;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.75);
    transform: translate(-50%, -50%) rotate(var(--segment-angle)) translateY(calc(var(--wheel-radius) * -1)) rotate(var(--segment-counter-angle));
}

.casino-wheel-segment b {
    font-size: clamp(13px, 3.8vw, 18px);
    font-weight: 950;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.casino-wheel-segment small {
    color: rgba(255, 248, 213, 0.86);
    font-size: clamp(8px, 2.3vw, 10px);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.casino-wheel-segment-bankrupt {
    color: #ffcec7;
    background: rgba(22, 24, 22, 0.72);
}

.casino-wheel-segment-jackpot {
    color: #fff8bc;
    background: rgba(115, 43, 20, 0.56);
    filter: drop-shadow(0 0 8px rgba(255, 212, 92, 0.36));
}

.casino-wheel-segment-multiplier {
    color: #e7dcff;
}

.casino-wheel-segment-resource {
    color: #ddfff7;
}

.casino-wheel-hub {
    position: absolute;
    inset: 34%;
    z-index: 2;
    display: grid;
    place-items: center;
    align-content: center;
    border: 6px solid rgba(255, 229, 137, 0.9);
    border-radius: 50%;
    background:
        radial-gradient(circle at 45% 35%, rgba(255, 255, 255, 0.35), transparent 24%),
        linear-gradient(180deg, #853129, #381915);
    color: #ffe9a4;
    box-shadow:
        inset 0 -10px 18px rgba(0, 0, 0, 0.32),
        0 0 0 5px rgba(92, 38, 24, 0.58),
        0 9px 18px rgba(0, 0, 0, 0.36);
    text-align: center;
}

.casino-wheel-hub strong {
    font-size: clamp(18px, 5vw, 30px);
    font-weight: 950;
    letter-spacing: -0.06em;
    line-height: 0.9;
}

.casino-wheel-hub span {
    font-size: clamp(8px, 2vw, 11px);
    font-weight: 950;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.casino-wheel-pointer {
    position: absolute;
    top: -1px;
    left: 50%;
    z-index: 3;
    width: 54px;
    height: 76px;
    display: grid;
    place-items: start center;
    transform: translateX(-50%);
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5));
}

.casino-wheel-pointer::before {
    content: "";
    width: 42px;
    height: 28px;
    border: 3px solid rgba(255, 240, 177, 0.9);
    border-radius: 999px 999px 12px 12px;
    background: linear-gradient(180deg, #fff2b3, #d59628);
}

.casino-wheel-pointer span {
    width: 0;
    height: 0;
    margin-top: -5px;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 36px solid #fff0a8;
}

.casino-wheel.spinning + .casino-wheel-pointer,
.casino-wheel-wrap:has(.casino-wheel.spinning) .casino-wheel-pointer {
    animation: casino-pointer-tick 0.12s ease-in-out infinite alternate;
}

.casino-result {
    width: 100%;
    display: grid;
    gap: 3px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
}

.casino-result strong {
    color: #ffd45c;
}

.casino-result-win strong {
    color: #8dffb0;
}

.casino-result-loss strong {
    color: #ff9b8e;
}

.casino-bet-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.casino-bet-row label {
    color: #ffd45c;
    font-weight: 900;
}

.casino-bet-row input {
    min-width: 0;
    height: 38px;
    border: 1px solid rgba(255, 212, 92, 0.35);
    border-radius: 6px;
    background: rgba(4, 7, 5, 0.62);
    color: #f6f1df;
    font-weight: 900;
    padding: 0 10px;
}

.casino-status-error {
    color: #ff9b8e;
}

.casino-status-success {
    color: #8dffb0;
}

@keyframes casino-reel-spin {
    from { transform: translateY(0); }
    to { transform: translateY(-600%); }
}

@keyframes casino-pointer-tick {
    from { transform: translateX(-50%) rotate(-2deg); }
    to { transform: translateX(-50%) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
    .casino-wheel-wrap:has(.casino-wheel.spinning) .casino-wheel-pointer {
        animation: none;
    }
}

.menu-primary,
.menu-danger,
.menu-actions a,
.menu-actions button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 8px;
    background: #2b3928;
    color: #f3efe2;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.menu-primary:disabled,
.menu-danger:disabled,
.menu-actions button:disabled,
.chat-form button:disabled,
.forfeit-actions button:disabled,
.join-panel button:disabled,
.menu-primary.is-pending,
.menu-danger.is-pending,
.menu-actions button.is-pending,
.chat-form button.is-pending,
.forfeit-actions button.is-pending,
.join-panel button.is-pending {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.45;
}

.menu-danger {
    background: #5a2622;
}

.how-to-play-panel {
    width: min(960px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.how-to-play-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.how-to-play-header p {
    margin: 6px 0 0;
}

.how-to-play-grid {
    display: grid;
    gap: 14px;
}

.forfeit-panel {
    display: grid;
    gap: 14px;
}

.forfeit-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.forfeit-actions button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 8px;
    background: #2b3928;
    color: #f3efe2;
    font-weight: 800;
    cursor: pointer;
}

.menu-actions {
    display: grid;
    gap: 8px;
}

.menu-setting {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    color: #c9d2bf;
    font-weight: 700;
}

.menu-setting input {
    width: 100%;
    accent-color: #d7a62a;
}

.access-code-panel {
    gap: 8px;
}

.player-access-code {
    display: block;
    padding: 10px;
    border: 1px solid rgba(243, 239, 226, 0.18);
    border-radius: 8px;
    background: #10140f;
    color: #f3efe2;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    user-select: all;
}

.music-theme-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.music-theme-button {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(243, 239, 226, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #f3efe2;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.music-theme-button:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: rgba(245, 197, 66, 0.65);
    background: rgba(245, 197, 66, 0.14);
}

.music-theme-button.active {
    border-color: rgba(245, 197, 66, 0.8);
    background: linear-gradient(180deg, rgba(245, 197, 66, 0.24), rgba(245, 197, 66, 0.12));
    box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.18);
}

.asset-progress {
    display: grid;
    gap: 8px;
}

.asset-progress-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #c9d2bf;
    font-size: 13px;
    font-weight: 700;
}

.asset-progress-track {
    height: 10px;
    overflow: hidden;
    border: 1px solid rgba(243, 239, 226, 0.22);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.32);
}

.asset-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: #d7a62a;
    transition: width 160ms ease;
}

.hidden {
    display: none !important;
}

#joinForm,
#accessCodeForm {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

#joinForm input,
#accessCodeForm input {
    min-width: 0;
    border: 1px solid rgba(243, 239, 226, 0.24);
    border-radius: 8px;
    padding: 12px;
    background: #10140f;
    color: #f3efe2;
}

#joinForm button,
#accessCodeForm button {
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    background: #d7a62a;
    color: #17170e;
    font-weight: 800;
}

#joinError {
    min-height: 20px;
    margin-top: 10px;
    color: #ffb0a3;
}

@media (max-width: 760px) {
    .top-bar {
        grid-auto-flow: row;
        grid-template-columns: 1fr 1fr;
        grid-auto-columns: auto;
        font-size: 13px;
    }

    .brand {
        grid-column: span 2;
    }

    .join-panel.army-dialog-panel {
        width: min(900px, calc(100vw - 24px));
    }

    .army-roster-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .army-roster-pagination,
    .army-panel-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .cell-info {
        top: auto;
        right: 12px;
        bottom: 76px;
        left: 12px;
        width: auto;
        max-height: 28vh;
    }

    .action-panel {
        top: auto !important;
        right: 12px !important;
        bottom: calc(88px + 28vh);
        left: 12px !important;
        width: auto;
        max-height: 36vh;
        min-height: 0;
    }

    .tool-panel {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        transform: none;
    }

    .tool-group {
        padding: 6px;
    }

    .tool-group-buttons {
        grid-template-rows: repeat(2, minmax(28px, var(--control-size)));
        grid-auto-columns: minmax(28px, var(--control-size));
        gap: 6px;
    }

    .mini-map-frame {
        right: 12px;
        bottom: calc(24px + var(--tool-panel-reserve));
        width: min(180px, calc(100vw - 24px));
    }

    .tool-hint {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: calc(12px + var(--tool-panel-reserve));
        left: 12px;
        width: auto;
        max-width: none;
        transform: translateY(4px);
    }

    .tool-hint.visible {
        transform: translateY(0);
    }

    .tool-panel button,
    .map-controls button {
        width: 100%;
    }

    .map-controls {
        bottom: 76px;
    }

    .cell-info-grid,
    .action-meta,
    .context-actions.context-actions-regular {
        grid-template-columns: 1fr;
    }
}
