* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.tabs {
    display: flex;
    gap: 2px;
    background: #16213e;
    padding: 8px 8px 0;
}

.tab-btn {
    padding: 12px 24px;
    background: #0f3460;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #e94560;
    color: #fff;
}

.tab-btn:hover:not(.active) {
    background: #1a1a4e;
}

.tab-content {
    display: none;
    padding: 0;
}

.tab-content.active {
    display: block;
}

#game-tab {
    width: 100vw;
    height: 100vh;
    padding-top: 50px;
}

.tabs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    display: flex;
    gap: 2px;
    background: #16213e;
    padding: 8px 8px 0;
}

#editor-tab {
    position: relative;
    padding: 20px;
}

.game-container {
    display: none;
}

.panorama-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.panorama-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    background: #0a0a15;
}

#panorama-view {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#panorama-view:active {
    cursor: grabbing;
}

#panorama-view canvas {
    display: block;
}

#map-canvas {
    display: none;
}

.map-preview {
    position: fixed;
    right: 50%;
    bottom: 20px;
    transform: translateX(50%);
    width: auto;
    height: auto;
    display: block;
    overflow: visible;
    z-index: 1000;
    transition: width 0.18s ease, height 0.18s ease, bottom 0.18s ease, transform 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

#game-tab.is-start-screen .map-preview {
    opacity: 0;
    pointer-events: none;
}

#game-tab.is-start-screen .game-info {
    opacity: 0 !important;
    pointer-events: none;
}

#game-tab.is-start-screen .game-info * {
    pointer-events: none;
}

.map-preview:not(.is-tab-open) > .map-toolbar,
.map-preview:not(.is-tab-open) > .map-container,
.map-preview:not(.is-tab-open) > .map-footer {
    display: none !important;
}

.map-hint {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    height: 46px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(36, 28, 84, 0.92), rgba(15, 12, 40, 0.94));
    border: 1px solid rgba(174, 149, 255, 0.54);
    color: #e2d3ff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    white-space: nowrap;
}

.map-hint:hover {
    background: linear-gradient(135deg, rgba(56, 44, 124, 0.95), rgba(25, 20, 60, 0.96));
    border-color: rgba(226, 211, 255, 0.78);
    transform: translateY(-1px);
}

.map-hint-key {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(226, 211, 255, 0.38);
    color: #fff;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.map-hint-coords {
    color: #c8bbff;
    font-variant-numeric: tabular-nums;
}

.map-hint-coords:empty {
    display: none;
}

.map-preview.is-tab-open {
    right: 50%;
    bottom: 50%;
    transform: translate(50%, 50%);
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: block;
    overflow: visible;
    z-index: 1101;
    animation: mg-tab-open 0.15s ease;
}

.map-preview.is-tab-open .map-container {
    display: block;
    position: absolute;
    top: var(--mg-border, 60px);
    left: var(--mg-border, 60px);
    right: var(--mg-border, 60px);
    bottom: var(--mg-border, 60px);
    width: auto;
    height: auto;
    border-radius: 0;
    background: #fbc193;
}

.map-border {
    display: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1103;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.map-preview.is-tab-open .map-border {
    display: block;
}

.map-border .mg-tile {
    position: absolute;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    user-select: none;
    -webkit-user-drag: none;
}

.map-preview.is-tab-open .map-toolbar,
.map-preview.is-tab-open #guess-coords {
    display: none;
}

.map-preview.is-tab-open .map-footer {
    display: block;
    position: absolute;
    left: 50%;
    bottom: calc(var(--mg-border, 60px) + 16px);
    transform: translateX(-50%);
    padding: 0;
    background: transparent;
    z-index: 1104;
    pointer-events: none;
}

.map-preview.is-tab-open .map-submit-btn {
    pointer-events: auto;
    min-width: 180px;
    height: 52px;
    padding: 0 32px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f8eedf;
    background: #6a4530;
    border: 3px solid #2c1a0e;
    border-radius: 0;
    box-shadow:
        inset 0 -4px 0 rgba(0, 0, 0, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.18),
        0 5px 0 #2c1a0e,
        0 8px 16px rgba(0, 0, 0, 0.55);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.map-preview.is-tab-open .map-submit-btn:hover:not(:disabled) {
    background: #8a5d40;
    transform: translateY(-1px);
}

.map-preview.is-tab-open .map-submit-btn:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow:
        inset 0 -2px 0 rgba(0, 0, 0, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.12),
        0 2px 0 #2c1a0e,
        0 4px 8px rgba(0, 0, 0, 0.45);
}

.map-preview.is-tab-open .map-submit-btn:disabled {
    background: #8a7565;
    color: rgba(248, 238, 223, 0.5);
    border-color: #4a3d33;
    box-shadow:
        inset 0 -3px 0 rgba(0, 0, 0, 0.25),
        0 4px 0 #4a3d33,
        0 6px 12px rgba(0, 0, 0, 0.35);
    opacity: 1;
    cursor: not-allowed;
}

.map-preview.is-tab-open .map-hint {
    display: none;
}

body:has(.map-preview.is-tab-open) .game-info {
    opacity: 0 !important;
    pointer-events: none;
}

.map-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1100;
    animation: mg-backdrop-fade 0.15s ease;
}

body:has(.map-preview.is-tab-open) .map-backdrop {
    display: block;
}

@keyframes mg-tab-open {
    from { transform: translate(50%, 50%) scale(0.96); opacity: 0; }
    to { transform: translate(50%, 50%) scale(1); opacity: 1; }
}

@keyframes mg-backdrop-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.map-toolbar,
.map-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(28, 22, 68, 0.9);
    position: relative;
    z-index: 5;
}

.map-toolbar {
    justify-content: flex-end;
}

.map-tool-btn,
.map-submit-btn {
    height: 28px;
    min-width: 28px;
    padding: 0 9px;
    border: 1px solid rgba(174, 149, 255, 0.42);
    background: rgba(13, 12, 36, 0.52);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.map-tool-btn:hover,
.map-submit-btn:hover:not(:disabled) {
    background: rgba(87, 70, 160, 0.78);
    border-color: rgba(226, 211, 255, 0.74);
}

.map-tool-btn.wide {
    min-width: 42px;
}

.map-zoom-value {
    min-width: 54px;
    text-align: center;
    color: #c8bbff;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.map-footer {
    justify-content: space-between;
}

.guess-coords {
    min-width: 0;
    color: #c8bbff;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-submit-btn {
    min-width: 88px;
    background: linear-gradient(180deg, #7b64e8, #4b369c);
    font-weight: 400;
}

.map-submit-btn:disabled {
    background: rgba(13, 12, 36, 0.52);
    color: #8c82b8;
    cursor: not-allowed;
    opacity: 0.75;
}

.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, rgba(174, 149, 255, 0.08), transparent 40%),
        #0a0a15;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}

.map-container.is-grabbing {
    cursor: grabbing;
}

.map-container.inactive {
    cursor: default;
}

.map-container.show-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 7;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    background-size: var(--grid-px) var(--grid-px);
    background-position: var(--grid-offset-x) var(--grid-offset-y);
}

#game-map-container.is-revealing #game-map-img,
#game-map-container.is-revealing .map-marker {
    transition: transform 0.55s ease, left 0.55s ease, top 0.55s ease;
}

#game-map-img {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    max-width: none;
    transform-origin: 0 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-image-rendering: pixelated;
    pointer-events: none;
}

#map-canvas {
    display: none;
}

.guess-result-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    overflow: visible;
}

.guess-result-line line {
    display: none;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 2;
    stroke-dasharray: 6 6;
}

.guess-result-line.visible line {
    display: block;
}

.map-marker {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #e94560;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

.map-marker.real {
    background: #4ecca3;
}

.center-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ff0;
    border: 2px solid #000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.center-marker::before,
.center-marker::after {
    content: '';
    position: absolute;
    background: #ff0;
}

.center-marker::before {
    width: 2px;
    height: 30px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.center-marker::after {
    width: 30px;
    height: 2px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@property --timer-progress {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

.game-info {
    position: fixed;
    inset: 0;
    z-index: 1500;
    pointer-events: none;
    color: #f4f1ff;
    font-family: 'Minecraft Rus', 'VT323', 'Segoe UI', monospace;
}

.game-home-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    min-width: 148px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid rgba(174, 149, 255, 0.48);
    border-radius: 10px;
    background: rgba(24, 18, 58, 0.78);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    color: #f8f4ff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    pointer-events: auto;
    transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease;
}

.game-home-btn:hover {
    background: rgba(37, 29, 82, 0.9);
    border-color: rgba(226, 211, 255, 0.74);
}

.game-home-btn:active {
    transform: translateY(1px);
}

.hud-timer-card {
    --timer-progress: 0;
    position: absolute;
    top: 18px;
    left: 50%;
    width: 164px;
    height: 72px;
    padding: 4px;
    transform: translateX(-50%);
    border-radius: 18px;
    background:
        conic-gradient(from -90deg, #ffd84d calc(var(--timer-progress) * 1turn), rgba(110, 84, 204, 0.34) 0),
        linear-gradient(135deg, rgba(219, 205, 255, 0.72), rgba(78, 53, 151, 0.36));
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42), 0 0 26px rgba(120, 93, 255, 0.28);
    transition: --timer-progress 0.45s linear, background 0.2s ease;
}

.hud-timer-card.is-low {
    background:
        conic-gradient(from -90deg, #ff5f6d calc(var(--timer-progress) * 1turn), rgba(110, 84, 204, 0.34) 0),
        linear-gradient(135deg, rgba(255, 184, 108, 0.82), rgba(130, 35, 68, 0.52));
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.44), 0 0 30px rgba(255, 95, 109, 0.34);
}

.hud-timer-inner {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    grid-template-columns: auto auto;
    gap: 10px;
    border-radius: 14px;
    background: rgba(20, 16, 46, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 0 28px rgba(0, 0, 0, 0.36);
}

.hud-timer-inner span {
    color: #a890ff;
    font-size: 11px;
    line-height: 1;
    text-transform: uppercase;
}

#time-remaining {
    color: #fff;
    font-size: 30px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}

#time-remaining.is-low {
    color: #ffb86c;
}

.rounds-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    width: min(360px, calc(100vw - 40px));
    max-height: calc(100vh - 300px);
    display: grid;
    gap: 10px;
    padding: 14px;
    overflow-y: auto;
    scrollbar-width: none;
    border: 1px solid rgba(174, 149, 255, 0.5);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(36, 28, 84, 0.9), rgba(21, 17, 55, 0.86));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    pointer-events: auto;
}

.rounds-hud::-webkit-scrollbar {
    display: none;
}

.rounds-hud-head,
.rounds-hud-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #c8bbff;
    font-size: 14px;
}

.rounds-hud-head strong,
.rounds-hud-total strong {
    color: #fff;
    font-size: 18px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.rounds-hud-list {
    display: grid;
    gap: 6px;
}

.game-session-summary {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(95, 214, 214, 0.24);
    border-radius: 10px;
    background: rgba(95, 214, 214, 0.08);
    color: #d9f7f7;
    font-size: 13px;
}

.game-session-summary[hidden] {
    display: none;
}

.game-session-summary-main,
.game-session-summary-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.game-session-summary-main strong {
    color: #fff;
    font-size: 14px;
    font-weight: 400;
}

.game-session-summary-meta {
    align-items: flex-start;
    color: #9adbdc;
    line-height: 1.35;
}

.game-session-summary-meta span {
    min-width: 0;
}

.game-session-copy {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 6px 9px;
    border: 1px solid rgba(95, 214, 214, 0.4);
    border-radius: 7px;
    background: rgba(95, 214, 214, 0.12);
    color: #e9ffff;
    font: inherit;
    cursor: pointer;
}

.game-session-copy:hover,
.game-session-copy:focus-visible {
    background: rgba(95, 214, 214, 0.2);
    outline: none;
}

.game-session-copy:disabled {
    cursor: default;
    opacity: 0.65;
}

.rounds-hud-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(174, 149, 255, 0.16);
    border-radius: 9px;
    background: rgba(13, 12, 36, 0.42);
    color: #8c82b8;
    font-size: 14px;
}

.rounds-hud-row.is-current {
    border-color: rgba(255, 216, 77, 0.72);
    background: linear-gradient(135deg, rgba(87, 70, 36, 0.86), rgba(44, 34, 75, 0.72));
    box-shadow: inset 3px 0 0 #ffd84d;
}

.rounds-hud-row.is-complete {
    color: #e7e0ff;
}

.rounds-hud-round {
    color: #a890ff;
}

.rounds-hud-row.is-current .rounds-hud-round {
    color: #ffd84d;
}

.rounds-hud-time,
.rounds-hud-points {
    font-variant-numeric: tabular-nums;
}

.rounds-hud-points {
    color: #4ecca3;
    text-align: right;
}

.rounds-hud-row:not(.is-complete):not(.is-current) .rounds-hud-points {
    color: #8c82b8;
}

.rounds-hud #start-round-btn {
    width: 100%;
    margin-top: 2px;
    pointer-events: auto;
}

.rounds-hud .round-result {
    max-height: 220px;
    margin-top: 0;
    padding: 12px;
    border: 1px solid rgba(174, 149, 255, 0.18);
    background: rgba(11, 10, 32, 0.5);
    font-size: 13px;
}

.rounds-hud .round-result.is-final {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100vw - 40px));
    max-height: min(76vh, 680px);
    margin: 0;
    padding: 22px;
    transform: translate(-50%, -50%);
    border-color: rgba(226, 211, 255, 0.7);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(42, 33, 96, 0.96), rgba(18, 14, 48, 0.96)),
        rgba(11, 10, 32, 0.96);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.58),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 0 9999px rgba(0, 0, 0, 0.24);
    pointer-events: auto;
    z-index: 2200;
}

.rounds-hud .round-result.is-final .final-result {
    text-align: center;
}

.final-game-code {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid rgba(95, 214, 214, 0.28);
    border-radius: 12px;
    background: rgba(95, 214, 214, 0.08);
    color: #d9f7f7;
    text-align: left;
}

.final-game-code b,
.final-game-code span,
.final-game-code small {
    display: block;
}

.final-game-code b {
    color: #fff;
    font-weight: 400;
}

.final-game-code span,
.final-game-code small {
    color: #9adbdc;
    font-size: 13px;
}

.final-game-code small {
    grid-column: 1 / -1;
}

.final-code-copy-btn {
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid rgba(95, 214, 214, 0.45);
    border-radius: 8px;
    background: rgba(95, 214, 214, 0.14);
    color: #e9ffff;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
}

.final-code-copy-btn:hover,
.final-code-copy-btn:focus-visible {
    background: rgba(95, 214, 214, 0.22);
    outline: none;
}

@media (max-width: 420px) {
    .final-game-code {
        grid-template-columns: 1fr;
    }

    .final-code-copy-btn {
        width: 100%;
    }
}

.final-new-game-btn {
    justify-self: center;
    min-width: 160px;
    min-height: 44px;
    margin-top: 12px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 216, 77, 0.72);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffd84d, #a8841e);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28), 0 12px 24px rgba(0, 0, 0, 0.35);
    color: #19110a;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
}

.final-new-game-btn:hover {
    filter: brightness(1.08);
}

@media (max-width: 860px), (max-height: 620px) {
    .game-home-btn {
        top: 12px;
        left: 12px;
        min-width: 124px;
        min-height: 38px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .hud-timer-card {
        top: 12px;
        width: 134px;
        height: 60px;
    }

    .hud-timer-inner span {
        font-size: 9px;
    }

    #time-remaining {
        font-size: 24px;
    }

    .rounds-hud {
        top: 94px;
        right: 12px;
        width: min(320px, calc(100vw - 24px));
        max-height: 34vh;
        padding: 10px;
    }

    .rounds-hud-row {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 560px) {
    .rounds-hud {
        right: 12px;
        left: 12px;
        width: auto;
    }
}

.btn {
    padding: 12px 24px;
    background: #e94560;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn:hover {
    background: #ff6b6b;
}

.btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.btn.secondary {
    background: #0f3460;
}

.btn.secondary:hover {
    background: #1a4f86;
}

.round-result {
    margin-top: 15px;
    padding: 15px;
    background: #16213e;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.45;
    text-align: left;
    max-height: min(52vh, 520px);
    overflow-y: auto;
    scrollbar-width: none;
}

.round-result::-webkit-scrollbar {
    display: none;
}

.round-result.is-revealed {
    animation: resultReveal 0.22s ease-out;
}

@keyframes resultReveal {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.round-result-title,
.final-result-title {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.round-result-location {
    color: #aaa;
    margin-bottom: 8px;
}

.round-result-points,
.final-score {
    color: #4ecca3;
    font-size: 20px;
    font-weight: 700;
    margin-top: 8px;
}

.round-auto-advance {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    color: #ddd;
    font-size: 14px;
}

.round-auto-advance strong {
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.round-transition-bar {
    height: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.round-transition-bar span {
    display: block;
    width: 100%;
    height: 100%;
    background: #4ecca3;
    animation: roundAutoAdvance linear forwards;
}

@keyframes roundAutoAdvance {
    from {
        width: 100%;
    }

    to {
        width: 0;
    }
}

.final-last-round {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.final-result {
    display: grid;
    gap: 6px;
}

.round-summary {
    display: grid;
    gap: 4px;
    margin-top: 8px;
}

.round-summary-row {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) minmax(86px, 1fr) minmax(50px, auto) minmax(58px, auto);
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-variant-numeric: tabular-nums;
}

.round-summary-row strong {
    color: #4ecca3;
    text-align: right;
}

.editor-container {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: 20px;
}

.editor-section {
    background: #16213e;
    padding: 20px;
    border-radius: 8px;
}

.editor-section h3 {
    margin-bottom: 15px;
    color: #e94560;
}

.editor-map-panel {
    display: grid;
    grid-template-rows: 40px minmax(360px, 58vh);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
    background: #0a0a15;
}

.editor-map-toolbar,
.editor-map-footer,
.locations-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-map-toolbar {
    justify-content: flex-end;
    padding: 6px;
    background: rgba(15, 52, 96, 0.9);
}

.editor-map-footer {
    justify-content: space-between;
    margin-top: 12px;
}

.map-editor-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #0a0a15;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}

.map-editor-wrapper.is-grabbing {
    cursor: grabbing;
}

#editor-map-img {
    transform-origin: 0 0;
    transform: translate(0px, 0px) scale(1);
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-image-rendering: pixelated;
    pointer-events: none;
}

#editor-location-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9;
}

.editor-location-marker {
    position: absolute;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4ecca3;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #0a0a15;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

.zoom-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 100;
}

#debug-cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #f00;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
    transform: translate(-50%, -50%);
}

#zoom-info {
    position: absolute;
    top: 35px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    z-index: 100;
}

.config-display {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.locations-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 15px;
}

.locations-auto-refresh {
    color: #aeb7d4;
    font-size: 14px;
    line-height: 1.4;
}

.locations-status {
    min-height: 22px;
    margin-bottom: 10px;
    color: #aaa;
    font-size: 14px;
}

.location-name-input,
.location-tags-input {
    width: 100%;
    padding: 10px;
    background: #0a0a15;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
}

.location-tags-input {
    margin-top: 8px;
    color: #d7e7ff;
    font-size: 13px;
}

.locations-list {
    max-height: calc(58vh + 40px);
    overflow-y: auto;
}

.location-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #0a0a15;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.location-details {
    margin-top: 6px;
    color: #aaa;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.location-warning {
    color: #ffb86c;
}

.location-item .delete-btn {
    padding: 9px 12px;
    background: #e94560;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
}

.empty-locations {
    padding: 18px;
    color: #aaa;
    background: #0a0a15;
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 980px) {
    .editor-container {
        grid-template-columns: 1fr;
    }

    .editor-map-panel {
        grid-template-rows: 40px minmax(320px, 52vh);
    }
}

.placeholder-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(7, 12, 28, 0.92) 0%, rgba(13, 31, 36, 0.94) 58%, rgba(18, 31, 21, 0.98) 100%),
        radial-gradient(circle at 50% 100%, rgba(78, 204, 163, 0.16), transparent 42%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.36s ease;
}

.placeholder-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.stars {
    position: absolute;
    inset: -10%;
    pointer-events: none;
    opacity: 0.72;
    animation: starDrift 24s linear infinite;
}

.stars::before,
.stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    box-shadow:
        50px 100px #fff, 120px 50px #fff, 200px 150px #fff,
        300px 80px #fff, 400px 200px #fff, 500px 100px #fff,
        600px 250px #fff, 700px 50px #fff, 800px 180px #fff,
        150px 300px #fff, 250px 350px #fff, 450px 300px #fff,
        550px 400px #fff, 650px 350px #fff, 750px 300px #fff,
        100px 450px #fff, 350px 450px #fff, 500px 500px #fff,
        50px 200px rgba(255,255,255,0.7), 180px 120px rgba(255,255,255,0.5),
        320px 280px rgba(255,255,255,0.6), 480px 180px rgba(255,255,255,0.4),
        620px 320px rgba(255,255,255,0.7), 780px 420px rgba(255,255,255,0.5);
    animation: twinkle 4s ease-in-out infinite;
}

.stars::after {
    left: 25%;
    top: 20%;
    box-shadow:
        70px 80px #fff, 150px 200px #fff, 250px 100px #fff,
        350px 300px #fff, 450px 150px #fff, 550px 350px #fff,
        650px 100px #fff, 750px 250px #fff, 100px 400px #fff,
        200px 450px #fff, 400px 420px #fff, 600px 380px #fff;
    animation: twinkle 5s ease-in-out infinite reverse;
}

@keyframes starDrift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-48px, 32px, 0); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.start-scene {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.start-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0%, rgba(78, 204, 163, 0.12) 32%, transparent 62%),
        linear-gradient(245deg, transparent 8%, rgba(233, 69, 96, 0.11) 46%, transparent 74%);
    opacity: 0.86;
    animation: skySweep 11s ease-in-out infinite alternate;
}

@keyframes skySweep {
    from { transform: translateX(-3%) skewX(-4deg); }
    to { transform: translateX(3%) skewX(4deg); }
}

.start-horizon {
    position: absolute;
    left: -5%;
    right: -5%;
    bottom: 0;
    height: min(32vh, 250px);
    background:
        linear-gradient(180deg, rgba(43, 83, 48, 0) 0%, rgba(43, 83, 48, 0.78) 34%, #162818 100%),
        repeating-linear-gradient(90deg, rgba(78, 204, 163, 0.14) 0 1px, transparent 1px 42px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 42px);
    clip-path: polygon(0 36%, 12% 30%, 22% 42%, 34% 26%, 47% 40%, 59% 24%, 73% 38%, 86% 28%, 100% 42%, 100% 100%, 0 100%);
    animation: horizonFloat 7s ease-in-out infinite;
}

@keyframes horizonFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

.start-map {
    position: absolute;
    right: clamp(24px, 8vw, 130px);
    bottom: clamp(88px, 16vh, 170px);
    width: clamp(220px, 22vw, 350px);
    aspect-ratio: 2028 / 1878;
    perspective: 900px;
    transform-style: preserve-3d;
}

.map-model-shadow {
    position: absolute;
    left: 4%;
    right: 2%;
    bottom: -18%;
    height: 30%;
    background:
        radial-gradient(ellipse at 52% 45%, rgba(0, 0, 0, 0.58), transparent 68%),
        radial-gradient(ellipse at 70% 42%, rgba(0, 0, 0, 0.32), transparent 72%);
    filter: blur(10px);
    transform: rotateX(72deg);
    animation: mapShadow 6s ease-in-out infinite;
}

.map-model {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateX(18deg) rotateY(-16deg) rotateZ(-6deg);
    transform-origin: center;
    animation: mapFloat 6s ease-in-out infinite;
}

.map-model-face,
.map-model-back,
.map-model-edge {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
}

.map-model-face {
    overflow: hidden;
    transform: translateZ(22px);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 26px 64px rgba(0, 0, 0, 0.5),
        0 0 34px rgba(78, 204, 163, 0.12);
}

.map-surface {
    position: absolute;
    inset: 6% 9%;
    overflow: hidden;
    border-radius: 6px;
    background: transparent;
}

.map-model-texture {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.92;
    filter:
        saturate(0.9)
        contrast(1.08)
        brightness(0.82)
        drop-shadow(0 16px 20px rgba(0, 0, 0, 0.42));
}

.map-model-back {
    transform: translateZ(-22px);
    background: transparent;
    border: none;
}

.map-model-edge {
    inset: 9px;
    transform: translateZ(0);
    background: transparent;
    box-shadow:
        0 0 0 18px rgba(42, 28, 30, 0.82),
        0 16px 30px rgba(0, 0, 0, 0.34),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.map-path {
    position: absolute;
    inset: 18% 13% 18% 15%;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-right-color: rgba(78, 204, 163, 0.75);
    border-bottom-color: rgba(78, 204, 163, 0.75);
    border-radius: 45% 35% 48% 30%;
    z-index: 2;
    pointer-events: none;
}

@keyframes mapFloat {
    0%, 100% { transform: rotateX(18deg) rotateY(-16deg) rotateZ(-6deg) translate3d(0, 0, 0); }
    50% { transform: rotateX(14deg) rotateY(-22deg) rotateZ(-10deg) translate3d(0, -12px, 18px); }
}

@keyframes mapShadow {
    0%, 100% { opacity: 0.82; transform: rotateX(72deg) scale(1); }
    50% { opacity: 0.56; transform: rotateX(72deg) scale(0.88); }
}

.map-scan {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 8px;
    z-index: 3;
}

.map-scan::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -30%;
    width: 36%;
    height: 140%;
    background: linear-gradient(90deg, transparent, rgba(78, 204, 163, 0.36), transparent);
    transform: skewX(-18deg);
    animation: mapScan 3.2s linear infinite;
}

@keyframes mapScan {
    from { transform: translateX(0) skewX(-18deg); }
    to { transform: translateX(430%) skewX(-18deg); }
}

.map-node {
    position: absolute;
    width: 13px;
    height: 13px;
    border: 2px solid #fff;
    background: #e94560;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.35);
    animation: nodePulse 2.2s ease-out infinite;
    z-index: 4;
}

.node-a { left: 20%; top: 64%; animation-delay: 0s; }
.node-b { left: 44%; top: 38%; animation-delay: 0.3s; }
.node-c { left: 69%; top: 58%; animation-delay: 0.6s; }
.node-target {
    left: 76%;
    top: 28%;
    width: 17px;
    height: 17px;
    background: #4ecca3;
    animation-delay: 0.9s;
}

@keyframes nodePulse {
    0% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.42); }
    100% { box-shadow: 0 0 0 18px rgba(233, 69, 96, 0); }
}

.start-compass-model {
    position: absolute;
    left: clamp(22px, 8vw, 120px);
    bottom: clamp(58px, 12vh, 132px);
    width: clamp(170px, 20vw, 280px);
    aspect-ratio: 1;
    perspective: 840px;
    transform-style: preserve-3d;
}

.compass-model-shadow {
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: -10%;
    height: 20%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.46), transparent 72%);
    filter: blur(6px);
    transform: rotateX(72deg);
    animation: compassShadow 5s ease-in-out infinite;
}

.compass-model {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateX(16deg) rotateY(16deg) rotateZ(8deg);
    animation: compassModelFloat 5s ease-in-out infinite;
}

.compass-model-face,
.compass-model-back,
.compass-model-edge {
    position: absolute;
    inset: 0;
    border-radius: 16px;
}

.compass-model-face {
    display: grid;
    place-items: center;
    transform: translateZ(20px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 36%),
        rgba(13, 22, 30, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 22px 58px rgba(0, 0, 0, 0.36),
        0 0 38px rgba(78, 204, 163, 0.18);
}

.compass-model-face::before {
    content: '';
    position: absolute;
    inset: 11%;
    border-radius: 14px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 14px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 14px);
    opacity: 0.42;
}

.compass-model-face img {
    position: relative;
    width: 78%;
    height: 78%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
    transform: translateZ(5px);
}

.compass-model-back {
    transform: translateZ(-20px);
    background: #121c26;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.compass-model-edge {
    inset: 7px;
    transform: translateZ(0);
    background: rgba(70, 42, 38, 0.9);
    box-shadow:
        0 0 0 16px rgba(42, 28, 30, 0.82),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@keyframes compassModelFloat {
    0%, 100% { transform: rotateX(16deg) rotateY(16deg) rotateZ(8deg) translate3d(0, 0, 0); }
    50% { transform: rotateX(12deg) rotateY(22deg) rotateZ(12deg) translate3d(0, -12px, 18px); }
}

@keyframes compassShadow {
    0%, 100% { opacity: 0.64; transform: rotateX(72deg) scale(1); }
    50% { opacity: 0.42; transform: rotateX(72deg) scale(0.84); }
}

.placeholder-content {
    position: relative;
    text-align: center;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 18px;
    padding: 28px;
    animation: titleRise 0.6s ease-out both;
}

@keyframes titleRise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.compass {
    position: relative;
    width: 118px;
    height: 118px;
}

.compass-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(233, 69, 96, 0.82);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite, compassTurn 18s linear infinite;
}

.compass-ring::before,
.compass-ring::after {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
}

.compass-ring::after {
    inset: 32px;
    border-color: rgba(78, 204, 163, 0.42);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes compassTurn {
    from { rotate: 0deg; }
    to { rotate: 360deg; }
}

.compass-directions {
    position: absolute;
    width: 100%;
    height: 100%;
    font-size: 18px;
    font-weight: bold;
}

.compass-directions .dir {
    position: absolute;
    color: #eee;
}

.compass-directions .n { top: 5px; left: 50%; transform: translateX(-50%); color: #e94560; }
.compass-directions .e { right: 5px; top: 50%; transform: translateY(-50%); }
.compass-directions .s { bottom: 5px; left: 50%; transform: translateX(-50%); }
.compass-directions .w { left: 5px; top: 50%; transform: translateY(-50%); }

.compass-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 40px;
    background: linear-gradient(to bottom, #e94560 50%, #fff 50%);
    transform: translate(-50%, -50%);
    transform-origin: 50% 50%;
    animation: needleSearch 4s ease-in-out infinite;
}

@keyframes needleSearch {
    0%, 100% { transform: translate(-50%, -50%) rotate(-14deg); }
    50% { transform: translate(-50%, -50%) rotate(22deg); }
}

.placeholder-title {
    font-size: clamp(44px, 7vw, 86px);
    font-weight: 800;
    letter-spacing: 0;
    color: #fff;
    text-shadow: 0 0 26px rgba(78, 204, 163, 0.36), 0 8px 28px rgba(0, 0, 0, 0.55);
    margin: 0;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 26px rgba(78, 204, 163, 0.28), 0 8px 28px rgba(0, 0, 0, 0.55); }
    50% { text-shadow: 0 0 32px rgba(233, 69, 96, 0.34), 0 8px 28px rgba(0, 0, 0, 0.55); }
}

.placeholder-hint {
    font-size: 18px;
    color: #888;
    margin-bottom: 30px;
}

.placeholder-btn {
    position: relative;
    min-width: 190px;
    height: 52px;
    padding: 0 28px;
    overflow: hidden;
    background: #e94560;
    border: 1px solid rgba(255, 255, 255, 0.32);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 14px 42px rgba(233, 69, 96, 0.32);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0;
}

.placeholder-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -45%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    transform: skewX(-20deg);
    animation: buttonSweep 2.8s ease-in-out infinite;
}

@keyframes buttonSweep {
    0%, 38% { transform: translateX(0) skewX(-20deg); }
    70%, 100% { transform: translateX(380%) skewX(-20deg); }
}

.placeholder-btn:hover {
    transform: translateY(-2px) scale(1.02);
    background: #ff566e;
    box-shadow: 0 18px 46px rgba(233, 69, 96, 0.42);
}

.placeholder-btn:active {
    transform: translateY(0);
}

@media (max-width: 760px) {
    .start-map {
        right: 50%;
        bottom: 70px;
        width: min(72vw, 300px);
        transform: translateX(50%);
    }

    .start-compass-model {
        left: 50%;
        bottom: 42px;
        width: min(40vw, 170px);
        transform: translateX(-50%);
    }

    .placeholder-content {
        transform: translateY(-52px);
    }
}

/* Reference start screen experiment. Revert this commit to return to the previous start screen. */
body.is-start-screen-active .tabs {
    display: none;
}

body.is-start-screen-active #game-tab {
    padding-top: 0;
}

body.is-game-hud-active .tabs {
    display: none;
}

body.is-game-hud-active #game-tab {
    padding-top: 0;
}

.reference-start.placeholder-overlay {
    display: block;
    background:
        linear-gradient(180deg, rgba(14, 39, 61, 0.08) 0%, rgba(14, 39, 61, 0.02) 42%, rgba(17, 25, 13, 0.32) 100%),
        url('../assets/backgrounds/minegesser-hero-bg-2k.png') center center / cover no-repeat,
        #2e9be0;
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
}

.reference-start::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.1), transparent 42%),
        radial-gradient(circle at 50% 55%, rgba(0,0,0,0.08), transparent 42%),
        linear-gradient(180deg, transparent 72%, rgba(18, 32, 16, 0.46));
    pointer-events: none;
    z-index: 1;
}

.reference-sky {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: none;
}

.reference-sky::before,
.reference-sky::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 34vw;
    height: 44vh;
    background:
        repeating-linear-gradient(90deg, rgba(0,0,0,0.12) 0 4px, transparent 4px 22px),
        linear-gradient(135deg, #54863f, #244a2f);
    clip-path: polygon(0 70%, 18% 42%, 32% 64%, 48% 35%, 68% 66%, 84% 42%, 100% 70%, 100% 100%, 0 100%);
    opacity: 0.72;
}

.reference-sky::before {
    left: -6vw;
}

.reference-sky::after {
    right: -4vw;
    transform: scaleX(-1);
}

.reference-sky::before,
.reference-sky::after,
.reference-sky > * {
    display: none;
}

.sun {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70px;
    height: 70px;
    background: #fff9cc;
    box-shadow: 0 0 0 15px rgba(255, 241, 155, 0.34), 0 0 50px rgba(255, 232, 116, 0.8);
}

.cloud {
    position: absolute;
    height: 18px;
    background: rgba(255,255,255,0.78);
    box-shadow: 28px 0 rgba(255,255,255,0.78), 56px 0 rgba(255,255,255,0.78);
    animation: cloudSlide 22s linear infinite;
}

.cloud-a { top: 14%; left: 3%; width: 54px; }
.cloud-b { top: 22%; left: 24%; width: 70px; animation-duration: 28s; }
.cloud-c { top: 12%; right: 14%; width: 88px; animation-duration: 31s; }
.cloud-d { top: 27%; right: 4%; width: 46px; animation-duration: 19s; }

@keyframes cloudSlide {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(34px); }
}

.hill {
    position: absolute;
    bottom: -5vh;
    width: 42vw;
    height: 34vh;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.16), transparent 22%),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.14) 0 3px, transparent 3px 28px),
        #4d8a42;
    clip-path: polygon(0 62%, 14% 28%, 28% 56%, 46% 22%, 64% 60%, 82% 30%, 100% 66%, 100% 100%, 0 100%);
}

.hill-a { left: -8vw; }
.hill-b { right: -10vw; transform: scaleX(-1); }
.hill-c { left: 34vw; width: 36vw; opacity: 0.6; }

.reference-topbar {
    position: relative;
    z-index: 3;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(18px, 4vw, 58px);
    background: rgba(18, 78, 136, 0.38);
    box-shadow: inset 0 -1px rgba(255,255,255,0.12);
}

.reference-brand,
.reference-nav,
.reference-nav span {
    display: flex;
    align-items: center;
}

.reference-brand {
    gap: 14px;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.45);
}

.grass-cube {
    width: 38px;
    height: 38px;
    background:
        linear-gradient(180deg, #6fae35 0 34%, #6b4c28 34%),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.25) 0 3px, transparent 3px 9px);
    border: 3px solid #1a1714;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.28);
}

.reference-nav {
    gap: clamp(20px, 4vw, 58px);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.45);
}

.reference-nav span {
    gap: 10px;
    position: relative;
    min-height: 56px;
    opacity: 0.92;
}

.reference-nav span.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: #fff;
    box-shadow: 0 2px 0 rgba(0,0,0,0.35);
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: inline-block;
    background: #2c2c2c;
    border: 2px solid #111;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
}

.compass-icon { background: center / contain no-repeat url('../assets/ui/compass/compass_00.png'); }
.book-icon { background: linear-gradient(90deg, #ddd 0 45%, #8a7654 45% 55%, #ddd 55%); }
.cup-icon { background: linear-gradient(180deg, #ffdf42 0 55%, #7d4c18 55%); }
.gear-icon { background: radial-gradient(circle, #98a9b6 0 34%, #26333d 35% 54%, #98a9b6 55%); }

.reference-layout {
    position: relative;
    z-index: 2;
    min-height: calc(100vh - 170px);
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.55fr) minmax(260px, 0.95fr);
    gap: clamp(18px, 3vw, 46px);
    align-items: center;
    padding: 34px clamp(28px, 7vw, 130px) 118px;
}

.reference-card {
    background: rgba(73, 59, 43, 0.92);
    border: 4px solid #1f1a15;
    box-shadow:
        inset 0 0 0 4px rgba(191, 163, 110, 0.42),
        8px 8px 0 rgba(0,0,0,0.35);
    padding: 16px;
}

.reference-card-title {
    margin: -4px -4px 14px;
    padding: 8px 10px;
    color: #fff;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
    background: rgba(38, 31, 25, 0.86);
    border-bottom: 3px solid #1f1a15;
}

.reference-compass-card .start-compass-model,
.reference-map-card .start-map {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0 auto;
}

.reference-compass-card .start-compass-model {
    width: min(82%, 210px);
}

.reference-map-card .start-map {
    width: min(100%, 340px);
}

.reference-coords {
    display: grid;
    gap: 4px;
    margin-top: 16px;
    padding: 12px;
    color: #80e270;
    font-size: 17px;
    font-weight: 800;
    background: rgba(17, 22, 18, 0.8);
    border: 3px solid rgba(184, 158, 108, 0.58);
    text-shadow: 2px 2px 0 #000;
}

.reference-main {
    display: grid;
    justify-items: center;
    gap: 14px;
}

.reference-logo {
    position: relative;
    display: grid;
    justify-items: center;
}

.reference-logo .placeholder-title {
    font-size: clamp(70px, 9vw, 132px);
    line-height: 0.9;
    color: #f4f4f4;
    margin: 0;
    text-transform: none;
    text-shadow:
        5px 5px 0 #171717,
        8px 8px 0 rgba(0,0,0,0.42),
        0 0 18px rgba(255,255,255,0.26);
    animation: none;
}

.pin-dot {
    position: absolute;
    top: -8px;
    left: 44%;
    width: 28px;
    height: 38px;
    background: #f33;
    border: 4px solid #111;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
}

.pin-dot::after {
    content: '';
    position: absolute;
    inset: 8px;
    background: #fff;
    border-radius: 50%;
}

.reference-subtitle {
    padding: 8px 22px;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    background: rgba(45, 37, 30, 0.92);
    border: 3px solid #15120f;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    text-shadow: 2px 2px 0 #000;
}

.reference-preview {
    width: min(100%, 620px);
    aspect-ratio: 16 / 6;
    padding: 12px;
    background: rgba(73, 59, 43, 0.92);
    border: 4px solid #1f1a15;
    box-shadow:
        inset 0 0 0 4px rgba(191, 163, 110, 0.42),
        8px 8px 0 rgba(0,0,0,0.3);
}

.reference-preview-scene {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        linear-gradient(180deg, #8fd0ff 0 44%, #73a65d 44% 68%, #6b4c28 68%);
    border: 3px solid #15120f;
}

.preview-sun,
.preview-cloud,
.preview-mountain,
.preview-house,
.preview-path {
    position: absolute;
    display: block;
}

.preview-sun {
    top: 18px;
    left: 26px;
    width: 34px;
    height: 34px;
    background: #fff7b5;
    box-shadow: 0 0 20px rgba(255, 245, 150, 0.8);
}

.preview-cloud {
    height: 14px;
    background: rgba(255,255,255,0.86);
    box-shadow: 22px 0 rgba(255,255,255,0.86), 44px 0 rgba(255,255,255,0.86);
}

.preview-cloud-a { top: 34px; left: 120px; width: 38px; }
.preview-cloud-b { top: 58px; right: 120px; width: 48px; }

.preview-mountain {
    right: 0;
    bottom: 32%;
    width: 44%;
    height: 52%;
    background: linear-gradient(135deg, #6a7b8a, #cdd5dc);
    clip-path: polygon(0 100%, 38% 26%, 55% 56%, 76% 12%, 100% 100%);
}

.preview-house {
    bottom: 34%;
    width: 72px;
    height: 46px;
    background: #8b5d2b;
    border: 3px solid #3a2514;
}

.preview-house::before {
    content: '';
    position: absolute;
    left: -8px;
    right: -8px;
    top: -24px;
    height: 28px;
    background: #6a3e1f;
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.house-a { left: 58%; }
.house-b { left: 20%; transform: scale(0.82); }

.preview-path {
    left: 42%;
    bottom: 0;
    width: 20%;
    height: 58%;
    background: #c5aa74;
    clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%);
}

.reference-main .placeholder-btn {
    width: min(100%, 620px);
    height: 72px;
    border-radius: 0;
    border: 4px solid #1d2a16;
    background: linear-gradient(180deg, #74bd60, #3f8936);
    box-shadow:
        inset 0 0 0 4px rgba(255,255,255,0.14),
        7px 7px 0 rgba(0,0,0,0.38);
    font-size: clamp(25px, 4vw, 42px);
    text-shadow: 3px 3px 0 rgba(0,0,0,0.55);
}

.reference-mode-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    width: min(100%, 620px);
}

.reference-mode {
    height: 52px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    background: #747474;
    border: 4px solid #2b2b2b;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.14), 5px 5px 0 rgba(0,0,0,0.35);
    text-shadow: 2px 2px 0 #000;
}

button.reference-mode {
    cursor: pointer;
}

.reference-mode.active {
    background: #2e77a6;
}

.reference-map-controls {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    gap: 12px;
    margin-top: 14px;
}

.reference-map-controls span {
    height: 42px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    background: rgba(45, 37, 30, 0.92);
    border: 3px solid #1f1a15;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1);
}

.search-mark::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 10px 10px 0 -6px #fff;
}

.reference-feature-strip {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(980px, calc(100vw - 280px));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    background: rgba(45, 37, 30, 0.94);
    border: 4px solid #1f1a15;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.32);
}

.reference-feature-strip div {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    min-height: 74px;
    padding: 12px;
    border-right: 2px solid rgba(191, 163, 110, 0.32);
}

.reference-feature-strip div:last-child {
    border-right: none;
}

.feature-icon {
    grid-row: 1 / span 2;
    width: 38px;
    height: 38px;
    background: #4ecca3;
    border: 3px solid #15120f;
}

.feature-icon.globe { background: radial-gradient(circle, #4aa3ff 0 42%, #55aa44 43% 64%, #2f6e34 65%); }
.feature-icon.target { background: radial-gradient(circle, #fff 0 16%, #e94560 17% 32%, #fff 33% 48%, #333 49%); }
.feature-icon.star { background: #f7ca45; clip-path: polygon(50% 0, 61% 34%, 96% 34%, 68% 55%, 79% 90%, 50% 68%, 21% 90%, 32% 55%, 4% 34%, 39% 34%); }
.feature-icon.chart { background: linear-gradient(90deg, #69bb42 0 22%, transparent 22% 32%, #f4ca45 32% 54%, transparent 54% 64%, #3d8fd1 64%); }

.reference-feature-strip strong {
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
}

.reference-feature-strip small {
    color: #d8d3c7;
    font-size: 12px;
    line-height: 1.25;
}

@media (max-width: 1120px) {
    .reference-layout {
        grid-template-columns: 1fr;
        padding: 24px 24px 140px;
    }

    .reference-card {
        display: none;
    }

    .reference-feature-strip {
        width: calc(100vw - 32px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reference-nav {
        display: none;
    }
}

@media (max-width: 680px) {
    .reference-feature-strip {
        display: none;
    }

    .reference-layout {
        min-height: calc(100vh - 72px);
        padding-bottom: 28px;
    }

    .reference-logo .placeholder-title {
        font-size: clamp(48px, 16vw, 76px);
    }

    .reference-mode-row {
        grid-template-columns: 1fr;
    }
}

/* User supplied start screen design. Revert this commit to return to the previous test screen. */
.user-start-screen.placeholder-overlay {
    --mg-bg-0: #0e1116;
    --mg-bg-1: #141a22;
    --mg-bg-2: #1b232d;
    --mg-panel: #1e2630;
    --mg-panel-2: #222c38;
    --mg-line: #2a3441;
    --mg-ink: #eef2f5;
    --mg-ink-dim: #9aa6b2;
    --mg-ink-faint: #6c7785;
    --mg-grass: #5bba47;
    --mg-grass-deep: #3f8a31;
    --mg-grass-dark: #2a5e23;
    --mg-dirt: #7a5436;
    --mg-dirt-deep: #5a3d27;
    --mg-redstone: #e44b4b;
    --mg-redstone-deep: #a72b2b;
    --mg-gold: #f2c14e;
    --mg-diamond: #5fd6d6;
    --mg-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
    display: block;
    align-items: initial;
    justify-content: initial;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--mg-bg-0);
    color: var(--mg-ink);
    font-family: 'Minecraft Rus', 'VT323', 'Segoe UI', monospace;
    letter-spacing: 0;
}

.user-start-screen *,
.user-start-screen *::before,
.user-start-screen *::after {
    box-sizing: border-box;
    letter-spacing: 0;
}

.mg-wrap {
    width: min(1280px, calc(100% - 64px));
    margin: 0 auto;
}

.mg-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgba(14, 17, 22, 0.92), rgba(14, 17, 22, 0.68));
    border-bottom: 1px solid var(--mg-line);
    backdrop-filter: blur(10px);
}

.mg-nav-inner {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.mg-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--mg-ink);
    font-size: 20px;
    line-height: 1;
    text-transform: none;
}

.mg-cube {
    width: 30px;
    height: 30px;
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    image-rendering: pixelated;
    background: linear-gradient(135deg, #6fdc5a 0 50%, var(--mg-grass-deep) 50% 100%);
    border: 2px solid #0a0d12;
    box-shadow: inset 0 0 0 2px var(--mg-grass-dark), 0 2px 0 #000;
}

.mg-cube::after {
    content: '';
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    height: 9px;
    background: repeating-linear-gradient(90deg, var(--mg-dirt) 0 4px, var(--mg-dirt-deep) 4px 8px);
}

.mg-nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
    scrollbar-width: none;
}

.mg-nav-links::-webkit-scrollbar {
    display: none;
}

.mg-nav-links span {
    color: var(--mg-ink-dim);
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 6px;
}

.mg-nav-links span.active,
.mg-nav-links span:hover {
    color: var(--mg-ink);
    background: var(--mg-bg-2);
}

.mg-btn {
    appearance: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    color: var(--mg-ink);
    font: inherit;
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    transition: transform 0.08s ease, filter 0.16s ease, background 0.16s ease;
}

.mg-btn:active {
    transform: translateY(1px);
}

.mg-btn-ghost {
    background: transparent;
    border: 1px solid var(--mg-line);
}

.mg-btn-ghost:hover {
    background: var(--mg-bg-2);
}

.mg-btn-secondary {
    border: 1px solid var(--mg-line);
    background: #151d27;
    color: var(--mg-ink);
}

.mg-btn-secondary:hover,
.mg-btn-secondary:focus-visible {
    border-color: #3a4555;
    background: #202b38;
}

.mg-btn-grass {
    color: #0c1a07;
    background: linear-gradient(180deg, #74d65d 0%, var(--mg-grass) 55%, var(--mg-grass-deep) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -3px 0 var(--mg-grass-dark),
        0 2px 0 #0a0d12,
        0 12px 24px rgba(63, 138, 49, 0.32);
    font-weight: 700;
}

.mg-btn-grass:hover {
    filter: brightness(1.08);
}

.mg-btn-grass.is-code-start {
    background: linear-gradient(180deg, #8ee8dd 0%, var(--mg-diamond) 55%, #2c9b9b 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -3px 0 #1d7070,
        0 2px 0 #0a0d12,
        0 12px 24px rgba(95, 214, 214, 0.24);
}

.mg-btn-lg {
    min-height: 52px;
    padding: 14px 24px;
    font-size: 20px;
}

.mg-hero {
    position: relative;
    overflow: hidden;
    padding: 34px 0 58px;
    background:
        radial-gradient(860px 480px at 76% 30%, rgba(124, 182, 232, 0.1), transparent 62%),
        radial-gradient(880px 560px at 12% 72%, rgba(91, 186, 71, 0.12), transparent 64%),
        linear-gradient(180deg, #0e1116 0%, #11161f 100%);
}

.mg-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.7;
    overflow: hidden;
}

.mg-stars::before,
.mg-stars::after {
    content: '';
    position: absolute;
    inset: -18%;
    background-image:
        radial-gradient(1px 1px at 8% 14%, #fff 99%, transparent),
        radial-gradient(1px 1px at 22% 8%, #cfd8dc 99%, transparent),
        radial-gradient(1px 1px at 41% 19%, #fff 99%, transparent),
        radial-gradient(1px 1px at 67% 11%, #fff 99%, transparent),
        radial-gradient(1px 1px at 88% 22%, #cfd8dc 99%, transparent),
        radial-gradient(1px 1px at 12% 32%, #fff 99%, transparent),
        radial-gradient(1px 1px at 55% 6%, #cfd8dc 99%, transparent);
    animation: mgStarDrift 34s linear infinite;
}

.mg-stars::after {
    opacity: 0.45;
    transform: scale(1.25);
    animation-name: mgStarDriftLarge;
    animation-duration: 52s;
    animation-direction: reverse;
}

@keyframes mgStarDrift {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-22px, 14px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@keyframes mgStarDriftLarge {
    0% { transform: scale(1.25) translate3d(0, 0, 0); }
    50% { transform: scale(1.25) translate3d(18px, -12px, 0); }
    100% { transform: scale(1.25) translate3d(0, 0, 0); }
}

.mg-hero-inner {
    position: relative;
    z-index: 2;
    min-height: 372px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    gap: 48px;
    align-items: center;
}

.mg-hero-text {
    min-width: 0;
}

.mg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mg-ink-dim);
    font-size: 14px;
    text-transform: uppercase;
}

.mg-eyebrow span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mg-grass);
    box-shadow: 0 0 0 3px rgba(91, 186, 71, 0.18);
}

.mg-title {
    max-width: 660px;
    margin: 14px 0 14px;
    color: var(--mg-ink);
    font-size: 56px;
    font-weight: 700;
    line-height: 1.05;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.58);
}

.mg-title span {
    color: var(--mg-grass);
    text-shadow: 0 4px 0 #1f4719, 0 10px 20px rgba(91, 186, 71, 0.3);
}

.mg-lead {
    max-width: 600px;
    margin: 0;
    color: var(--mg-ink-dim);
    font-size: 18px;
    line-height: 1.55;
}

.mg-cta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.mg-cta-note {
    color: var(--mg-ink-faint);
    font-size: 14px;
}

.mg-live-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    color: var(--mg-ink-faint);
    font-size: 14px;
    font-weight: 400;
}

.mg-live-row strong {
    color: var(--mg-ink);
    font-weight: 400;
}

.mg-avatar {
    width: 26px;
    height: 26px;
    margin-right: 0;
    border: 2px solid var(--mg-bg-0);
    border-radius: 50%;
}

.mg-avatar.green { background: linear-gradient(135deg, #6fdc5a, var(--mg-grass-deep)); }
.mg-avatar.gold { background: linear-gradient(135deg, var(--mg-gold), #a86b12); }
.mg-avatar.cyan { background: linear-gradient(135deg, #7cb6e8, #3f6fa8); }
.mg-avatar.red { background: linear-gradient(135deg, var(--mg-redstone), #6e1b1b); }

.mg-stage {
    min-width: 0;
    height: 330px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-map-card {
    position: relative;
    width: 292px;
    height: 292px;
    transform: rotate(-4deg);
    filter: drop-shadow(0 30px 42px rgba(0, 0, 0, 0.55));
}

.mg-map-card > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.mg-pin {
    position: absolute;
    width: 22px;
    height: 22px;
    transform: rotate(4deg);
    background: var(--mg-redstone);
    border: 3px solid #0e1116;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 14px 12px rgba(0, 0, 0, 0.34);
}

.mg-pin::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 3px;
    height: 16px;
    transform: translateX(-50%);
    background: #0e1116;
}

.mg-pin-a { top: 38%; left: 46%; }
.mg-pin-b { top: 62%; left: 32%; background: var(--mg-diamond); }
.mg-pin-c { top: 30%; left: 63%; background: var(--mg-gold); }

.mg-compass-bubble {
    position: absolute;
    top: -26px;
    right: -32px;
    width: 94px;
    height: 94px;
    transform: rotate(4deg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 30%, #2a3441 0%, #1a2129 60%, #11161f 100%);
    border: 4px solid #0e1116;
    box-shadow:
        inset 0 0 0 2px #3a4555,
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        0 12px 30px rgba(0, 0, 0, 0.6);
}

.mg-compass-bubble img {
    width: 58px;
    height: 58px;
    image-rendering: pixelated;
    animation: mgCompassBob 4s ease-in-out infinite;
}

.mg-compass-bubble::after {
    content: '';
    position: absolute;
    inset: 14px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: mgCompassSpin 30s linear infinite;
}

@keyframes mgCompassBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes mgCompassSpin {
    to { transform: rotate(360deg); }
}

.mg-compass-meta {
    position: absolute;
    left: -38px;
    bottom: -10px;
    transform: rotate(4deg);
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: 360px;
    padding: 10px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: #11161f;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    color: var(--mg-ink-dim);
    font-size: 14px;
}

.mg-compass-meta b {
    color: var(--mg-ink);
}

.mg-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--mg-redstone);
    box-shadow: 0 0 0 3px rgba(228, 75, 75, 0.25);
    animation: mgLiveBlink 1.4s ease-in-out infinite;
}

@keyframes mgLiveBlink {
    50% { opacity: 0.3; }
}

.mg-grass-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    pointer-events: none;
    z-index: 1;
}

.mg-grass-strip::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 32px;
    height: 12px;
    background: linear-gradient(180deg, #6fdc5a, var(--mg-grass) 60%, var(--mg-grass-deep));
    clip-path: polygon(0 100%, 0 55%, 6% 40%, 12% 70%, 18% 38%, 25% 64%, 32% 42%, 39% 68%, 46% 36%, 53% 62%, 60% 44%, 67% 70%, 74% 40%, 81% 64%, 88% 34%, 95% 62%, 100% 42%, 100% 100%);
}

.mg-grass-strip span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0 14px, transparent 14px 16px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 14px, transparent 14px 16px),
        linear-gradient(180deg, #5a3d27 0%, #4a3220 50%, #3a2718 100%);
}

.mg-stats {
    position: relative;
    z-index: 3;
    margin-top: -30px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 18px 26px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: var(--mg-panel);
    box-shadow: var(--mg-shadow);
}

.mg-stats div {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: center;
    padding: 6px 12px;
}

.mg-stats div + div {
    border-left: 1px dashed var(--mg-line);
}

.mg-stat-icon {
    grid-row: 1 / span 2;
    width: 36px;
    height: 36px;
    border: 2px solid #0e1116;
    box-shadow: inset 0 0 0 2px #2a3441;
}

.mg-stat-icon.green { background: linear-gradient(180deg, #6fdc5a, var(--mg-grass-deep)); }
.mg-stat-icon.gold { background: linear-gradient(180deg, #ffd86b, #b9851c); }
.mg-stat-icon.cyan { background: linear-gradient(180deg, #9beeee, #2c9b9b); }
.mg-stat-icon.red { background: linear-gradient(180deg, #f06868, var(--mg-redstone-deep)); }

.mg-stats strong {
    color: var(--mg-ink);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.mg-stats small {
    color: var(--mg-ink-faint);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
}

.mg-section {
    padding: 74px 0 0;
}

.mg-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.mg-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--mg-grass);
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
}

.mg-section h2,
.mg-panel h2 {
    margin: 0;
    color: var(--mg-ink);
    font-size: 34px;
    font-weight: 400;
    line-height: 1.1;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.mg-muted-link {
    color: var(--mg-ink-dim);
    font-size: 15px;
}

.mg-map-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.mg-map-tile {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: var(--mg-panel);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.mg-map-tile-button {
    width: 100%;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    appearance: none;
    cursor: pointer;
}

.mg-map-tile:hover {
    transform: translateY(-3px);
    border-color: #3a4555;
}

.mg-map-tile:focus-visible {
    outline: 2px solid var(--mg-grass);
    outline-offset: 3px;
}

.mg-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 45%, #1a2230 0%, #0e1116 70%);
}

.mg-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}

.mg-thumb span {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 2;
    padding: 4px 8px;
    border: 1px solid var(--mg-line);
    border-radius: 6px;
    background: rgba(14, 17, 22, 0.8);
    color: var(--mg-ink);
    font-size: 12px;
    text-transform: uppercase;
}

.mg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.mg-thumb.nether img { filter: hue-rotate(-50deg) saturate(1.4) brightness(0.86) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }
.mg-thumb.build img { filter: hue-rotate(170deg) saturate(0.9) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }
.mg-thumb.duel img { filter: saturate(0.42) brightness(0.9) sepia(0.35) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }

.mg-map-tile h3 {
    margin: 14px 16px 6px;
    color: var(--mg-ink);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.15;
}

.mg-map-tile p {
    margin: 0 16px 16px;
    color: var(--mg-ink-faint);
    font-size: 13px;
    line-height: 1.35;
}

.mg-mode-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.mg-mode-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mg-mode-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(4, 6, 9, 0.72);
    cursor: pointer;
}

.mg-mode-dialog {
    position: relative;
    z-index: 1;
    width: min(860px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    display: grid;
    gap: 10px;
    padding: 16px 20px;
    overflow-y: auto;
    scrollbar-width: none;
    border: 1px solid #3a4555;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(34, 44, 56, 0.96), rgba(22, 29, 38, 0.98)),
        var(--mg-panel);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.mg-mode-dialog::-webkit-scrollbar {
    display: none;
}

.mg-mode-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--mg-line);
    border-radius: 6px;
    background: var(--mg-bg-2);
    color: var(--mg-ink);
    cursor: pointer;
    font: inherit;
    line-height: 1;
}

.mg-mode-close:hover,
.mg-mode-close:focus-visible {
    border-color: #3a4555;
    background: #26313d;
}

.mg-mode-dialog-head {
    max-width: 620px;
}

.mg-mode-dialog-head h2 {
    margin: 0;
    color: var(--mg-ink);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.15;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.mg-mode-dialog-head p {
    margin: 4px 0 0;
    color: var(--mg-ink-dim);
    font-size: 13px;
    line-height: 1.35;
}

.mg-mode-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mg-mode-choice {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--mg-panel-2), var(--mg-panel));
    color: var(--mg-ink);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.mg-mode-choice:hover,
.mg-mode-choice:focus-visible {
    border-color: #3a4555;
}

.mg-mode-choice.is-active {
    border-color: var(--mg-grass);
    box-shadow: inset 0 0 0 1px rgba(91, 186, 71, 0.22);
}

.mg-mode-choice-icon {
    width: 36px;
    height: 36px;
    border: 2px solid #0e1116;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.mg-mode-choice-icon.classic { background: linear-gradient(180deg, #6fdc5a, var(--mg-grass-deep)); }
.mg-mode-choice-icon.sprint { background: linear-gradient(180deg, #ffd86b, #b9851c); }
.mg-mode-choice-icon.custom { background: linear-gradient(180deg, #74d0da, #2f7c86); }

.mg-mode-choice b {
    display: block;
    overflow: hidden;
    color: var(--mg-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-mode-choice small {
    display: block;
    margin-top: 4px;
    color: var(--mg-ink-dim);
    font-size: 13px;
    line-height: 1.3;
}

.mg-mode-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 150px)) minmax(220px, 1fr) minmax(170px, auto);
    gap: 10px;
    align-items: end;
}

.mg-mode-settings label {
    min-width: 0;
    display: grid;
    gap: 5px;
    color: var(--mg-ink-dim);
    font-size: 13px;
}

.mg-mode-settings label.wide,
.mg-mode-settings .wide {
    grid-column: auto;
}

.mg-mode-settings input,
.mg-mode-settings select,
.mg-mode-settings textarea {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--mg-line);
    border-radius: 6px;
    background: #11161f;
    color: var(--mg-ink);
    font: inherit;
    font-size: 15px;
}

.mg-mode-settings textarea {
    min-height: 48px;
    line-height: 1.3;
    resize: vertical;
}

.mg-mode-settings select {
    cursor: pointer;
}

.mg-seed-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
}

.mg-icon-btn {
    width: 38px;
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--mg-line);
    border-radius: 6px;
    background: #11161f;
    color: var(--mg-ink);
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    line-height: 1;
}

.mg-icon-btn:hover,
.mg-icon-btn:focus-visible {
    border-color: rgba(95, 214, 214, 0.55);
    background: rgba(95, 214, 214, 0.1);
    outline: none;
}

.mg-checkbox-field {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--mg-line);
    border-radius: 6px;
    background: #11161f;
    color: var(--mg-ink);
    cursor: pointer;
}

.mg-checkbox-field input {
    flex: 0 0 auto;
    width: 18px;
    min-height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--mg-grass);
    cursor: pointer;
}

.mg-checkbox-field span {
    color: var(--mg-ink);
    line-height: 1.2;
}

.mg-mode-settings input:focus,
.mg-mode-settings select:focus,
.mg-mode-settings textarea:focus {
    outline: 2px solid rgba(91, 186, 71, 0.55);
    outline-offset: 1px;
}

.mg-custom-settings {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
    padding: 10px 12px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: rgba(10, 14, 20, 0.38);
}

.mg-custom-settings .mg-checkbox-field.wide {
    justify-self: start;
    width: max-content;
    max-width: 100%;
}

.mg-code-divider {
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--mg-line);
}

#mode-start-game-btn.mg-btn-lg {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 17px;
}

.mg-custom-settings .wide,
.mg-area-fields {
    grid-column: 1 / -1;
}

.mg-custom-settings[hidden],
.mg-area-fields[hidden],
#mode-tags-field[hidden] {
    display: none;
}

.mg-area-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.mg-tag-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
}

.mg-tag-chip-list[hidden] {
    display: none;
}

.mg-tag-empty {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(255, 184, 108, 0.22);
    border-radius: 6px;
    background: rgba(255, 184, 108, 0.08);
    color: #d8b78a;
    font-size: 12px;
    line-height: 1.2;
    text-transform: none;
}

.mg-tag-chip {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid rgba(95, 214, 214, 0.24);
    border-radius: 6px;
    background: rgba(95, 214, 214, 0.08);
    color: #cfeff4;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
}

.mg-tag-chip.is-active {
    border-color: rgba(91, 186, 71, 0.72);
    background: rgba(91, 186, 71, 0.24);
    color: #eaffdf;
}

.mg-code-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mg-code-actions .mg-btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
}

.mg-code-actions small {
    min-width: min(100%, 240px);
    color: var(--mg-ink-dim);
    font-size: 13px;
    line-height: 1.35;
    text-transform: none;
}

.mg-code-actions .mg-btn.is-copied {
    border-color: rgba(91, 186, 71, 0.7);
    background: linear-gradient(180deg, rgba(91, 186, 71, 0.34), rgba(63, 138, 49, 0.28));
    color: #eaffdf;
}

.mg-code-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(95, 214, 214, 0.28);
    border-radius: 6px;
    background: rgba(95, 214, 214, 0.07);
    text-transform: none;
}

.mg-code-preview[hidden] {
    display: none;
}

.mg-code-preview.is-warning {
    border-color: rgba(255, 184, 108, 0.42);
    background: rgba(255, 184, 108, 0.08);
}

.mg-code-preview.is-active-code {
    border-color: rgba(91, 186, 71, 0.58);
    background: rgba(91, 186, 71, 0.09);
}

.mg-code-preview-item {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(238, 242, 245, 0.08);
    border-radius: 5px;
    background: rgba(10, 14, 20, 0.32);
}

.mg-code-preview-item.is-wide {
    grid-column: 1 / -1;
}

.mg-code-preview-item b,
.mg-code-preview-item span {
    display: block;
}

.mg-code-preview-item b {
    margin-bottom: 3px;
    color: var(--mg-ink-faint);
    font-size: 11px;
    line-height: 1.2;
    text-transform: uppercase;
}

.mg-code-preview-item span {
    overflow-wrap: anywhere;
    color: var(--mg-ink);
    font-size: 13px;
    line-height: 1.3;
}

.mg-pool-preview {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid rgba(116, 208, 218, 0.28);
    border-radius: 6px;
    background: rgba(116, 208, 218, 0.08);
    color: #cfeff4;
    font-size: 13px;
    line-height: 1.35;
    text-transform: none;
}

.mg-pool-preview.is-warning {
    border-color: rgba(255, 184, 108, 0.42);
    background: rgba(255, 184, 108, 0.08);
    color: #ffce94;
}

.mg-btn:disabled {
    cursor: not-allowed;
    filter: grayscale(0.45) brightness(0.72);
}

.mg-mode-settings > .mg-btn {
    grid-column: 1 / -1;
    justify-self: start;
    min-width: 210px;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 18px;
    white-space: nowrap;
}

.mg-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
    gap: 22px;
}

.mg-panel {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: var(--mg-panel);
}

.mg-panel h2 {
    margin-bottom: 16px;
    font-size: 28px;
}

.mg-leader-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 44px;
    align-items: center;
    gap: 14px;
    padding: 11px 4px;
    border-bottom: 1px dashed var(--mg-line);
}

.mg-leader-row:last-child {
    border-bottom: 0;
}

.mg-leader-row.head {
    color: var(--mg-ink-faint);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
}

.mg-leader-row span {
    color: var(--mg-ink-faint);
    text-align: center;
}

.mg-leader-row .gold { color: var(--mg-gold); }
.mg-leader-row .silver { color: #cfd8dc; }
.mg-leader-row .bronze { color: #d39252; }

.mg-leader-row b {
    min-width: 0;
    overflow: hidden;
    color: var(--mg-ink);
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-leader-row strong {
    color: var(--mg-grass);
    font-weight: 400;
}

.mg-leader-row em {
    color: var(--mg-ink-faint);
    font-weight: 400;
    font-style: normal;
    text-align: right;
}

.mg-mode {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--mg-panel-2), var(--mg-panel));
}

.mg-mode.active {
    border-color: var(--mg-grass);
    box-shadow: inset 0 0 0 1px rgba(91, 186, 71, 0.2);
}

.mg-mode > span {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 2px solid #0e1116;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.mg-mode .classic { background: linear-gradient(180deg, #6fdc5a, var(--mg-grass-deep)); }
.mg-mode .nether { background: linear-gradient(180deg, #c43a3a, #6e1b1b); }
.mg-mode .duel { background: linear-gradient(180deg, #ffd86b, #b9851c); }
.mg-mode .end { background: linear-gradient(180deg, #4a3a6a, #251b3c); }

.mg-mode b {
    display: block;
    color: var(--mg-ink);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    text-transform: uppercase;
}

.mg-mode small {
    display: block;
    margin-top: 3px;
    color: var(--mg-ink-dim);
    font-size: 13px;
    line-height: 1.3;
}

.mg-footer {
    margin-top: 74px;
    padding: 34px 0;
    border-top: 1px solid var(--mg-line);
    background: var(--mg-bg-1);
}

.mg-footer .mg-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.mg-footer p {
    margin: 0;
    color: var(--mg-ink-faint);
    font-size: 13px;
}

@media (max-width: 1080px) {
    .mg-hero-inner,
    .mg-bottom-grid {
        grid-template-columns: 1fr;
    }

    .mg-stage {
        height: 270px;
    }

    .mg-map-card {
        width: 238px;
        height: 238px;
    }

    .mg-map-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mg-mode-options,
    .mg-mode-settings,
    .mg-custom-settings,
    .mg-code-preview,
    .mg-area-fields {
        grid-template-columns: 1fr;
    }

    .mg-code-preview-item.is-wide {
        grid-column: auto;
    }

    .mg-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mg-stats div + div {
        border-left: 0;
    }
}

@media (max-width: 720px) {
    .mg-wrap {
        width: min(100% - 28px, 1280px);
    }

    .mg-nav-inner {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        padding: 10px 0;
    }

    .mg-nav-links {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .mg-title {
        font-size: 40px;
    }

    .mg-hero {
        padding-top: 24px;
    }

    .mg-cta-row {
        align-items: stretch;
        flex-direction: column;
    }

    .mg-btn-lg {
        width: 100%;
    }

    .mg-live-row {
        flex-wrap: wrap;
    }

    .mg-compass-meta {
        left: -22px;
        max-width: 300px;
        white-space: normal;
    }

    .mg-stats,
    .mg-map-grid {
        grid-template-columns: 1fr;
    }

    .mg-mode-modal {
        padding: 14px;
    }

    .mg-mode-dialog {
        max-height: calc(100vh - 28px);
        padding: 22px 16px 16px;
    }

    .mg-mode-dialog-head h2 {
        font-size: 28px;
    }

    .mg-mode-settings {
        gap: 10px;
    }

    .mg-custom-settings {
        padding: 12px;
    }

    .mg-code-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .mg-code-actions .mg-btn {
        width: 100%;
    }

    .mg-code-actions small {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .mg-section-head,
    .mg-footer .mg-wrap {
        align-items: flex-start;
        flex-direction: column;
    }

    .mg-leader-row {
        grid-template-columns: 36px minmax(0, 1fr) auto;
    }

    .mg-leader-row em,
    .mg-leader-row.head span:last-child {
        display: none;
    }
}

@media (max-width: 420px) {
    .mg-mode-modal {
        padding: 8px;
    }

    .mg-mode-dialog {
        max-height: calc(100vh - 16px);
        gap: 14px;
        padding: 18px 12px 12px;
    }

    .mg-mode-close {
        top: 10px;
        right: 10px;
    }

    .mg-mode-dialog-head {
        padding-right: 38px;
    }

    .mg-code-actions {
        grid-template-columns: 1fr;
    }
}

/* Mode-based visibility: server injects body.mode-player or body.mode-admin */
body.mode-player .tabs,
body.mode-player .tab-btn[data-tab="editor"],
body.mode-player #editor-tab,
body.mode-player #placeholder-editor-btn {
    display: none !important;
}

body.mode-admin .tabs,
body.mode-admin .tab-btn[data-tab="game"],
body.mode-admin #game-tab {
    display: none !important;
}

