:root {
    --bg-color: #000000;
    --card-bg: #000000;
    --accent-color: #f8db35;
    --accent-red: #e63946;
    --text-white: #ffffff;
    --text-muted: #8d99ae;
    --tape-gradient: linear-gradient(180deg, #fceb65 0%, #d4bc22 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 450px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header & Logo */
.header {
    text-align: center;
    background-color: #000;
    padding-top: 10px;
    padding-bottom: 5px;
}

.tape-cross {
    width: 60px;
    height: 80px;
    margin: 0 auto 10px;
    position: relative;
    background: repeating-linear-gradient(90deg, transparent, transparent 4px, #333 4px, #333 5px), var(--accent-color);
    border-radius: 4px;
    border: 2px solid #333;
}

.main-logo {
    max-height: 320px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.tape-cross::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 25px;
    top: 25px;
    left: -12px;
    background: repeating-linear-gradient(90deg, transparent, transparent 4px, #333 4px, #333 5px), var(--accent-color);
    border-radius: 4px;
    border: 2px solid #333;
    z-index: -1;
}

.logo-text {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    font-size: 2.5rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

/* Interaction Zone */
.interaction-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mic-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--accent-red);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
}

.dual-mic-container {
    display: flex;
    justify-content: center;
    gap: 35px;
    margin-bottom: 20px;
    width: 100%;
}

.mic-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.mic-circle-btn {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.mic-circle-btn:active {
    transform: scale(0.92);
}

.mic-circle-btn.dimmed {
    opacity: 0.35;
    transform: scale(0.92);
    filter: grayscale(0.6);
}

.mic-red {
    background-color: var(--accent-red);
}

.mic-yellow {
    background-color: var(--accent-color);
}

.mic-yellow .mic-icon {
    color: #000;
}

.mic-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.70rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1.5px;
}

.pulse-calc {
    animation: pulseRed 1.8s infinite alternate;
}

.pulse-cutlist {
    animation: pulseYellow 1.8s infinite alternate;
}

@keyframes pulseRed {
    0% { box-shadow: 0 0 15px rgba(230, 57, 70, 0.5), 0 0 0 0 rgba(230, 57, 70, 0.4); }
    100% { box-shadow: 0 0 30px rgba(230, 57, 70, 0.9), 0 0 0 15px rgba(230, 57, 70, 0); }
}

@keyframes pulseYellow {
    0% { box-shadow: 0 0 15px rgba(248, 219, 53, 0.5), 0 0 0 0 rgba(248, 219, 53, 0.4); }
    100% { box-shadow: 0 0 30px rgba(248, 219, 53, 0.9), 0 0 0 15px rgba(248, 219, 53, 0); }
}

.mic-button:active {
    transform: scale(0.95);
}

.mic-button.pulse-active {
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(230, 57, 70, 0.5), 0 0 0 0 rgba(230, 57, 70, 0.4);
    }
    100% {
        box-shadow: 0 0 25px rgba(230, 57, 70, 0.8), 0 0 0 15px rgba(230, 57, 70, 0);
    }
}

.status-text {
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.transcript-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1.4;
    color: #e0e0e0;
    min-height: 2.8rem;
}

/* Result Card */
.result-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.equation {
    font-family: 'Inter', sans-serif;
    color: var(--accent-color);
    font-size: 1.5rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.result-number {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    display: flex;
    align-items: baseline;
    justify-content: center;
    transform: skewX(-10deg);
    line-height: 0.9;
}

.result-number .integer {
    font-size: 6rem;
    font-weight: 400; /* Prevent faux-bold from warping Bangers font */
    letter-spacing: 2px;
    margin-right: 12px;
}
.result-number .fraction {
    font-size: 4rem;
    display: flex;
    align-items: center;
}

.result-label {
    margin-top: 15px;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Tape View Area */
.tape-view {
    background-color: #3b3d4f; /* Muted blue-gray */
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
}

.tape-header {
    text-align: right;
    padding: 0 16px 10px;
}

.badge {
    background-color: #333;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 1px;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.badge.learn-mode {
    background-color: var(--accent-color);
    color: #000;
}

.tape-canvas-container {
    width: 100%;
    height: 120px;
    background: var(--tape-gradient);
    position: relative;
}

canvas#tape-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.tape-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    visibility: hidden; /* Hide on fresh load */
}

.marker-diamond {
    width: 12px;
    height: 12px;
    background-color: var(--accent-red);
    transform: rotate(45deg);
    margin-top: 6px;
}

.marker-line {
    width: 2px;
    flex-grow: 1;
    background-color: var(--accent-red);
    box-shadow: 0 0 4px rgba(230, 57, 70, 0.8);
}

.marker-arrow {
    width: 0; 
    height: 0; 
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--accent-red);
    margin-bottom: 2px;
}

.marker-bubble {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.tape-label {
    text-align: center;
    font-size: 0.6rem;
    font-style: italic;
    color: #9ba0be;
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Scroll Wrapper */
#history-scroll-wrapper {
    scrollbar-width: thin;
    scrollbar-color: #333333 #131313;
}
#history-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
}
#history-scroll-wrapper::-webkit-scrollbar-track {
    background: #131313;
}
#history-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #333333;
    border-radius: 4px;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 10px;
}

.history-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
    overflow: hidden; /* Prevent boundary bleed completely natively intelligently! */
}

.history-item.slashed {
    color: #555 !important;
}

.history-item.slashed .history-equation {
    color: #555 !important;
}

.history-item.slashed .history-icon {
    color: #555 !important;
}

.history-item.slashed .history-result {
    color: #555 !important;
}

.history-item.slashed::after {
    content: '';
    position: absolute;
    left: 0; 
    bottom: 0px; 
    width: 110%; 
    height: 3px;
    background: var(--accent-red);
    transform-origin: left bottom;
    transform: rotate(-5deg) scaleX(1);
    animation: slashStrike 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    pointer-events: none;
    z-index: 2;
}

@keyframes slashStrike {
    0% { transform: rotate(-5deg) scaleX(0); }
    100% { transform: rotate(-5deg) scaleX(1); }
}

.history-icon {
    color: var(--text-muted);
    margin-right: 12px;
}

.history-equation {
    color: var(--text-muted);
    flex-grow: 1;
}

.history-result {
    color: var(--accent-color);
    font-weight: 700;
}

/* Footer CTA */
.footer-cta {
    margin-top: 20px;
    text-align: center;
    padding-bottom: 20px;
}

.cta-text {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.learn-button {
    width: 100%;
    background-color: var(--accent-color);
    color: #000;
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    letter-spacing: 2px;
    border: none;
    border-radius: 4px;
    padding: 12px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--accent-color);
    transition: transform 0.1s, box-shadow 0.1s;
}

.learn-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--accent-color);
}

/* ==================== Learn Mode Styles ==================== */
.learn-app-container {
    justify-content: flex-start;
    padding-top: 0;
    height: 100vh;
}

.learn-logo {
    max-height: 160px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    align-self: flex-start;
}

.back-button:hover, .back-button:active {
    color: var(--text-white);
}

.learn-main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-top: 20px;
    padding-bottom: 20px;
}

.step-header {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    font-size: 3rem;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 20px;
}

.visuals-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.zoomed-tape-container {
    width: 100%;
    height: 120px;
    background: var(--tape-gradient);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.lb-container {
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid #222;
}

/* ==================== Game Module Styles ==================== */
.game-title {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    font-size: 34px;
    text-align: center;
    margin: 20px 0;
    line-height: 1.1;
    letter-spacing: 1px;
}

.level-button {
    background-color: var(--card-bg);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: all 0.2s ease;
}

.level-button:active {
    transform: scale(0.98);
}

.level-button:hover {
    border-color: var(--accent-color);
}

.level-title {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    font-size: 24px;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.level-desc {
    font-family: 'Inter', sans-serif;
    color: #888;
    font-size: 13px;
    line-height: 1.3;
}

.level-best {
    display: block;
    margin-top: 8px;
    font-family: 'Inter', sans-serif;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.massive-bangers {
    font-family: 'Bangers', cursive;
    font-size: 100px;
    text-align: center;
    margin: auto;
    letter-spacing: 2px;
}

.yellow-text { color: var(--accent-color); }

.game-header-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: #fff;
    font-size: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 15px;
}

.timer-display { font-variant-numeric: tabular-nums; color: var(--accent-color); }

.game-feedback-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 10;
}

.game-feedback-overlay.flash-green {
    background-color: rgba(76, 175, 80, 0.4);
    opacity: 1;
}

.game-feedback-overlay.flash-red {
    background-color: rgba(229, 52, 43, 0.4);
    opacity: 1;
}

.score-rank-text {
    font-family: 'Bangers', cursive;
    text-align: center;
    font-size: 48px;
    margin-top: 30px;
    letter-spacing: 2px;
}

.glow-gold {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.rank-grey { color: #888; }
.rank-white { color: #fff; }
.rank-yellow { color: var(--accent-color); }
.rank-red { color: var(--accent-red); }

.massive-score {
    font-family: 'Bangers', cursive;
    text-align: center;
    font-size: 40px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.time-score-text {
    text-align: center;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 800;
}

.score-accuracy {
    text-align: center;
    color: #888;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    margin-top: 5px;
}

.jesus-quote {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-style: italic;
    color: #ccc;
    margin: 40px 20px;
    line-height: 1.5;
    font-size: 15px;
}

.score-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 10px;
}

canvas#zoomed-tape-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pie-chart-container {
    width: 200px;
    height: 200px;
    position: relative;
}

canvas#pie-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.description-container {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.5;
    color: #e0e0e0;
    margin-bottom: auto;
}

.action-button {
    width: 100%;
    background-color: #333;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    padding: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.action-button:active {
    background-color: #444;
}

.action-button.bangers-button {
    font-family: 'Bangers', cursive;
    background-color: var(--accent-color);
    color: #000;
    font-size: 1.7rem;
    letter-spacing: 1px;
}

.practice-container {
    width: 100%;
    text-align: center;
}

#practice-prompt {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.fraction-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.fraction-btn {
    background-color: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 6px;
    padding: 12px 0;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.fraction-btn:active {
    background-color: #555;
}

.fraction-btn.correct {
    background-color: #2e7d32;
    border-color: #4caf50;
    color: white;
}

.fraction-btn.incorrect {
    background-color: #c62828;
    border-color: #ef5350;
    color: white;
}

#practice-feedback {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    letter-spacing: 2px;
    height: 36px;
}

/* Content Pages */
.content-page-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 20px 80px 20px;
    font-family: 'Inter', sans-serif;
    color: #FFFFFF;
    line-height: 1.6;
}

.content-page-wrapper h1, 
.content-page-wrapper h2, 
.content-page-wrapper h3 {
    font-family: 'Bangers', cursive;
    color: var(--accent-color);
    letter-spacing: 2px;
    margin-top: 30px;
    margin-bottom: 10px;
}

.content-page-wrapper h1 {
    font-size: 2.5rem;
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.content-page-wrapper h2 {
    font-size: 1.8rem;
}

.content-page-wrapper h3 {
    font-size: 1.4rem;
    color: #FFF;
}

.content-page-wrapper p {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited,
.site-footer a:active {
    color: #888888;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #FFFFFF;
}

.site-footer .footer-separator {
    color: #444444;
    font-size: 12px;
    margin: 0 8px;
}

/* Calculate Mic Visual States */
.pulse-yellow {
    animation: pulseYellow 1.8s infinite alternate;
}

.steady-red {
    box-shadow: 0 0 25px rgba(230, 57, 70, 0.8), 0 0 0 5px rgba(230, 57, 70, 0.3);
}

.steady-yellow {
    box-shadow: 0 0 25px rgba(248, 219, 53, 0.8), 0 0 0 5px rgba(248, 219, 53, 0.3);
}

.spin-anim svg {
    animation: spinIcon 1.5s linear infinite;
}

@keyframes spinIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* ==================== Color Picker Styles ==================== */
.color-picker-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.color-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, border-width 0.2s ease;
}

.color-circle.selected {
    border-width: 6px;
}

.color-circle.selected::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.pop-animation {
    animation: popScale 0.15s ease-out forwards;
}

@keyframes popScale {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

.color-picker-trigger {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: 2px solid #fff;
    vertical-align: middle;
    margin-left: 10px;
    cursor: pointer;
}

#footer-color-modal {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #333;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
#footer-color-modal.visible {
    display: block;
}
#footer-color-modal h3 {
    font-family: "Bangers", cursive;
    color: #fff;
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

