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

body {
    background: #1a1c2c;
    font-family: "Courier New", Courier, monospace;
    color: #fff;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
}

.game-title h1 {
    letter-spacing: 4px;
    font-size: 26px;
    color: #ffd740;
    text-shadow: 2px 2px 0 #d84315, 4px 4px 0 rgba(0,0,0,.4);
    margin-bottom: 10px;
}

.game-title h1 span {
    color: #ff6d00;
}

.game-screen {
    position: relative;
    width: 300px;
    height: 500px;
}

canvas {
    display: block;
    border: 4px solid #0f111a;
    border-radius: 6px;
    image-rendering: pixelated;
    background: #00bbc4;
}

/* ---------- topbar ---------- */
#topbar {
    position: absolute;
    top: 6px;
    right: 8px;
    display: flex;
    gap: 8px;
    font-size: 12px;
    font-weight: bold;
    background: rgba(0, 0, 0, .45);
    border-radius: 12px;
    padding: 3px 10px;
    z-index: 5;
    pointer-events: none;
}

/* ---------- overlays ---------- */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 24, .82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 14px;
    z-index: 10;
    text-align: center;
}

.hidden { display: none !important; }

.logo {
    font-size: 30px;
    line-height: 1.05;
    color: #ffd740;
    text-shadow: 2px 2px 0 #d84315;
    margin-bottom: 4px;
}
.logo em { color: #ff6d00; font-style: normal; }

.profile-line {
    font-size: 12px;
    color: #b0bec5;
    margin-bottom: 6px;
}

.btn {
    width: 200px;
    padding: 10px 0;
    font-family: inherit;
    font-weight: bold;
    font-size: 15px;
    color: #fff;
    background: #43a047;
    border: 0;
    border-bottom: 4px solid #1b5e20;
    border-radius: 8px;
    cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.small {
    width: 96px;
    padding: 7px 0;
    font-size: 12px;
    background: #546e7a;
    border-bottom-color: #263238;
}

.row { display: flex; gap: 8px; justify-content: center; }

.names {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: #90a4ae;
}
.names label { display: flex; flex-direction: column; gap: 2px; }
.names input {
    width: 92px;
    padding: 4px;
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    background: #263238;
    color: #fff;
    border: 1px solid #455a64;
    border-radius: 4px;
}

/* ---------- mode select ---------- */
.opt-group { margin: 4px 0; }
.opt-group p { font-size: 11px; color: #90a4ae; margin-bottom: 4px; }
.opt {
    padding: 6px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    color: #cfd8dc;
    background: #263238;
    border: 2px solid #455a64;
    border-radius: 6px;
    cursor: pointer;
}
.opt.sel { background: #ff6d00; border-color: #ffd740; color: #fff; }

/* ---------- shop & board ---------- */
.scrollbox {
    width: 100%;
    max-height: 330px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.coins-line { font-size: 14px; font-weight: bold; color: #ffd740; }

.shop-section { font-size: 12px; color: #ffd740; text-align: left; margin-top: 4px; }

.skin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.skin-card {
    background: #263238;
    border: 2px solid #455a64;
    border-radius: 8px;
    padding: 6px 2px;
    font-size: 10px;
    cursor: pointer;
}
.skin-card.equipped { border-color: #ffd740; background: #33421f; }
.skin-card .swatch {
    width: 26px; height: 18px;
    margin: 0 auto 4px;
    border-radius: 6px 10px 10px 6px;
    border: 1px solid rgba(0,0,0,.4);
}
.skin-card .price { color: #ffd740; }
.skin-card .owned { color: #81c784; }

.item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #263238;
    border: 2px solid #455a64;
    border-radius: 8px;
    padding: 6px;
    font-size: 10px;
    text-align: left;
}
.item-row .info { flex: 1; }
.item-row .name { font-size: 12px; font-weight: bold; }
.item-row .desc { color: #90a4ae; }
.item-row button {
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 6px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    color: #fff;
}
.item-row .buy { background: #43a047; }
.item-row .tog { background: #455a64; }
.item-row .tog.on { background: #ff6d00; }

.board-row {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    background: #263238;
    border-radius: 6px;
    padding: 5px 8px;
    text-align: left;
}
.board-row .rank { width: 22px; font-weight: bold; color: #ffd740; }
.board-row .bname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .bscore { font-weight: bold; }
.board-row.top1 { background: #4a3b12; border: 1px solid #ffd740; }
.board-empty { font-size: 12px; color: #78909c; padding: 20px 0; }

/* ---------- result ---------- */
.res-body { font-size: 13px; line-height: 1.7; }
.res-body .big { font-size: 30px; font-weight: bold; color: #ffd740; }
.res-body .up { color: #81c784; font-weight: bold; }
.res-body .best { color: #ff8a65; font-weight: bold; }

/* ---------- revive panel ---------- */
.panel {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: 250px;
    background: rgba(10, 12, 24, .92);
    border: 2px solid #ffd740;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 20;
    text-align: center;
}
.panel p { font-size: 12px; }
.panel .btn { width: 190px; padding: 8px 0; font-size: 13px; background: #ff6d00; border-bottom-color: #bf360c; }
.panel .btn.small { background: #546e7a; border-bottom-color: #263238; }

/* ---------- online ---------- */
.net-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.net-box .hint { font-size: 10px; color: #90a4ae; }
.net-box code { color: #ffd740; }
.net-box input {
    width: 200px;
    padding: 6px;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
    background: #263238;
    color: #fff;
    border: 1px solid #455a64;
    border-radius: 6px;
}
#joinCode {
    width: 80px;
    text-transform: uppercase;
    font-size: 16px;
    letter-spacing: 3px;
    font-weight: bold;
}
#roomInfo { font-size: 13px; line-height: 1.6; }
#roomInfo .code {
    font-size: 26px;
    font-weight: bold;
    color: #ffd740;
    letter-spacing: 6px;
}

/* ---------- toast ---------- */
#toast {
    position: absolute;
    left: 50%;
    top: 46%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .85);
    color: #ffd740;
    font-size: 12px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    z-index: 30;
    white-space: nowrap;
}
