/* ==========================================================================
   COCO CLASSROOM - DESIGN SYSTEM & WORKSHEET STYLE SHEET
   DESIGN INHERITED & EXPANDED FROM COCO GAMES (PLAYFUL TACTILE SYSTEM)
   ========================================================================== */

:root {
    /* Color Palette */
    --color-bg: #e0f2fe; /* Light sky blue */
    --color-text-dark: #0f172a; /* Slate 900 */
    --color-text-muted: #475569; /* Slate 600 */
    --color-card-bg: #ffffff;
    --color-border: #0f172a;
    
    /* Playful Theme Accents */
    --color-green: #80c41c;
    --color-green-shadow: #5c9310;
    --color-green-bg: #f4fbe7;
    
    --color-yellow: #f59e0b;
    --color-yellow-shadow: #b45309;
    --color-yellow-bg: #fffbeb;
    
    --color-pink: #ec4899;
    --color-pink-shadow: #be185d;
    --color-pink-bg: #fdf2f8;
    
    --color-purple: #8b5cf6;
    --color-purple-shadow: #6d28d9;
    --color-purple-bg: #f5f3ff;

    --color-blue: #2563eb;
    --color-blue-shadow: #1d4ed8;
    --color-blue-bg: #eff6ff;

    /* Fonts */
    --font-ui: 'Fredoka', system-ui, -apple-system, sans-serif;
    --font-text: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-sheet: 'Outfit', 'Fredoka', sans-serif;
    --font-monospace: 'Courier Prime', 'Courier', monospace;
    
    /* Animation / Transition */
    --transition-tactile: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   1. GLOBAL STYLES & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-text);
    background-color: var(--color-bg);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    color: var(--color-text-dark);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hide {
    display: none !important;
}

/* Buttons (Playful & Tactile) */
.btn {
    font-family: var(--font-ui);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
    border: 3px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition-tactile);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: translateY(4px);
}

.btn-primary {
    background-color: var(--color-green);
    color: white;
    box-shadow: 0 6px 0 var(--color-green-shadow);
}
.btn-primary:hover {
    background-color: #8cd820;
    box-shadow: 0 4px 0 var(--color-green-shadow);
    transform: translateY(2px);
}
.btn-primary:active {
    box-shadow: 0 0px 0 var(--color-green-shadow);
}

.btn-secondary {
    background-color: var(--color-yellow);
    color: white;
    box-shadow: 0 6px 0 var(--color-yellow-shadow);
}
.btn-secondary:hover {
    background-color: #fbbf24;
    box-shadow: 0 4px 0 var(--color-yellow-shadow);
    transform: translateY(2px);
}
.btn-secondary:active {
    box-shadow: 0 0px 0 var(--color-yellow-shadow);
}

.btn-disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    border-color: #94a3b8;
    box-shadow: 0 6px 0 #94a3b8;
    cursor: not-allowed;
}

.btn-violet-disabled {
    background-color: var(--color-purple);
    color: white;
    border-color: var(--color-border);
    box-shadow: 0 6px 0 var(--color-purple-shadow);
    cursor: not-allowed;
    opacity: 0.9;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.25rem;
}

.btn-md {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--color-border);
}
.btn-sm:hover {
    transform: translateY(1px);
    box-shadow: 0 2px 0 var(--color-border);
}
.btn-sm:active {
    transform: translateY(3px);
    box-shadow: 0 0px 0 var(--color-border);
}

/* ==========================================================================
   2. LANDING DASHBOARD VIEW
   ========================================================================== */
.view-panel {
    display: none;
    flex-grow: 1;
    width: 100%;
}

.view-panel.active-view {
    display: flex;
    flex-direction: column;
}

.landing-header {
    text-align: center;
    padding: 1.75rem 1.5rem 0.5rem;
}

.brand-badge {
    display: inline-block;
    background: var(--color-blue);
    color: white;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.4rem 1.1rem;
    border-radius: 50px;
    border: 3px solid var(--color-border);
    box-shadow: 0 4px 0 var(--color-border);
    margin-bottom: 0.75rem;
    transform: rotate(-2deg);
}

.logo-title {
    font-family: var(--font-ui);
    font-size: 3.25rem;
    font-weight: 700;
    color: var(--color-text-dark);
    text-shadow: 0 3px 0 #ffffff;
    letter-spacing: -0.5px;
    margin-bottom: 0.35rem;
    line-height: 1.1;
}

.logo-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    font-weight: 400;
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.35;
}

.landing-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 1.75rem;
}

/* Suite Grid (Single Row on Desktop) */
.suite-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 0.5rem;
}

@media (max-width: 1100px) {
    .suite-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    .suite-grid {
        grid-template-columns: 1fr;
    }
}

.tool-card {
    background: var(--color-card-bg);
    border: 4px solid var(--color-border);
    border-radius: 20px;
    padding: 1.75rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 0 var(--color-border);
    transition: var(--transition-tactile);
}

.tool-card.active-tool {
    cursor: pointer;
}

.tool-card.active-tool:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 0 var(--color-border);
}

.tool-badge {
    position: absolute;
    top: -14px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    border: 3px solid var(--color-border);
    box-shadow: 0 3px 0 var(--color-border);
}

.tool-badge.green { background-color: var(--color-green); color: white; }
.tool-badge.purple, .tool-badge.violet { background-color: var(--color-purple); color: white; }
.tool-badge.pink { background-color: var(--color-pink); color: white; }

.tool-icon {
    font-size: 3.25rem;
    margin-bottom: 0.75rem;
    user-select: none;
}

.tool-card h3 {
    font-family: var(--font-ui);
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-dark);
    line-height: 1.2;
}

.tool-card p {
    font-size: 0.925rem;
    line-height: 1.4;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.tool-card button {
    width: 100%;
}

.teaser-tool {
    opacity: 0.9;
    background-color: #faf5ff;
    border-color: var(--color-border);
}

.landing-footer {
    text-align: center;
    padding: 3rem 1.5rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   3. WORKSHEET CREATOR WORKSPACE
   ========================================================================== */
.workspace-header {
    background: var(--color-card-bg);
    border-bottom: 4px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h2 {
    font-family: var(--font-ui);
    font-size: 1.8rem;
    color: var(--color-text-dark);
}

.workspace-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 84px);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .workspace-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
}

/* Left Sidebar Controls */
.controls-panel {
    background: var(--color-card-bg);
    border-right: 4px solid var(--color-border);
    padding: 2rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    height: 100%;
}

@media (max-width: 1024px) {
    .controls-panel {
        height: auto;
        border-right: none;
        border-bottom: 4px solid var(--color-border);
    }
}

.control-group {
    background: var(--color-blue-bg);
    border: 3px solid var(--color-border);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 0 var(--color-border);
}

.control-group h3 {
    font-family: var(--font-ui);
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.input-wrapper:last-child {
    margin-bottom: 0;
}

.input-wrapper label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.input-wrapper input[type="text"],
.input-wrapper select,
.input-wrapper textarea {
    font-family: var(--font-text);
    font-size: 1rem;
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: white;
    color: var(--color-text-dark);
    transition: var(--transition-tactile);
}

.input-wrapper input[type="text"]:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Custom Checkbox / Radio styling */
.radio-row {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.radio-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
}

.radio-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    background-color: white;
    border: 2px solid var(--color-border);
    border-radius: 50%;
}

.radio-container:hover input ~ .radio-checkmark {
    background-color: #f1f5f9;
}

.radio-container input:checked ~ .radio-checkmark {
    background-color: var(--color-blue);
    border-color: var(--color-border);
}

.radio-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.radio-container input:checked ~ .radio-checkmark:after {
    display: block;
}

.radio-container .radio-checkmark:after {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: white;
}

/* Dynamic Inputs Styling */
.dynamic-inputs-area {
    margin-top: 0.75rem;
    border-top: 2px dashed rgba(15, 23, 42, 0.15);
    padding-top: 1rem;
}

/* Checklist custom grid */
.word-checklist {
    max-height: 180px;
    overflow-y: auto;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem;
    background: white;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-item input {
    cursor: pointer;
}

.checklist-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Right Preview Panel */
.preview-panel {
    background: #475569; /* Slate 600 for contrast */
    padding: 2.5rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 100%;
}

@media (max-width: 1024px) {
    .preview-panel {
        height: auto;
        padding: 1.5rem;
    }
}

.preview-scroller {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   4. WORKSHEET PAPER RENDER SYSTEM (US Letter)
   ========================================================================== */
.print-paper {
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    color: black;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0.75in 0.75in 0.6in 0.75in; /* Standard margins */
}

/* Strictly sizing to 8.5 x 11 inches */
.size-letter {
    width: 8.5in;
    min-height: 11.0in;
    height: 11.0in;
    overflow: hidden;
}

/* Printable Header styling */
.worksheet-paper-header {
    border-bottom: 2px solid #000000;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.student-info-line {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-monospace);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.worksheet-main-title {
    font-family: var(--font-sheet);
    font-size: 2.25rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.worksheet-subtitle {
    font-family: var(--font-sheet);
    font-size: 1rem;
    color: #475569;
    font-weight: 500;
}

.worksheet-sub-info {
    font-family: var(--font-sheet);
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Worksheet Contents */
.worksheet-activity {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.worksheet-instruction {
    font-family: var(--font-sheet);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    border-left: 4px solid #000;
    padding-left: 0.5rem;
}

.worksheet-footer {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-sheet);
    font-size: 0.75rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5rem;
    margin-top: 1rem;
}

/* ==========================================================================
   5. WORKSHEET ACTIVITY-SPECIFIC LAYOUTS
   ========================================================================== */

/* A. Sight Word / Seasons / Holiday Coloring Grids */
.coloring-grid-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
}

/* Color Code Table Box (Inspired by Sample Worksheets) */
.coloring-key-grid {
    width: 100%;
    border: 3px solid #000000;
    background: #ffffff;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 0.35rem;
}

@media (max-width: 600px) {
    .coloring-key-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.key-grid-cell {
    border: 1.5px solid #000000;
    padding: 0.4rem 0.5rem;
    font-family: var(--font-sheet);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
}

.key-color-pill {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 3px;
    border: 1.5px solid #000000;
    display: inline-block;
    flex-shrink: 0;
}

.key-instruction-sub {
    font-family: var(--font-sheet);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: right;
    width: 100%;
    margin-bottom: 0.4rem;
    color: #0f172a;
}

/* SVG Stained-Glass Frame Rendering */
.coloring-svg {
    border: 4px solid #000000;
    background: white;
    max-width: 100%;
    max-height: 5.8in;
    display: block;
    margin: 0 auto;
}

/* SVG Interior Outlines & Line Weights */
.svg-outline {
    fill: none;
    stroke: #000000;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* SVG Text Label Non-Overlap Styling */
.svg-text-label {
    fill: #000000;
    stroke: #ffffff;
    stroke-width: 5px;
    paint-order: stroke fill;
    stroke-linejoin: round;
    stroke-linecap: round;
    font-family: var(--font-sheet);
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
}

.stroke-weight-thick .svg-outline { stroke-width: 3.5px; }
.stroke-weight-regular .svg-outline { stroke-width: 2px; }
.stroke-weight-fine .svg-outline { stroke-width: 1.25px; }

/* Page Border Options for Print Paper */
.print-paper.border-clean {
    border: none;
}
.print-paper.border-playful {
    outline: 4px double #0f172a;
    outline-offset: -12px;
    border-radius: 12px;
}
.print-paper.border-dotted {
    outline: 4px dotted #0f172a;
    outline-offset: -12px;
}
.print-paper.border-stars {
    outline: 3px dashed #0f172a;
    outline-offset: -10px;
}

.svg-text-label {
    font-family: var(--font-sheet);
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    fill: #000000;
    user-select: none;
}

.svg-decorations {
    fill: none;
    stroke: #000000;
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
}

/* B. Category Matching Layouts */
.matching-layout {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.2fr;
    align-items: stretch;
    justify-items: center;
    position: relative;
    margin-top: 1rem;
    gap: 1rem;
    padding: 0 0.5rem;
}

.matching-column {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: stretch;
    width: 100%;
    height: 100%;
    gap: 0.75rem;
}

.match-item-card {
    border: 2px solid #000000;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    min-height: 55px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

.match-word {
    font-family: var(--font-sheet);
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: capitalize;
}

.match-anchor {
    width: 14px;
    height: 14px;
    border: 3px solid #000000;
    background: #ffffff;
    border-radius: 50%;
    display: inline-block;
}

.column-left .match-item-card {
    flex-direction: row;
}

.column-right .match-item-card {
    flex-direction: row-reverse;
}

.column-right .match-word {
    font-size: 1.1rem;
    font-weight: 700;
    color: #475569;
}

/* Middle SVG matching canvas (for print outlines, dots) */
.matching-canvas-area {
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
}

.matching-svg-print {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ==========================================================================
   6. HISTORICAL GENERATIONS MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: white;
    border: 4px solid var(--color-border);
    border-radius: 24px;
    width: 100%;
    max-width: 650px;
    box-shadow: 0 12px 0 var(--color-border);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    animation: modalSlide 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    border-bottom: 3px solid var(--color-border);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-ui);
    font-size: 1.6rem;
    color: var(--color-text-dark);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 2.25rem;
    font-family: var(--font-ui);
    cursor: pointer;
    line-height: 1;
    color: var(--color-text-muted);
    transition: var(--transition-tactile);
}
.btn-close:hover {
    color: var(--color-pink);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-tip {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
    font-style: italic;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    border: 3px solid var(--color-border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-blue-bg);
    transition: var(--transition-tactile);
}

.history-item:hover {
    background: white;
    transform: scale(1.01);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-title {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-dark);
}

.history-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-history {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-history p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

.modal-footer {
    border-top: 3px solid var(--color-border);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
}

/* ==========================================================================
   8. HANDWRITING PRACTICE GENERATOR STYLES
   ========================================================================== */

/* Radio Tile Selector */
.radio-tile-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.radio-tile {
    display: flex;
    align-items: center;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    background: white;
    transition: var(--transition-tactile);
    font-size: 0.9rem;
    font-weight: 600;
}

.radio-tile input[type="radio"] {
    margin-right: 10px;
    accent-color: var(--color-blue);
}

.radio-tile:hover {
    background: #eff6ff;
}

.radio-tile input[type="radio"]:checked + .tile-label {
    color: var(--color-blue);
}

/* Vocabulary Selection Box */
.vocab-items-box {
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
    margin-top: 0.5rem;
}

.vocab-box-actions {
    background: #e2e8f0;
    padding: 0.4rem 0.75rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--color-border);
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-blue);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
}
.btn-text:hover {
    text-decoration: underline;
}

.checkboxes-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkboxes-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.checkboxes-list input[type="checkbox"] {
    accent-color: var(--color-green);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Sliders / Toggles */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 20px;
    border: 2px solid var(--color-border);
    transition: .3s;
}

.toggle-container input {
    display: none;
}

.toggle-container input:checked + .toggle-slider {
    background-color: var(--color-green);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--color-border);
    border-radius: 50%;
    transition: .3s;
}

.toggle-container input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Live Canvas Preview Area */
.preview-area {
    flex-grow: 1;
    background: #cbd5e1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-toolbar {
    background: #0f172a;
    color: white;
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    font-family: var(--font-ui);
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.preview-zoom-container {
    flex-grow: 1;
    overflow: auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#preview-writing-canvas-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
    transform-origin: top center;
}

/* Sheet Specific Styles for Handwriting Practice */
.print-page {
    background: white;
    width: 8.5in;
    height: 11in;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    color: #000;
}

.print-page.margin-standard { padding: 0.75in; }
.print-page.margin-narrow { padding: 0.5in; }
.print-page.margin-wide { padding: 1.0in; }

.print-page-header {
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.print-page-header h2 {
    font-size: 24px;
    font-weight: 700;
    text-transform: capitalize;
    color: #000;
    margin: 0;
}

.print-page-fields {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-family: monospace;
    color: #555;
    margin-top: 4px;
}

.print-page-content {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    align-content: start;
}

.print-page-content.cols-2 {
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
    row-gap: 30px;
}

.practice-word-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.practice-word-block.full-width {
    grid-column: span 2;
}

.practice-word-label {
    font-family: var(--font-ui);
    font-size: 13px;
    color: #64748b;
    margin-bottom: 2px;
    text-transform: capitalize;
}

.font-courier-prime { font-family: 'Courier Prime', Courier, monospace; }
.font-roboto-mono { font-family: 'Roboto Mono', monospace; }
.font-system-mono { font-family: monospace; }

.font-size-sm .char-segment { font-size: 28px; }
.font-size-md .char-segment { font-size: 36px; }
.font-size-lg .char-segment { font-size: 44px; }
.font-size-xl .char-segment { font-size: 56px; }

.practice-line-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
}

.char-segment {
    display: inline-flex;
    width: 0.95em;
    height: 1.35em;
    justify-content: center;
    align-items: center;
    font-weight: 400;
    position: relative;
    box-sizing: border-box;
    margin-right: 4px;
}

.spaced-letters .char-segment {
    margin-right: 12px;
}

.char-segment.char-space {
    border: none !important;
    background: none !important;
}

.text-solid .char-segment {
    color: #000 !important;
}

.text-gray .char-segment {
    color: #cbd5e1 !important;
}

.text-outline .char-segment {
    color: transparent !important;
    -webkit-text-stroke: 1.5px #94a3b8;
}

/* Guidelines */
.guide-underline .char-segment {
    border-bottom: 2.5px solid #94a3b8;
}

.guide-primary .char-segment {
    background-image: 
        linear-gradient(to bottom, #94a3b8 1px, transparent 1px),
        linear-gradient(to right, #cbd5e1 50%, transparent 50%),
        linear-gradient(to bottom, #fda4af 2.5px, transparent 2.5px);
    background-position: 
        0 15%, 
        0 50%, 
        0 85%;
    background-size: 
        100% 1px, 
        8px 1px, 
        100% 2.5px;
    background-repeat: repeat-x;
}

.guide-boxes .char-segment {
    border: 2px dashed #94a3b8;
    border-radius: 6px;
}

.guide-none .char-segment {
    border: none;
    background: none;
}

.practice-word-block .guide-lines-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.print-page-footer {
    position: absolute;
    bottom: 0.4in;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    font-family: monospace;
}

.print-only {
    display: none;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    font-weight: 700;
    color: var(--color-text-muted);
}
.modal-close-btn:hover {
    color: var(--color-text-dark);
}

.share-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 520px) {
    .share-options-grid {
        grid-template-columns: 1fr;
    }
}

.share-option-card {
    background: #f8fafc;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: var(--transition-tactile);
}

.share-option-card:hover {
    background: #eff6ff;
    transform: translateY(-2px);
}

.share-option-card .share-icon {
    font-size: 2rem;
}

.share-option-card h4 {
    font-family: var(--font-ui);
    font-size: 1rem;
    margin: 4px 0 2px;
}

.share-option-card p {
    font-size: 0.8rem;
    line-height: 1.35;
    margin-bottom: 8px;
    color: var(--color-text-muted);
    flex-grow: 1;
}

.share-link-display {
    background: #eff6ff;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 5px;
}

.share-link-display label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-link-row {
    display: flex;
    gap: 10px;
}

.copy-link-row input {
    flex-grow: 1;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 2px solid var(--color-border);
    font-family: monospace;
    font-size: 0.8rem;
    outline: none;
}

/* Tool card badge variant */
.tool-badge.blue {
    background: #eff6ff;
    color: #2563eb;
    border-color: #2563eb;
}

/* ==========================================================================
   9. PRINTING & US LETTER MEDIA QUERIES
   ========================================================================== */
@media print {
    /* Hide everything on workspace / layout except paper */
    body, html {
        background: white !important;
        background-image: none !important;
        color: black !important;
        width: 8.5in;
        height: 11.0in;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #app-container,
    .workspace-header,
    .controls-panel,
    .preview-panel,
    .no-print,
    .modal-overlay,
    canvas {
        display: none !important;
    }

    .print-only, #print-sheet-root {
        display: block !important;
        background: transparent !important;
    }

    .print-page {
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        width: 8.5in !important;
        height: 11in !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
    }

    .print-page:last-child {
        page-break-after: avoid !important;
    }

    .preview-scroller {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 8.5in !important;
        height: 11.0in !important;
    }

    .print-paper {
        display: flex !important;
        visibility: visible !important;
        width: 8.5in !important;
        height: 11.0in !important;
        min-height: 11.0in !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0.75in 0.75in 0.6in 0.75in !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        background: white !important;
        page-break-after: avoid;
        page-break-before: avoid;
    }

    .coloring-svg {
        max-height: 6.2in !important;
    }

    .matching-layout {
        height: auto !important;
        min-height: auto !important;
        flex-grow: 1 !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ==========================================================================
   SHOP STYLES: FUN AND LEARN WORKSHEETS MULTI-SCREEN ARCHITECTURE
   ========================================================================== */

.shop-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.shop-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.shop-hero h1 {
    font-family: var(--font-ui);
    font-size: 2.75rem;
    color: var(--color-text-dark);
    margin-bottom: 0.5rem;
}

.shop-hero p {
    font-size: 1.15rem;
    color: var(--color-text-muted);
}

/* Shelves Grid (1st Shop Screen) */
.shelves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.shelf-card {
    background: var(--color-card-bg);
    border: 3.5px solid var(--color-border);
    border-radius: 20px;
    padding: 2rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 0 var(--color-border);
    transition: var(--transition-tactile);
    cursor: pointer;
}

.shelf-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 0 var(--color-border);
}

.shelf-card.special-shelf {
    background: linear-gradient(135deg, #ffffff 0%, #f3e8ff 100%);
    border-color: var(--color-purple-shadow);
    box-shadow: 0 8px 0 var(--color-purple-shadow);
}

.shelf-card.special-shelf:hover {
    box-shadow: 0 12px 0 var(--color-purple-shadow);
}

.shelf-banner {
    position: absolute;
    top: -14px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    border: 2.5px solid var(--color-border);
    box-shadow: 0 3px 0 var(--color-border);
    text-transform: uppercase;
}

.shelf-banner.green { background-color: var(--color-green); color: white; }
.shelf-banner.yellow { background-color: var(--color-yellow); color: white; }
.shelf-banner.pink { background-color: var(--color-pink); color: white; }
.shelf-banner.blue { background-color: var(--color-blue); color: white; }
.shelf-banner.purple { background-color: var(--color-purple); color: white; }

.shelf-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    user-select: none;
}

.shelf-card h3 {
    font-family: var(--font-ui);
    font-size: 1.45rem;
    margin-bottom: 0.6rem;
    color: var(--color-text-dark);
}

.shelf-card p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.4;
}

/* My Worksheets Sub-Category Tabs (2nd Shop Screen) */
.shop-header-desc {
    background: #ffffff;
    border: 2.5px solid var(--color-border);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 0 var(--color-border);
    font-size: 1rem;
    color: var(--color-text-dark);
}

.my-worksheets-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.tab-btn {
    font-family: var(--font-ui);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    border: 3px solid var(--color-border);
    background-color: #ffffff;
    color: var(--color-text-dark);
    cursor: pointer;
    box-shadow: 0 4px 0 var(--color-border);
    transition: var(--transition-tactile);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--color-border);
}

.tab-btn.active {
    background-color: var(--color-purple);
    color: #ffffff;
    box-shadow: 0 4px 0 var(--color-purple-shadow);
}

/* Worksheets Items Grid (2nd Shop Screen) */
.worksheets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.75rem;
}

/* 1st Custom Slot in Generated Worksheets */
.custom-generator-slot-card {
    background: linear-gradient(135deg, var(--color-yellow-bg) 0%, #ffffff 100%);
    border: 3.5px dashed var(--color-yellow-shadow);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 320px;
    box-shadow: 0 6px 0 var(--color-yellow-shadow);
    transition: var(--transition-tactile);
    cursor: pointer;
}

.custom-generator-slot-card:hover {
    transform: translateY(-4px);
    border-style: solid;
    box-shadow: 0 10px 0 var(--color-yellow-shadow);
}

.custom-slot-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.custom-generator-slot-card h3 {
    font-family: var(--font-ui);
    font-size: 1.35rem;
    color: var(--color-text-dark);
    margin-bottom: 0.5rem;
}

.custom-generator-slot-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
}

/* Worksheet Item Card */
.worksheet-item-card {
    background: #ffffff;
    border: 3px solid var(--color-border);
    border-radius: 18px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 6px 0 var(--color-border);
    transition: var(--transition-tactile);
}

.worksheet-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 0 var(--color-border);
}

.fav-star-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: var(--transition-tactile);
}

.fav-star-btn:hover {
    transform: scale(1.15);
}

.fav-star-btn.is-favorite {
    background-color: var(--color-yellow);
    color: white;
}

.ws-thumbnail-box {
    width: 100%;
    height: 190px;
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition-tactile);
}

.ws-thumbnail-box:hover {
    border-color: var(--color-blue);
}

.ws-thumbnail-box::after {
    content: "🔍 Click to Preview";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.85);
    color: white;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 0.3rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ws-thumbnail-box:hover::after {
    opacity: 1;
}

.ws-card-title {
    font-family: var(--font-ui);
    font-size: 1.15rem;
    color: var(--color-text-dark);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.ws-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.ws-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* Full View Screen (3rd Shop Screen) */
.fullview-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 3rem;
    overflow-y: auto;
}

.fullview-paper-scroller {
    background-color: rgba(15, 23, 42, 0.05);
    padding: 1.5rem;
    border-radius: 16px;
    border: 3px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Preview Modal */
.preview-modal-card {
    max-width: 650px;
    width: 90%;
}

.preview-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-modal-canvas-box {
    width: 100%;
    height: 400px;
    background: #ffffff;
    border: 3px solid var(--color-border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: var(--transition-tactile);
}

.preview-modal-canvas-box:hover {
    transform: scale(1.01);
    border-color: var(--color-blue);
}

/* Color by Word Key Grid & Pill Badges */
.coloring-key-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.key-grid-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.key-color-pill {
    padding: 6px 14px;
    border-radius: 16px;
    color: white;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    min-width: 90px;
    text-align: center;
}
.key-word-text {
    font-size: 14px;
    font-weight: 800;
    color: #111827;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

