
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@400;700&display=swap');

:root {

    --theme-bg-1: #6aa84f; 
    --theme-bg-2: #8b5a2b; 
    --accent-1: #b08932; 
    --accent-2: #3b6ea0; 
    --accent-3: #9e8f7a; 
    --text-dark: #111111;
    --card-bg: #f0ebda; 
    --block-grass: #4caf50;
    --block-dirt: #8b5a2b;
    --block-stone: #bdbdbd;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', monospace;
}

body {
    background-color: #7fb16e;
    background-image: url('assets/bg_full.png'), url('assets/bg_tiles.png'), linear-gradient(180deg,var(--theme-bg-1),var(--theme-bg-2));
    background-repeat: no-repeat, repeat, no-repeat;
    background-size: cover, auto, auto;
    background-attachment: fixed, scroll, scroll;
    min-height: 100vh;
    padding: 20px;
    image-rendering: crisp-edges;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(180deg, var(--card-bg), #fff);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header h1 { font-family: 'Press Start 2P', monospace; letter-spacing: 1px; }
.header h2 { font-family: 'Press Start 2P', monospace; font-weight: 700; font-size: 0.9rem; color: var(--text-dark); }

.header h2 {
    color: #666;
    font-size: 1.5em;
}

.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.exercise-card {
    background: linear-gradient(180deg,#fffdf5,#fff6e0);
    border: 3px solid rgba(0,0,0,0.06);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.exercise-card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: var(--accent-1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.exercise-card.completed {
    background: linear-gradient(180deg,#eafaf0,#d4f7dc);
    border-color: #28a745;
}

.exercise-card.completed::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.exercise-problem {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.vertical-problem {
    display: inline-block;
    text-align: right;
    font-weight: 800;
    color: var(--text-dark);
    font-family: 'Press Start 2P', monospace;
    padding: 6px 10px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.03));
    box-shadow: 0 6px 18px rgba(0,0,0,0.06) inset;
}
.vertical-problem .vp-row {
    min-width: 120px;
    padding: 6px 8px;
    font-size: 1.6em;
}
 .vertical-problem .vp-top { margin-bottom: 2px; }
.vertical-problem .vp-bottom {
     font-size: 1.6em;
     display: flex;
     justify-content: flex-end;
     align-items: center;
     border-bottom: 3px solid #333;
     padding-bottom: 8px;
}
 .vertical-problem .vp-operator {
     display: inline-block;
     margin-right: 8px;
     font-size: 1.4em;
     font-weight: bold;
     color: var(--accent-1);
 }
.vertical-problem .vp-number {
    display: inline-block;
}

.vertical-problem {
    font-family: 'Press Start 2P', monospace;
}
.vertical-problem .vp-row {
    box-sizing: border-box;
    display: block;
    width: 100%;
    font-size: clamp(0.95rem, 2.6vw, 1.4rem);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}
.vertical-problem .vp-number, .vertical-problem .vp-operator {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.05em;
}

.modal-problem .vp-row { min-width: 180px; font-size: clamp(1.4rem, 4.0vw, 2.2rem); }

#userAnswer {
    font-family: 'Roboto', monospace;
    font-size: clamp(1rem, 3.5vw, 1.6rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: right;
}

.vertical-problem.pressstart .vp-row { font-size: clamp(0.8rem, 2.2vw, 1.2rem); }

.modal-problem {
    text-align: right; 
    margin: 12px 0 18px 0; 
}

.modal-problem .vp-row { min-width: 260px; }

.exercise-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-open .exercises-grid {
    display: none;
}

.modal-open .container > div[style] {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-problem {
    font-size: 3em;
    font-weight: bold;
    margin: 30px 0;
    color: #333;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto 20px;
}

.number-btn {
    background: #7f7f7f;
    color: #efefef;
    border: 3px solid #2b2b2b;
    border-radius: 4px;
    padding: 10px;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
    box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.06);
}

.number-btn:hover { filter: brightness(0.95); transform: translateY(-1px); }

.number-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.45); }

.control-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.btn {
    padding: 12px 18px;
    border: 3px solid #2b2b2b;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
    font-family: 'Press Start 2P', monospace;
    background: #7f7f7f;
    color: #efefef;
    box-shadow: 0 4px 0 rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.06);
}

.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.45); }

.btn-primary {
    background: #7f7f7f;
    color: #efefef;
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
    background: #6f6f6f;
    color: #f6f6f6;
}

.btn-secondary:hover { filter: brightness(1.04); }

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn[disabled], .number-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(20%);
}

.user-answer {
    text-align: right;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.6rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-dark);
    letter-spacing: 1px;
}

.power-gauge {
    position: absolute;
    left: 12px;
    top: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--accent-3), transparent 35%), linear-gradient(135deg, var(--accent-1), var(--accent-2));
    box-shadow: 0 6px 18px rgba(255,165,0,0.2), 0 0 18px rgba(255,200,50,0.08) inset;
}

.ki-aura { position: absolute; inset: 0; pointer-events: none; }
.ki-aura::after { content: ''; position: absolute; inset: -20%; background: radial-gradient(circle, rgba(255,255,255,0.06), transparent 20%); animation: pulseAura 2.2s infinite; }
@keyframes pulseAura { 0% { transform: scale(0.98); opacity: 0.9 } 50% { transform: scale(1.02); opacity: 0.6 } 100% { transform: scale(0.98); opacity: 0.9 } }

.progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg,var(--block-grass),#6aa84f);
    height: 100%;
    transition: width 0.3s ease;
}

.logout-btn {
    background: #7f7f7f;
    color: #efefef;
    border: 3px solid #2b2b2b;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    margin-top: 20px;
    font-family: 'Press Start 2P', monospace;
    box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.06);
}

.logout-btn:hover { filter: brightness(1.05); }

.logout-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.45); }

.login-container, .register-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.login-container h1, .register-container h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.submit-btn {
    width: 100%;
    background: #7f7f7f;
    color: #efefef;
    border: 3px solid #2b2b2b;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.06);
}

.submit-btn:hover { filter: brightness(1.05); }

.submit-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.45); }

.link {
    color: var(--block-stone);
    text-decoration: none;
    margin-top: 20px;
    display: inline-block;
}

.link:hover { text-decoration: underline; }

.pixel-img { image-rendering: pixelated; image-rendering: crisp-edges; }

.card-deco { width: 48px; height: 48px; image-rendering: pixelated; }

.mode-container {
    max-width: 720px;
    margin: 80px auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    text-align: center;
}
.mode-container h1 { font-size: 2rem; margin-bottom: 6px; color: #333; }
.mode-container p { color: #555; margin-bottom: 18px; }
.mode-grid {
    display: flex;
    flex-wrap: wrap;
    margin-top: 8px;
    gap: 14px;      
    grid-gap: 14px;  
    
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}
.mode-btn {
    padding: 0 14px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 4px;
    border: 3px solid #2b2b2b;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
    box-shadow: 0 4px 0 rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.06);
    color: #efefef;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    font-family: 'Press Start 2P', monospace;
    background: #7f7f7f;
}
.mode-btn:hover { filter: brightness(1.06); }
.mode-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.45); }
.mode-sum, .mode-sub, .mode-both { background: #7f7f7f; }
.mode-note { margin-top: 14px; color: #666; font-size: 0.95rem; }

@media (max-width: 640px) {
    .mode-grid { grid-template-columns: 1fr; }
    .mode-container { margin: 40px 12px; }
}

.bg-video-container {
    position: fixed;
    inset: 0;
    z-index: -9999; 
    overflow: hidden;
    pointer-events: none;
    background-color: var(--theme-bg-1);
}
.bg-video {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    pointer-events: none;
}

.no-video .bg-video-container { display: none; }

.info-cont{
    max-width: 400px;
    margin: 100px auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}
.info-cont h1 {
    color: var(--theme-bg-1); 
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}