.top-nav {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
}

.top-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95em;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    display: inline-block;
}

.top-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffd700;
}

@media (max-width: 1024px) {
    .top-nav {
        position: static;
        padding: 12px 0 0 12px;
    }
}

html {
    background-color: aquamarine;
}

h2 {
    text-align: center;
}

/* ── PAGE LAYOUT ──────────────────────────────────────────────────── */

h1 {
    text-align: center;
    font-family: sans-serif;
    margin-top: 60px;
    font-family: 'Press Start 2P', monospace;
    font-size: 3rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #e8fff8;
    -webkit-text-stroke: 2px #0a3d28;
    paint-order: stroke fill;
    text-shadow:
        2px  2px 0 #5ecba8,
        3px  3px 0 #50c09d,
        4px  4px 0 #42b592,
        5px  5px 0 #34aa87,
        6px  6px 0 #269f7c,
        7px  7px 0 #189471,
        8px  8px 0 #0a8966,
        9px  9px 0 #007e5b,
        10px 10px 0 #006e4e,
        11px 11px 20px rgba(0,0,0,0.5);
}

.instructions-box {
    max-width: 700px;
    margin: 0 auto 32px;
    padding: 16px 24px;
    background: rgba(255,255,255,0.55);
    border: 2px solid #2a7a5a;
    border-radius: 10px;
    font-family: sans-serif;
    font-size: 1rem;
    text-align: center;
    color: #1a3a2a;
    backdrop-filter: blur(4px);
}

.level {
    max-width: 900px;
    margin: 0 auto 48px;
    padding: 0 16px;
}

.level h2 {
    font-family: sans-serif;
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #1a3a2a;
}

.puzzle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    justify-content: center;
    align-items: flex-start;
}

.grid-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-wrap h3 {
    font-family: sans-serif;
    font-size: 1rem;
    color: #1a3a2a;
    margin-bottom: 8px;
}

.hex-grid {
    display: block;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin-top: 16px;
}

.check-btn {
    padding: 8px 28px;
    font-size: 1rem;
    font-family: sans-serif;
    background: #2a7a5a;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.check-btn:hover {
    background: #1a5a3a;
}

.check-result {
    font-family: sans-serif;
    font-size: 1rem;
    font-weight: bold;
    min-height: 1.4em;
}

.check-result.correct   { color: #1a5a2a; }
.check-result.incorrect { color: #8a2000; }

/* ── CLEAR BUTTON ────────────────────────────────────────────────── */

.clear-btn {
    position: relative;
    overflow: hidden;
    padding: 8px 28px;
    font-size: 1rem;
    font-family: sans-serif;
    background: #8a2000;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.clear-btn:hover {
    background: #6a1500;
}

.clear-bar {
    position: absolute;
    inset: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    transition: none;
}

.clear-btn.holding .clear-bar {
    width: 100%;
    transition: width 3s linear;
}

.clear-btn.holding {
    background: #c04000;
}

/* ── SVG CELL STYLES ─────────────────────────────────────────────── */

.hex-outline {
    fill: none;
    stroke: #2a7a5a;
    stroke-width: 2;
}

.hex-spoke {
    stroke: #2a7a5a;
    stroke-width: 0.8;
    opacity: 0.5;
}

.cell-empty {
    fill: rgba(255,255,255,0.6);
    stroke: none;
    transition: fill 0.15s;
}

.cell-empty:hover {
    fill: rgba(180,240,210,0.85);
}

.cell-given {
    fill: rgba(180,220,200,0.75);
    stroke: none;
}

.cell-selected {
    fill: rgba(100,200,150,0.85) !important;
    stroke: #1a5a3a;
    stroke-width: 1.5;
}

.tri-label, .tri-label-given {
    font-family: sans-serif;
    font-size: 11px;
    pointer-events: none;
    user-select: none;
}

.tri-label       { fill: #1a3a2a; }
.tri-label-given { fill: #0a2010; font-weight: bold; }

/* ── DIRECTION TINTS (Level 2) ───────────────────────────────────── */

.hex-tint-cw {
    fill: rgba(120, 190, 255, 0.45);
    stroke: none;
    pointer-events: none;
}

.hex-tint-ccw {
    fill: rgba(255, 120, 120, 0.45);
    stroke: none;
    pointer-events: none;
}

/* ── INNER HEXAGON OUTLINES (Level 3) ────────────────────────────── */

.inner-hex-outline {
    fill: none;
    stroke: #0055ff;
    stroke-width: 3.5;
    stroke-linejoin: round;
    pointer-events: none;
}

/* ── MOBILE NUMBER BAR ─────────────────────────────────────────────── */

#mobile-numbar {
    display: none;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 500;
    flex-direction: column;
    gap: 6px;
    padding: 8px 6px;
    background: rgba(255, 255, 255, 0.92);
    border-left: 2px solid #2a7a5a;
    border-radius: 12px 0 0 12px;
    backdrop-filter: blur(8px);
    box-shadow: -4px 0 18px rgba(0, 0, 0, 0.18);
}

@media (max-width: 600px) {
    #mobile-numbar.numbar-visible {
        display: flex;
    }
}

.numbar-btn {
    width: 44px;
    flex: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a7a5a;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.numbar-btn svg {
    width: 20px;
    height: auto;
    fill: currentColor;
}

.numbar-btn:active {
    background: #1a5a3a;
    transform: scale(0.95);
}

.numbar-clear {
    background: #8a2000;
}

.numbar-clear:active {
    background: #6a1500;
}

#mobile-numbar.numbar-left {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 2px solid #2a7a5a;
    border-radius: 0 12px 12px 0;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.18);
}

#lefty-btn {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    right: auto;
    z-index: 600;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.92);
    color: #2a7a5a;
    border: 2px solid #2a7a5a;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#lefty-btn.btn-left {
    left: auto;
    right: 10px;
}

@media (max-width: 600px) {
    #lefty-btn.btn-visible {
        display: block;
    }

    #lefty-btn:active {
        background: #2a7a5a;
        color: #fff;
    }
}