:root {
    --bg: #0a0a0c;
    --border: #24242a;
    --text: #c9c9c9;
    --crystal: #7ce8ff;
    --trash: #8aff5c;
    --mc-btn-top: #8a8a8a;
    --mc-btn-bottom: #555555;
}

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

body {
    background: #0b0b0e;
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
}

.game-title {
    font-size: 1.1rem;
    font-weight: normal;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #6b6b75;
    margin-bottom: 1rem;
}

.screen-wrap {
    position: relative;
    width: 100%;
    max-width: 1000px;
    border: 2px solid #1c1c22;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 40px rgba(124, 232, 255, 0.08);
}

#screen {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

/* ---------- HUD ---------- */
.hud {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    pointer-events: none;
    z-index: 3;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.hud-item {
    font-size: 0.85rem;
    color: var(--text);
    text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,0.7);
}

.hud-item b { color: #fff; }

.hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    pointer-events: auto;
}

.hud-user {
    font-size: 0.8rem;
    color: var(--crystal);
    text-shadow: 0 1px 3px #000;
}

.fs-btn {
    pointer-events: auto;
    background: rgba(20, 20, 24, 0.75);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    white-space: nowrap;
}

.fs-btn:hover { border-color: var(--crystal); color: #fff; }

/* ---------- прицел ---------- */
.crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    text-shadow: 0 0 4px #000;
    pointer-events: none;
    z-index: 3;
    display: none;
}

body.playing .crosshair { display: block; }

/* ---------- хотбар ---------- */
.hotbar {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 3;
}

.hotbar-slot {
    width: 58px;
    height: 58px;
    border: 2px solid #333;
    background: rgba(16, 16, 20, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    border-radius: 4px;
    pointer-events: none;
}

.hotbar-slot.selected {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.hotbar-name {
    font-size: 0.6rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hotbar-count {
    font-size: 1rem;
    color: #fff;
    font-weight: bold;
}

/* ---------- миникарта ---------- */
.minimap {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 150px;
    height: 110px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.55);
    z-index: 3;
    image-rendering: pixelated;
}

/* ---------- оверлей ---------- */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 9, 0.58);
    z-index: 5;
}

.overlay-card {
    text-align: center;
    padding: 2rem;
    max-width: 480px;
}

.mc-logo {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: 4px;
    line-height: 1.05;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0 #1a1a22;
}

.mc-logo-t1 { color: #7ce8ff; }
.mc-logo-t2 { color: #e0e0e0; }

.overlay-text {
    line-height: 1.6;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.hl-crystal { color: var(--crystal); }
.hl-trash { color: var(--trash); }

.overlay-record {
    color: var(--crystal);
    font-size: 1rem;
    margin-bottom: 0.4rem;
    min-height: 1.2rem;
}

.overlay-top {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.top-title {
    color: #6b6b75;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    margin-bottom: 0.4rem;
}

.top-row {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.2rem 0;
    border-bottom: 1px dashed var(--border);
}

.top-pos { color: #e0e0e0; width: 1.2rem; }
.top-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-time { color: var(--crystal); font-variant-numeric: tabular-nums; }

.overlay-controls {
    font-size: 0.82rem;
    line-height: 1.8;
    color: #9a9aa2;
    margin-bottom: 1.25rem;
}

/* MC-кнопки */
.mc-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mc-btn {
    font-family: 'Segoe UI', sans-serif;
    font-size: 1rem;
    padding: 0.6rem 1.8rem;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
    background: linear-gradient(#9a9a9a, #777777 45%, #555555);
    border: 2px solid #000;
    border-radius: 4px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 3px 0 #000;
    cursor: pointer;
    transition: filter 0.15s;
}

.mc-btn:hover { filter: brightness(1.15); }
.mc-btn:active { transform: translateY(1px); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 2px 0 #000; }

/* ---------- тач ---------- */
.touch {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: none;
    gap: 0.4rem;
    flex-direction: column;
    z-index: 3;
}

.touch-row { display: flex; gap: 0.4rem; }

.tbtn {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(20, 20, 24, 0.85);
    color: var(--text);
    font-size: 1.1rem;
    font-family: inherit;
    touch-action: none;
}

.tbtn-fire { color: var(--crystal); }

/* ---------- фуллскрин ---------- */
.screen-wrap:fullscreen,
.screen-wrap:-webkit-full-screen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.screen-wrap:fullscreen #screen,
.screen-wrap:-webkit-full-screen #screen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

.game-footer {
    margin-top: 1rem;
    font-size: 0.8rem;
}

.game-footer a { color: #6b6b75; text-decoration: none; }
.game-footer a:hover { color: #e0e0e0; text-decoration: underline; }

@media (hover: none), (pointer: coarse) {
    .touch { display: flex; }
    .overlay-controls { display: none; }
}

.overlay-title {
    font-weight: normal;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #e0e0e0;
    margin-bottom: 0.8rem;
    min-height: 1.3rem;
}

/* ---------- панели меню ---------- */
.panel {
    display: none;
    text-align: center;
    padding: 1.5rem 2rem;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.panel-title {
    font-weight: normal;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #e0e0e0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* список миров */
.world-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.world-empty {
    color: #9a9aa2;
    padding: 1rem 0;
}

.world-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(20, 20, 24, 0.85);
    border: 2px solid #2a2a30;
    border-radius: 6px;
    padding: 0.7rem 1rem;
    text-align: left;
}

.world-row strong { color: #fff; display: block; font-size: 1rem; }

.world-meta { color: #8a8a92; font-size: 0.8rem; }

.world-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.mc-btn-sm { padding: 0.4rem 1rem; font-size: 0.85rem; }

.mc-btn-danger { background: linear-gradient(#a05050, #7a3a3a 45%, #5a2a2a); }

.mc-btn-dim { background: linear-gradient(#5a5a5a, #444 45%, #333); }

.mc-buttons-col { flex-direction: column; }

/* создание мира */
.create-label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
    color: #9a9aa2;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.create-input {
    background: #141418;
    border: 2px solid #2a2a30;
    border-radius: 4px;
    color: #fff;
    padding: 0.5rem 0.7rem;
    font-family: inherit;
    font-size: 1rem;
}

.mode-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.mode-btn {
    text-align: left;
    background: rgba(20, 20, 24, 0.85);
    border: 2px solid #2a2a30;
    border-radius: 6px;
    color: #c9c9c9;
    padding: 0.7rem 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
}

.mode-btn b { display: block; color: #fff; font-size: 1rem; }
.mode-btn span { font-size: 0.8rem; color: #8a8a92; }

.mode-btn.active {
    border-color: #7ce8ff;
    background: rgba(124, 232, 255, 0.08);
}
