:root {
    --bg-color: #050505;
    --card-bg: #0a0a0a;
    --text-primary: #f0f0f0;
    --text-secondary: #999;
    --accent: #ffffff;
    --accent-dim: #333;
    --gold: #D4AF37;
    /* Used sparingly for mastery */
    --danger: #8b0000;

    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling in app-like feel */
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* --- Typography --- */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-top: 1rem;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* --- Buttons --- */
button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    transition: all 0.3s var(--ease-out);
    padding: 1rem 2rem;
    margin-top: 1rem;
}

.btn-ghost {
    border: 1px solid var(--accent-dim);
    color: var(--text-primary);
}

.btn-ghost:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.btn-solid {
    background: var(--text-primary);
    color: var(--bg-color);
    font-weight: 600;
}

.btn-solid:hover {
    background: #fff;
}

/* --- Theme Toggle --- */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    padding: 0.8rem;
    margin: 0;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-dim);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s var(--ease-out), opacity 0.5s var(--ease-out);
}

.theme-toggle:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.theme-toggle svg {
    transition: transform 0.5s var(--ease-out);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.btn-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.btn-text:hover {
    color: var(--text-primary);
}

.btn-gold {
    border: 1px solid var(--gold);
    color: var(--gold);
    margin-bottom: 1rem;
}

.btn-gold:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    font-weight: 600;
}

.btn-danger:hover {
    background: #a30000;
}

/* Constant Red Button (Stays red even when inverted) */
.btn-red {
    border: 1px solid #ff4444 !important;
    color: #ff4444 !important;
    font-weight: 600;
}

.btn-red:hover {
    background: rgba(255, 68, 68, 0.1) !important;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

.light-theme .btn-red {
    filter: invert(1) hue-rotate(180deg);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
    margin-top: 0;
}

.credit-link {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
    border-bottom: 1px transparent;
}

.credit-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.credit-footer {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    margin-top: 3rem;
    opacity: 0.6;
    text-transform: uppercase;
}

/* --- Views & Transitions --- */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s var(--ease-out);
    padding: 2rem;
    overflow-y: auto;
    z-index: 1;
}

.view.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Specific view overrides */
#view-dashboard {
    padding-top: 0;
    /* Header will handle its own top padding to stay stuck to top edge */
}

/* Priority Utilities */
.hidden {
    display: none !important;
}

.center-content {
    margin: auto;
    text-align: center;
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.text-left {
    text-align: left !important;
    align-items: flex-start !important;
}

.intro-manifesto {
    max-width: 700px;
}

.philosophy-text {
    margin: 2rem 0;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.philosophy-text p {
    margin-bottom: 1.5rem;
}

.mastery-note {
    border-top: 1px solid var(--accent-dim);
    margin-top: 2rem;
    padding-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--gold);
    opacity: 0.8;
}

.mastery-note h4 {
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

/* --- Splash --- */
.fade-in {
    opacity: 0;
    animation: fadeIn 1.5s var(--ease-out) forwards;
}

.delay-1 {
    animation-delay: 0.5s;
}

.delay-2 {
    animation-delay: 1.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Dashboard --- */
.dashboard-header {
    width: 100%;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 2rem 0 1.5rem 0;
    border-bottom: 1px solid var(--accent-dim);
    margin-bottom: 3rem;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

.data-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    max-width: 1000px;
    margin: 1rem auto 0 auto;
    padding: 0 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-primary);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Responsive Grid */
    gap: 1.5rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 4rem;
}

/* Hide scrollbar for cleaner look */
.levels-grid::-webkit-scrollbar {
    width: 4px;
}

.levels-grid::-webkit-scrollbar-thumb {
    background: var(--accent-dim);
}

/* --- Session Logs Section --- */
.sessions-log-container {
    max-width: 800px;
    width: 100%;
    margin: 3rem auto 0 auto;
    border-top: 1px solid var(--accent-dim);
    padding-top: 2rem;
}

.log-header {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: left;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-entry {
    background: #080808;
    border: 1px solid #111;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.log-level {
    color: var(--text-primary);
    font-weight: 600;
}

.log-meta {
    display: flex;
    gap: 2rem;
}

.log-date {
    color: var(--text-secondary);
}

.log-duration {
    color: var(--gold);
}

.level-card {
    background: var(--card-bg);
    border: 1px solid var(--accent-dim);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.manual-adjust {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s var(--ease-out);
}

.level-card:hover .manual-adjust {
    opacity: 1;
    transform: translateY(0);
}

.btn-adjust {
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--accent-dim);
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    border-radius: 4px;
}

.btn-adjust:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-minus:hover {
    color: #ff4444;
    border-color: #ff4444;
}

.btn-plus:hover {
    color: #44ff44;
    border-color: #44ff44;
}

.btn-custom:hover {
    color: var(--gold);
    border-color: var(--gold);
}

.level-number-tag {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    opacity: 0.8;
}

.level-card:hover:not(.locked) {
    border-color: var(--text-primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.level-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.level-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.level-icon svg {
    width: 100%;
    height: 100%;
}

.level-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* --- Practice View --- */
#view-practice {
    background: black;
    cursor: none;
    /* Hide cursor logic handled by JS class mostly, but CSS backup */
    display: flex;
    justify-content: center;
    align-items: center;
}

#shape-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s ease;
    /* Subtle movement possibility */
}

/* The Shapes in Practice Mode (Scaled Up) */
.practice-shape {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.practice-shape svg {
    width: 80vmin;
    height: 80vmin;
    overflow: visible;
}

.p-sigil {
    max-width: 90vmin;
    max-height: 90vmin;
    object-fit: contain;
}

/* Sigil Upload UI */
.sigil-upload-container {
    margin-top: 1.5rem;
    border: 1px dashed var(--accent-dim);
    padding: 2rem;
    text-align: center;
    transition: border-color 0.3s;
}

.sigil-upload-container:hover {
    border-color: var(--text-primary);
}

.sigil-preview-mini {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin: 1rem auto;
    border: 1px solid var(--accent-dim);
    display: none;
}

.sigil-preview-mini.active {
    display: block;
}

input[type="file"] {
    display: none;
}

.file-label {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    text-decoration: underline;
}

/* Modals */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.custom-input-wrap {
    margin: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-bottom: 1px solid var(--accent-dim);
    padding-bottom: 0.5rem;
}

.custom-input-wrap input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 2.5rem;
    width: 120px;
    text-align: center;
    outline: none;
}

.input-unit {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.modal {
    background: var(--card-bg);
    border: 1px solid var(--danger);
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.modal h3 {
    color: var(--danger);
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.modal-actions button {
    margin: 0;
    width: 100%;
}

.session-summary {
    margin: 2rem 0;
    font-family: var(--font-mono);
    border: 1px solid var(--accent-dim);
    padding: 1.5rem;
    background: #080808;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.summary-value {
    color: var(--text-primary);
}

/* --- Card Info Button --- */
.btn-card-info {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 1px solid var(--accent-dim);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s var(--ease-out);
    z-index: 10;
}

.level-card:hover .btn-card-info,
.level-card:focus-within .btn-card-info {
    opacity: 1;
    transform: scale(1);
}

.btn-card-info:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.btn-card-info:active {
    transform: scale(0.95);
}

/* --- Goal Progress in Header --- */
.stat-item-goal {
    flex: 1;
    max-width: 200px;
    margin: 0 1.5rem;
}

.goal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.btn-edit-goal {
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.btn-edit-goal:hover {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.goal-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.goal-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--accent-dim);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.goal-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), #f0c040);
    border-radius: 3px;
    transition: width 0.6s var(--ease-out);
    position: relative;
}

.goal-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.goal-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.level-goal-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gold);
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* --- Toggle Switch --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--accent-dim);
    transition: all 0.3s var(--ease-out);
    border-radius: 26px;
    border: 1px solid transparent;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: all 0.3s var(--ease-out);
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: rgba(212, 175, 55, 0.3);
    border-color: var(--gold);
}

input:checked+.toggle-slider::before {
    transform: translateX(22px);
    background-color: var(--gold);
}

input:focus+.toggle-slider {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

/* --- Goal Toggle Row --- */
.goal-toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.goal-toggle-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* --- Session Goal Settings --- */
.session-goal-settings {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--accent-dim);
    background: rgba(0, 0, 0, 0.3);
}

.session-goal-input-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: all 0.3s var(--ease-out);
}

.session-goal-input-wrap input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--accent-dim);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    width: 80px;
    text-align: center;
    padding: 0.3rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.session-goal-input-wrap input:focus {
    border-color: var(--gold);
}

/* --- Goal Modal Styling --- */
.goal-modal {
    border-color: var(--gold) !important;
}

.goal-modal h3 {
    color: var(--gold) !important;
}

/* --- Celebration Modal --- */
.celebration-modal {
    border-color: var(--gold) !important;
    text-align: center;
    animation: celebrationPop 0.5s var(--ease-out);
}

@keyframes celebrationPop {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    50% {
        transform: scale(1.02) translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.celebration-modal h2 {
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.celebration-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.celebration-icon.trophy {
    animation: trophy-bounce 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes trophy-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.celebration-sub {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* --- Enhanced Button Interactions --- */
button {
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

button:active::after {
    width: 200px;
    height: 200px;
}

.btn-solid:active,
.btn-ghost:active,
.btn-gold:active {
    transform: scale(0.97);
}

/* --- Card Pulse Animation on Hover --- */
.level-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    transition: all 0.3s var(--ease-out);
    pointer-events: none;
}

.level-card:hover::before {
    border-color: var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

/* --- Mobile Touch Feedback --- */
@media (hover: none) {
    .level-card:active {
        transform: scale(0.98);
        border-color: var(--text-primary);
    }

    .btn-card-info {
        opacity: 0.7;
        transform: scale(1);
    }

    .manual-adjust {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .levels-grid {
        grid-template-columns: 1fr;
    }

    .p-circle,
    .p-square {
        width: 80vmin;
        height: 80vmin;
    }

    .p-triangle {
        border-left-width: 40vmin;
        border-right-width: 40vmin;
        border-bottom-width: 70vmin;
    }

    .p-triangle::after {
        left: calc(-40vmin + 2px);
        border-left-width: calc(40vmin - 2px);
        border-right-width: calc(40vmin - 2px);
        border-bottom-width: calc(70vmin - 4px);
    }

    .p-triangle .mid-dot {
        top: 45vmin;
    }

    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        padding: 0.7rem;
    }

    /* Goal header adjustments for mobile */
    .stats-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    .stat-item-goal {
        order: -1;
        max-width: 100%;
        margin: 0;
        padding: 1rem;
        background: rgba(212, 175, 55, 0.05);
        border: 1px solid var(--accent-dim);
        border-radius: 4px;
    }

    .goal-progress-bar {
        height: 8px;
    }

    .data-actions {
        justify-content: center;
        padding: 0 1rem;
    }

    /* Modal adjustments for mobile */
    .modal {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .celebration-icon {
        font-size: 3rem;
    }

    .celebration-modal h2 {
        font-size: 1.4rem;
    }

    /* Session goal settings mobile */
    .session-goal-settings {
        padding: 1rem;
    }

    .goal-toggle-row {
        flex-wrap: wrap;
    }

    .goal-toggle-label {
        font-size: 0.75rem;
    }

    /* Touch-friendly button sizes */
    .btn-adjust {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .btn-card-info {
        width: 32px;
        height: 32px;
        opacity: 1;
        transform: scale(1);
    }

    /* Ensure modals fit properly on small screens */
    .custom-input-wrap input {
        font-size: 2rem;
        width: 100px;
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    .modal {
        padding: 1.5rem 1rem;
    }

    .modal-actions button {
        padding: 0.8rem 1rem;
        font-size: 0.7rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .stat-value {
        font-size: 1rem;
    }
}

/* Level Settings Modal */
.level-settings-modal {
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

.level-settings-modal h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--accent-dim);
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.time-input-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.time-input-group.single {
    justify-content: center;
}

.time-input-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.time-input-item input {
    width: 80px;
    padding: 0.8rem;
    font-size: 1.5rem;
    font-family: var(--font-mono);
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-dim);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.time-input-item input:focus {
    outline: none;
    border-color: var(--gold);
}

.time-input-item .input-unit {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.time-adjust-controls {
    text-align: center;
}

.adjust-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.btn-adjust-action {
    padding: 0.8rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s var(--ease-out);
    margin: 0;
}

.btn-add {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #81c784;
}

.btn-add:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: #81c784;
}

.btn-subtract {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #e57373;
}

.btn-subtract:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: #e57373;
}

.current-total {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.current-total span {
    color: var(--text-primary);
    font-weight: 600;
}

.level-practice-progress {
    margin-top: 1rem;
}

.level-practice-progress .progress-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.level-practice-progress .progress-text span {
    color: var(--text-primary);
}

/* Modal scrollbar styling */
.level-settings-modal::-webkit-scrollbar {
    width: 6px;
}

.level-settings-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.level-settings-modal::-webkit-scrollbar-thumb {
    background: var(--accent-dim);
    border-radius: 3px;
}

.level-settings-modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile adjustments for level settings modal */
@media (max-width: 480px) {
    .level-settings-modal {
        max-width: 100%;
        margin: 0.5rem;
    }

    .time-input-item input {
        width: 70px;
        font-size: 1.3rem;
        padding: 0.6rem;
    }

    .adjust-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-adjust-action {
        width: 100%;
    }

    .section-title {
        font-size: 0.75rem;
    }
}

/* Level 6 Custom Icon */
.level-custom {
    background: linear-gradient(135deg, var(--gold), #fff);
    -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M50 0L95 25V75L50 100L5 75V25L50 0Z"/></svg>') no-repeat center / contain;
    mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M50 0L95 25V75L50 100L5 75V25L50 0Z"/></svg>') no-repeat center / contain;
}

/* Custom Config UI */
.custom-config-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--accent-dim);
    border-radius: 8px;
}

.config-header {
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 0.15em;
}

.config-section {
    margin-bottom: 1.5rem;
}

.config-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
    justify-items: center;
}

.shape-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--accent-dim);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px;
    margin: 0;
}

.shape-btn:hover {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.shape-btn.selected {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.shape-btn svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
}

.shape-btn.selected svg {
    stroke: var(--gold);
}

.anim-toggles {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    flex-wrap: wrap;
}

.anim-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.anim-check input {
    display: none;
}

.anim-box {
    width: 18px;
    height: 18px;
    border: 1px solid var(--accent-dim);
    border-radius: 3px;
    display: inline-block;
    transition: all 0.2s;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
}

.anim-check input:checked+.anim-box {
    background: var(--gold);
    border-color: var(--gold);
}

.anim-check input:checked+.anim-box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 8px;
    border: solid var(--card-bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.anim-label {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.anim-check:hover .anim-label {
    color: var(--text-primary);
}

/* Animations */
@keyframes anim-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes anim-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

@keyframes anim-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Application Classes */
.anim-wrapper-blink {
    animation: anim-blink 3s infinite ease-in-out;
}

.anim-wrapper-bounce {
    animation: anim-bounce 4s infinite ease-in-out;
}

.anim-wrapper-rotate {
    animation: anim-rotate 12s infinite linear;
    transform-origin: center;
}

/* Responsive */
@media (max-width: 480px) {
    .shape-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
    }

    .shape-btn {
        width: 36px;
        height: 36px;
    }

    .anim-toggles {
        justify-content: space-between;
    }
}