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

body {
    background: #0d1f0d;
    font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
    color: #fff;
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

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

/* ── Top bar ── */
.top-bar {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #0a180a;
    border-bottom: 2px solid #2a5a2a;
    min-height: 54px;
}

/* Left cluster: home + sound + fullscreen */
.top-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 1;
}

.home-button {
    font-size: 20px;
    color: white;
    text-decoration: none;
    background: rgba(0,0,0,0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.home-button:hover { background: rgba(0,0,0,0.4); }

.top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    z-index: 1;
}

.icon-btn {
    font-size: 18px;
    color: #ccc;
    cursor: pointer;
    background: rgba(255,255,255,0.08);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #3a6a3a;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* Title — absolutely centered regardless of side widths */
.title-block {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}
.game-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #7ddd5a;
    text-shadow: 0 0 12px #3a8a20;
    white-space: nowrap;
}

.day-block {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.day-label { font-size: 0.65rem; color: #888; letter-spacing: 1px; text-transform: uppercase; }
.day-num   { font-size: 1.5rem; font-weight: bold; color: #ffd700; min-width: 28px; text-align: center; }
.cycle-track {
    width: 60px; height: 8px;
    background: #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
}
.cycle-bar {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.5s linear, background 0.5s;
}
.cycle-icon  { font-size: 1.3rem; }
.cycle-label { font-size: 0.75rem; color: #bbb; }

/* ── Game canvas ── */
#game-container {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}
#game-container canvas { display: block; }

/* ── Toast ── */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(10, 30, 10, 0.92);
    border: 2px solid #4aaa2a;
    border-radius: 20px;
    padding: 8px 22px;
    font-size: 1rem;
    color: #c8f0a0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    white-space: nowrap;
    z-index: 1000;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Bottom bar ── */
.bottom-bar {
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #0a180a;
    border-top: 2px solid #2a5a2a;
}

/* Help */
.help-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}
.help-row {
    font-size: 0.78rem;
    color: #aaa;
    line-height: 1.4;
}
.help-row strong { color: #ddd; }

.speed-btn {
    margin-top: 6px;
    padding: 5px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    background: #1a3a1a;
    color: #ffe080;
    border: 2px solid #4a8a2a;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.speed-btn:hover  { background: #2a5a2a; }
.speed-btn.active { background: #5a3a00; border-color: #ffaa00; color: #fff; }

/* Stats */
.stats-block {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #122012;
    border: 2px solid #2f6a2f;
    border-radius: 12px;
    padding: 6px 14px;
    min-width: 72px;
    gap: 2px;
}
.stat-icon  { font-size: 1.5rem; }
.stat-label { font-size: 0.6rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-num   { font-size: 1.5rem; font-weight: bold; color: #ffd700; line-height: 1; }

/* ── Fullscreen ── */
:fullscreen #game-wrapper,
:-webkit-full-screen #game-wrapper,
:-moz-full-screen #game-wrapper {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}
:fullscreen .bottom-bar,
:fullscreen footer,
:-webkit-full-screen .bottom-bar,
:-webkit-full-screen footer,
:-moz-full-screen .bottom-bar,
:-moz-full-screen footer {
    display: none;
}
:fullscreen #game-container,
:-webkit-full-screen #game-container,
:-moz-full-screen #game-container {
    flex: 1;
}

/* ── Footer ── */
footer {
    width: 100%;
    text-align: center;
    padding: 8px;
    font-size: 0.7rem;
    color: #555;
}
footer a { color: #7ddd5a; text-decoration: none; }
