:root {
    --bg-color: #111141;
    --card-bg: rgb(41, 41, 105);
    --accent: #3b82f6;
    --accent-hover: #2666f0;
    --text-main: #f3f4f6;
    --text-muted: #c6cedb;
    --success: #10b981;
    --secondary-accent: #d400ff;
    --secondary-accent-hover: #b000d4;
    --xp-fill: rgb(198, 65, 250);
    --reset: rgb(111, 0, 255);
    --reset-hover: rgb(102, 0, 235);
}

html {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: "VT323", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 3rem 2rem 2rem;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title-row {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.mascot-wrapper {
    position: absolute;
    left: 100%;
    bottom: -12px;
    margin-left: 1rem;
    width: 130px;
    height: 130px;
    flex-shrink: 0;
}

.mascot-body {
    position: absolute;
    inset: 0;
    background-color: var(--accent);
    -webkit-mask-image: url('images/mascot-body.png');
    mask-image: url('images/mascot-body.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    image-rendering: pixelated;
    transition: background-color 0.3s ease;
}

.mascot-details {
    position: absolute;
    inset: 0;
    background-image: url('images/mascot-details.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
}

h1, h2 {
    color: var(--text-main);
    text-align: center;
    font-family: "VT323", serif;
    margin: 0 0 0.5rem;
    letter-spacing: 0.03em;
}

h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
}

h2 {
    font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
}

p.subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: clamp(1.25rem, 2vw + 0.75rem, 1.85rem);
    text-align: center;
    font-family: "VT323", serif;
}

p {
    font-family: "VT323", serif;
    font-size: clamp(1.1rem, 1vw + 0.9rem, 1.35rem);
    line-height: 1.3;
}

.page {
    max-width: 640px;
    margin: 0 auto;
    display: grid;
    grid-template-areas:
        "timer"
        "ambient"
        "stats"
        "actions";
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 820px) {
    .page {
        max-width: 860px;
        grid-template-areas:
            "timer side"
            "actions actions";
        grid-template-columns: 1.3fr 1fr;
    }

    .side-column {
        grid-area: side;
    }
}

.timer-card { grid-area: timer; }
.navbar { grid-area: actions; }

.side-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
}

.side-column > .container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.timer-card,
.container {
    width: 100%;
    padding: 2rem;
    padding-top: 1rem;
    border-radius: 0px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    box-sizing: border-box;
}


.timer-card {
    background-color: color-mix(in srgb, rgb(62, 62, 167) 35%, var(--accent) 35%);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.ambient-container {
    background-color: color-mix(in srgb, rgb(61, 33, 99) 35%, var(--accent) 35%) !important;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.stats-container {
    background-color: color-mix(in srgb, rgb(104, 8, 133) 35%, var(--accent) 35%);
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.navbar {
    background-color: color-mix(
        in srgb,
        rgb(62, 62, 167) 30%,
        color-mix(in srgb, var(--accent) 50%, var(--secondary-accent) 50%) 30%
    );
    padding: 1.25rem;
    border-radius: 0px;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    box-sizing: border-box;
}

.timer-display {
    font-size: clamp(3rem, 8vw + 1rem, 5.5rem);
    font-weight: bold;
    text-align: center;
    margin: 1.5rem 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
    background-color: var(--card-bg);
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0;
    font-size: clamp(1.05rem, 1vw + 0.85rem, 1.3rem);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

button:active {
    transform: scale(0.98);
}

button:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

#start-btn,
#reset-btn {
    flex: 1 1 11rem;
    max-width: 16rem;
}

#start-btn {
    background-color: var(--accent);
    color: white;
}
#start-btn:hover { background-color: var(--accent-hover); }
#start-btn.running { background-color: var(--secondary-accent); }
#start-btn.running:hover { background-color: var(--secondary-accent-hover); }

#reset-btn {
    background-color: var(--reset);
    color: var(--text-main);
}
#reset-btn:hover { background-color: var(--reset-hover); }

.level-panel {
    background-color: var(--card-bg);
    border-radius: 0px;
    padding: 1.35rem 1.5rem;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.level-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.level-badge {
    font-family: "VT323", serif;
    font-size: clamp(1.9rem, 2vw + 1.2rem, 2.4rem);
    font-weight: bold;
    color: var(--accent);
    white-space: nowrap;
}

.level-title {
    font-family: "VT323", serif;
    font-size: clamp(1.3rem, 1.2vw + 0.9rem, 1.6rem);
    color: var(--text-muted);
}

.xp-bar-track {
    width: 100%;
    height: 14px;
    background-color: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: var(--xp-fill);
    border-radius: 999px;
    transition: width 0.4s steps(18, end);
}

.xp-bar-label {
    margin-top: 0.5rem;
    font-size: clamp(1rem, 0.8vw + 0.8rem, 1.2rem);
    color: var(--text-muted);
    font-family: "VT323", serif;
    text-align: right;
}

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

.sound-row {
    display: grid;
    grid-template-columns: minmax(6rem, auto) 1fr;
    align-items: center;
    gap: 0.75rem;
}

.sound-row p {
    white-space: nowrap;
}

.toggle-switch {
    background-color: var(--accent);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0px;
    color: var(--text-main);
    cursor: pointer;
    width: 100%;
    min-width: 0;
    font-size: clamp(0.9rem, 0.8vw + 0.75rem, 1.1rem);
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}
.toggle-switch:hover { 
    background-color: var(--accent-hover); 
}
.toggle-switch.active { 
    background-color: var(--secondary-accent); 
}
.toggle-switch.active:hover { 
    background-color: var(--secondary-accent-hover);
}

.stats-container {
    justify-content: center;
}

.stats-strip {
    display: flex;
    justify-content: space-around;
    background-color: var(--card-bg);
    border-radius: 0px;
    padding: 1rem;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.stats-strip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.stats-strip-value {
    font-family: "VT323", serif;
    font-size: clamp(1.6rem, 2vw + 1rem, 2.1rem);
    color: var(--accent);
    font-weight: bold;
}

.stats-strip-label {
    font-size: clamp(0.95rem, 0.6vw + 0.8rem, 1.1rem);
    color: var(--text-muted);
    font-family: "VT323", serif;
    line-height: 1.3;
}

.navbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.link-btn {
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    flex: 1 1 8rem;
}

.link-btn.link-btn-trophies {
    background-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.link-btn.link-btn-trophies:hover {
    background-color: color-mix(in srgb, var(--accent) 65%, transparent);
}

.link-btn.link-btn-customize {
    background-color: color-mix(in srgb, var(--secondary-accent) 45%, transparent);
}
.link-btn.link-btn-customize:hover {
    background-color: color-mix(in srgb, var(--secondary-accent) 65%, transparent);
}

.link-btn.link-btn-settings {
    background-color: color-mix(in srgb, var(--accent) 30%, var(--secondary-accent) 30%);
}
.link-btn.link-btn-settings:hover {
    background-color: color-mix(in srgb, var(--accent) 45%, var(--secondary-accent) 45%);
}

.settings-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-family: "VT323", serif;
}

.settings-section label {
    font-size: clamp(1.1rem, 1vw + 0.9rem, 1.35rem);
}

input {
    background-color: var(--card-bg);
    color: white;
    font-family: "VT323", serif;
    font-variant-numeric: tabular-nums;
    text-align: center;
    border-style: solid;
    border-width: 0px;
    width: 8.5rem;
    padding: 10px;
    font-size: 1.6rem;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 100;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    position: relative;
    background-color: color-mix(in srgb, rgb(19, 19, 65) 45%, var(--accent) 75%);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);    border: 1px solid rgba(255,255,255,0.1);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    color: var(--text-main);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.4rem 0.7rem;
}
.modal-close:hover {
    background-color: rgba(255,255,255,0.1);
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.badge-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0px; /* Matches your retro 0px theme */
    padding: 1rem;
    text-align: center;
    font-family: inherit;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.badge-card.locked {
    opacity: 0.4;
    border-color: rgba(255, 255, 255, 0.05);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.theme-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: var(--card-bg);
    padding: 0.75rem 1rem;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}

.theme-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.theme-name {
    font-family: "VT323", serif;
    font-size: clamp(1.1rem, 0.8vw + 0.9rem, 1.3rem);
    line-height: 1.3;
}

.theme-action-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    background-color: var(--accent);
    color: var(--text-main);
}
.theme-action-btn:hover { 
    background-color: var(--accent-hover); 
}
.theme-action-btn[disabled] {
    background-color: rgba(255,255,255,0.15);
    color: var(--text-muted);
    cursor: default;
}
.theme-action-btn.selected {
    background-color: var(--secondary-accent);
}

.complete-modal {
    text-align: center;
    background-color: color-mix(in srgb, rgb(19, 19, 65) 45%, var(--secondary-accent) 55%);
    border-radius: 0;
    box-shadow:
        6px 6px 0 0 rgba(0,0,0,0.5),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.15);
}

.complete-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.complete-body {
    font-family: "VT323", serif;
    font-size: clamp(1.1rem, 1vw + 0.9rem, 1.35rem);
    color: var(--text-main);
    margin: 1rem 0 1.5rem;
    line-height: 1.5;
}

.complete-body .complete-xp {
    color: var(--xp-fill);
    font-weight: bold;
}

.complete-body .complete-levelup {
    color: var(--accent);
    font-weight: bold;
    display: block;
    margin-top: 0.5rem;
}

.complete-body .complete-badge {
    color: var(--secondary-accent);
    font-weight: bold;
    display: block;
    margin-top: 0.5rem;
}

.complete-ok-btn {
    background-color: var(--accent);
    color: var(--text-main);
    font-family: "VT323", serif;
    font-size: clamp(1.05rem, 1vw + 0.85rem, 1.3rem);
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow:
        4px 4px 0 0 rgba(0,0,0,0.4),
        inset -2px -2px 0 0 rgba(0,0,0,0.3),
        inset 2px 2px 0 0 rgba(255,255,255,0.2);
}
.complete-ok-btn:hover { 
    background-color: var(--accent-hover); 
}

.micro-5-regular {
  font-family: "Micro 5", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.vt323-regular {
  font-family: "VT323", monospace;
  font-weight: 400;
  font-style: normal;
}