/* pocket arcade */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #1a1a2e;
    --text: #eee;
    --muted: #888;
    --accent: #4ecca3;
}

body {
    font-family: monospace;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.4;
}

/* hauptseite */
main {
    max-width: 400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    text-align: center;
}

main h1 {
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
}

.games {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.games a {
    display: block;
    padding: 1rem 1.5rem;
    border: 2px solid var(--accent);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.games a:active {
    background: var(--accent);
    color: var(--bg);
}

.hint {
    margin-top: 3rem;
    font-size: 0.7rem;
    color: var(--muted);
}

/* spiele-seiten */
.game-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.back-btn {
    color: var(--muted);
    text-decoration: none;
}

.back-btn:active {
    color: var(--text);
}

.game-title {
    font-size: 1rem;
    font-weight: normal;
}

.score-display {
    color: var(--accent);
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.game-canvas {
    border: 2px solid var(--accent);
    touch-action: none;
    max-width: 100%;
}

/* buttons */
.control-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.control-btn:active {
    background: var(--accent);
    color: var(--bg);
}

.game-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

/* d-pad snake */
.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 4px;
}

.d-pad-btn {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.d-pad-btn:active {
    background: var(--accent);
    color: var(--bg);
}

.d-pad-btn.empty {
    border: none;
    pointer-events: none;
}

/* touch controls space invaders */
.touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 350px;
    padding: 0 1rem;
}

.move-buttons {
    display: flex;
    gap: 0.5rem;
}

.touch-btn {
    width: 60px;
    height: 60px;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.touch-btn:active {
    background: var(--accent);
    color: var(--bg);
}

.fire-btn {
    width: 70px;
    height: 70px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

/* game over */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 100;
}

.game-over-overlay.hidden {
    display: none;
}

.game-over-title {
    font-size: 1.5rem;
    font-weight: normal;
}

.game-over-score {
    font-size: 1rem;
    color: var(--muted);
}

/* minesweeper */
.minesweeper-grid {
    display: grid;
    gap: 2px;
    touch-action: manipulation;
}

.mine-cell {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.mine-cell:active {
    opacity: 0.7;
}

.mine-cell.revealed {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
}

.mine-cell.flagged {
    background: rgba(78, 204, 163, 0.3);
}

.mine-cell.mine {
    background: rgba(255, 100, 100, 0.5);
}

.mine-cell[data-number="1"] { color: #6be; }
.mine-cell[data-number="2"] { color: #6e6; }
.mine-cell[data-number="3"] { color: #e66; }
.mine-cell[data-number="4"] { color: #a6e; }
.mine-cell[data-number="5"] { color: #ea6; }
.mine-cell[data-number="6"] { color: #6ea; }
.mine-cell[data-number="7"] { color: #eee; }
.mine-cell[data-number="8"] { color: #888; }

.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.difficulty-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--muted);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}

.difficulty-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 350px;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* mobile */
@media (max-width: 360px) {
    main h1 {
        font-size: 1.2rem;
    }

    .games a {
        font-size: 0.8rem;
        padding: 0.8rem 1rem;
    }

    .mine-cell {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .d-pad {
        grid-template-columns: repeat(3, 45px);
        grid-template-rows: repeat(3, 45px);
    }
}

/* kein text markieren */
* {
    -webkit-user-select: none;
    user-select: none;
}

/* landscape warning */
.landscape-warning {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

@media (orientation: landscape) and (max-height: 500px) {
    .landscape-warning {
        display: flex;
    }
}

.landscape-warning p {
    font-size: 0.9rem;
    color: var(--muted);
}
