/* ============================================
   NORMIES PIXEL HUNTER – Styles
   ============================================ */

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

body {
    background: #000;
    font-family: 'Press Start 2P', monospace;
    color: #48494b;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

/* ---- Layout ---- */

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    height: 100vh;
}

/* ---- Header ---- */

#header {
    background: #000;
    color: #e3e5e4;
    text-align: center;
    padding: 14px 24px 10px;
    width: 100%;
    border-bottom: 2px solid #48494b;
    flex-shrink: 0;
}

#header h1 {
    font-size: 28px;
    letter-spacing: 6px;
    line-height: 1;
}

#header span {
    font-size: 9px;
    letter-spacing: 8px;
    display: block;
    margin-top: 4px;
}

/* ---- Game Area ---- */

#game-area {
    position: relative;
    border: 2px solid #48494b;
    border-top: none;
    flex-shrink: 0;
}

#game {
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background: #e3e5e4;
}

/* ---- Screens (Overlays) ---- */

.screen {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(227, 229, 228, 0.96);
    z-index: 10;
}

.screen.visible {
    display: flex;
}

.screen-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 90%;
    max-width: 320px;
}

.screen-label {
    font-size: 7px;
    margin-top: 10px;
    letter-spacing: 1px;
}

.screen-title {
    font-size: 16px;
    margin-bottom: 10px;
}

.screen-divider {
    font-size: 6px;
    color: #aaa;
    margin: 10px 0;
}

.screen input[type="text"],
.screen input[type="number"] {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 8px 10px;
    border: 2px solid #48494b;
    background: #fff;
    color: #48494b;
    text-align: center;
    width: 100%;
    outline: none;
}

.screen input::placeholder {
    color: #bbb;
}

.screen input:focus {
    border-color: #000;
}

.screen button {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 8px 18px;
    border: 2px solid #48494b;
    background: #48494b;
    color: #e3e5e4;
    cursor: pointer;
    letter-spacing: 1px;
    transition: background 0.15s;
}

.screen button:hover {
    background: #000;
}

.screen button:active {
    transform: scale(0.97);
}

.btn-alt {
    background: transparent !important;
    color: #48494b !important;
    border: 2px solid #48494b !important;
}

.btn-alt:hover {
    background: #48494b !important;
    color: #e3e5e4 !important;
}

.error {
    font-size: 6px;
    color: #a00;
    min-height: 10px;
    text-align: center;
}

.hint {
    font-size: 6px;
    color: #999;
    display: none;
}

.hint.visible {
    display: block;
    animation: blink 1s steps(2) infinite;
}

/* ---- Game Over ---- */

.gameover-inner {
    gap: 4px !important;
    max-width: 260px !important;
}

#gameover-pfp {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid #48494b;
    background: #fff;
    margin: 2px 0;
}

.go-name {
    font-size: 8px;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

#gameover-stats {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #ccc;
    border: 1px solid #ccc;
    margin: 2px 0 6px;
}

.go-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 4px;
    background: #fff;
    gap: 2px;
}

.go-label {
    font-size: 4px;
    color: #999;
    letter-spacing: 0.5px;
}

.go-val {
    font-size: 8px;
    color: #48494b;
}

.go-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.go-buttons button {
    font-size: 6px;
    padding: 7px 12px;
    flex: 1;
    min-width: 60px;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---- NFT Select Grid ---- */

#normie-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    width: 100%;
}

.normie-option {
    width: 52px;
    height: 52px;
    border: 2px solid #48494b;
    cursor: pointer;
    background: #fff;
    padding: 2px;
    transition: transform 0.1s;
}

.normie-option:hover {
    border-color: #000;
    transform: scale(1.08);
}

.normie-option img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

#preview-img {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid #48494b;
    background: #fff;
}

#preview-label {
    font-size: 7px;
    margin-top: 2px;
}

/* ---- HUD ---- */

#hud {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 2px solid #48494b;
    border-top: none;
    background: #e3e5e4;
    width: 100%;
    flex-shrink: 0;
}

#hud-avatar {
    width: 44px;
    height: 44px;
    border: 2px solid #48494b;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hud-img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: none;
}

#hud-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    min-width: 0;
}

#hud-name {
    font-size: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#hud-score-wrap {
    font-size: 6px;
}

#hud-score-wrap b {
    font-weight: normal;
}

#hud-lives {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.life {
    width: 10px;
    height: 10px;
    background: #48494b;
}

.life.lost {
    background: #ccc;
}

/* ---- Leaderboard ---- */

.login-scroll {
    max-height: 100%;
    overflow-y: auto;
    padding-bottom: 12px;
}

#leaderboard {
    width: 100%;
    margin-top: 4px;
}

#lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 5px;
    letter-spacing: 0.5px;
}

#lb-table thead th {
    font-size: 4px;
    font-weight: normal;
    color: #999;
    padding: 4px 1px;
    text-align: left;
    border-bottom: 1px solid #ccc;
    white-space: nowrap;
}

#lb-table thead th:nth-child(1) { width: 12px; text-align: center; }
#lb-table thead th:nth-child(2) { width: 20px; }
#lb-table thead th:nth-child(4),
#lb-table thead th:nth-child(5),
#lb-table thead th:nth-child(6),
#lb-table thead th:nth-child(7) { text-align: right; }

#lb-body tr {
    border-bottom: 1px solid #e0e0e0;
}

#lb-body td {
    padding: 3px 1px;
    vertical-align: middle;
    font-size: 5px;
}

#lb-body td:nth-child(1) {
    text-align: center;
    color: #999;
    font-size: 5px;
}

#lb-body td:nth-child(4),
#lb-body td:nth-child(5),
#lb-body td:nth-child(6),
#lb-body td:nth-child(7) {
    text-align: right;
    font-size: 4px;
}

.lb-pfp {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 1px solid #48494b;
    background: #fff;
    display: block;
}

#lb-empty {
    text-align: center;
    margin-top: 6px;
    font-size: 5px;
}

/* ---- Gallery / Wall of Normies ---- */

#screen-gallery {
    background: #e3e5e4;
}

#gallery-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

.gallery-title {
    font-size: 8px;
    letter-spacing: 2px;
    padding: 6px 0 4px;
    text-align: center;
}

#wall-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background: #fff;
    border: 1px solid #48494b;
    cursor: crosshair;
    flex-grow: 1;
}

#gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    width: 100%;
    background: #e3e5e4;
    border-top: 1px solid #ccc;
}

.tool-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    padding: 5px 8px;
    border: 1px solid #48494b;
    background: transparent;
    color: #48494b;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.tool-btn:hover {
    background: #48494b;
    color: #e3e5e4;
}

.tool-btn.active {
    background: #48494b;
    color: #e3e5e4;
}

#gallery-balance {
    font-size: 6px;
    flex-grow: 1;
    text-align: center;
    letter-spacing: 1px;
}

/* ---- Responsive ---- */

@media (max-width: 480px) {
    #header h1 { font-size: 20px; letter-spacing: 3px; }
    #header span { font-size: 7px; letter-spacing: 5px; }
    #header { padding: 10px 12px 8px; }
    #hud { padding: 5px 8px; gap: 8px; }
    #hud-avatar { width: 36px; height: 36px; }
    #hud-name { font-size: 6px; }
    #hud-score-wrap { font-size: 5px; }
    .life { width: 8px; height: 8px; }
    .screen-label { font-size: 6px; }
    .screen input { font-size: 6px; padding: 6px 8px; }
    .screen button { font-size: 6px; padding: 6px 14px; }
    .gallery-title { font-size: 6px; }
    .tool-btn { font-size: 4px; padding: 4px 6px; }
    #gallery-balance { font-size: 5px; }
}
