@font-face {
    font-family: 'Yolk6';
    src: url('assets/Yolk 6.ttf') format('truetype');
}

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

body {
    background: #7CB342;
    font-family: 'Yolk6', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    font-size: 24pt;
    -webkit-font-smoothing: none;
    font-smooth: never;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #fff;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

h1 {
    font-size: 48pt;
    letter-spacing: 1px;
}

#puzzle-name {
    font-weight: bold;
    font-size: 36pt;
}

#title span,
.wobble-char {
    display: inline-block;
    white-space: pre;
}
#seed-counter {
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 24pt;
    line-height: 1;
}

#seed-counter::first-letter {
    font-size: 16pt;
}

#game-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

#game-canvas {
    border: none;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: default;
    max-width: 100%;
    height: auto;
    display: block;
}

#game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 24pt;
}

#instructions {
    opacity: 0.8;
    font-size: 22pt;
    font-style: italic;
}

#coverage-info {
    font-weight: bold;
}

#game-controls {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

button {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 24pt;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Yolk6', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    transition: background 0.2s, transform 0.1s;
}

button:hover:not(:disabled) {
    transform: scale(1.05);
}

button:active:not(:disabled) {
    transform: scale(0.97);
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

#btn-undo {
    background: #ffb74d;
    color: #3e2723;
}

#btn-reset {
    background: #ef5350;
    color: #fff;
}

#btn-submit {
    background: #66bb6a;
    color: #fff;
}

#btn-next {
    background: #42a5f5;
    color: #fff;
    font-size: 32pt;
    padding: 10px 24px;
}

#result-panel {
    text-align: center;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#result-text {
    font-size: 40pt;
    margin-bottom: 12px;
    font-weight: bold;
}

#best-score-info {
    font-weight: bold;
}

.reveal-btn {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 2px 12px;
    font-size: 22pt;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-weight: normal;
    font-family: 'Yolk6', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

.reveal-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ── Loading state ──────────────────────────────────────────────────────── */
#loading-state {
    font-size: 28pt;
    opacity: 0.7;
    font-style: italic;
    padding: 40px 0;
}

/* ── Puzzle header adjustments ───────────────────────────────────────────── */
#puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    font-size: 28pt;
    box-sizing: border-box;
}

#header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 2px 10px;
    font-size: 22pt;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ── Day navigation ──────────────────────────────────────────────────────── */
#day-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

#day-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
    justify-content: center;
}

#day-label {
    font-size: 24pt;
    font-weight: bold;
}

.today-badge {
    background: #ffb74d;
    color: #3e2723;
    font-size: 14pt;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.day-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 16px;
    font-size: 22pt;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-family: 'Yolk6', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
}

.day-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.35);
}

/* ── Stats modal ─────────────────────────────────────────────────────────── */
#stats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
}

#stats-modal {
    position: fixed;
    inset: 0;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#stats-inner {
    background: #2e7d32;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 28px 32px;
    min-width: 300px;
    max-width: 90vw;
    pointer-events: all;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.stats-title {
    font-size: 28pt;
    font-weight: bold;
    text-align: center;
}

.stats-count,
.stats-sub,
.stats-you,
.stats-loading,
.stats-error {
    font-size: 22pt;
    text-align: center;
    opacity: 0.9;
}

.stats-you {
    font-weight: bold;
    color: #ffb74d;
}

.stats-chart-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-bars {
    display: flex;
    align-items: flex-end;
    height: 100px;
    gap: 2px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 2px;
}

.stat-bar-col {
    flex: 1;
    display: flex;
    align-items: flex-end;
    height: 100%;
    min-width: 4px;
}

.stat-bar {
    width: 100%;
    background: #66bb6a;
    border-radius: 2px 2px 0 0;
    min-height: 4px;
}

.stat-bar.mine {
    background: #ffb74d;
}

.stats-axis {
    display: flex;
    justify-content: space-between;
    font-size: 16pt;
    opacity: 0.7;
}

.stats-axis-label {
    font-size: 14pt;
    opacity: 0.6;
}

#btn-close-stats {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24pt;
    padding: 8px 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ── Calendar / puzzle overview modal ───────────────────────────────────── */
#calendar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
}

#calendar-modal {
    position: fixed;
    inset: 0;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#calendar-inner {
    background: #2e7d32;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 28px 32px;
    width: min(600px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    pointer-events: all;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#calendar-title {
    font-size: 32pt;
    font-weight: bold;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    width: 100%;
}

.cal-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: left;
    font-family: 'Yolk6', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    transition: transform 0.1s, background 0.15s;
}

.cal-card:hover {
    transform: scale(1.04);
}

.cal-unplayed {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.cal-played {
    background: rgba(102, 187, 106, 0.3);
    border-color: #66bb6a;
    color: #fff;
}

.cal-today {
    border-color: #ffb74d;
}

.cal-current {
    background: rgba(255, 183, 77, 0.25);
    border-color: #ffb74d;
}

.cal-day-num {
    font-size: 14pt;
    opacity: 0.7;
}

.cal-name {
    font-size: 20pt;
    font-weight: bold;
    line-height: 1.1;
}

.cal-status {
    font-size: 16pt;
    opacity: 0.85;
    font-style: italic;
}

#btn-close-calendar {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24pt;
    padding: 8px 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}