﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

:root {
    --pastel-blue: #A8D8EA;
    --pastel-yellow: #FFE5A0;
    --pastel-green: #B8E6D5;
    --pastel-pink: #FFD3E1;
    --pastel-purple: #D4C5F9;
    --blue-dark: #7CB9D1;
    --yellow-dark: #FFD670;
    --green-dark: #8FD4BC;
    --white: #FFF;
    --light-gray: #F8F9FA;
    --gray: #E9ECEF;
    --dark-gray: #6C757D;
    --text-dark: #2C3E50;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .15);
    --font-primary: 'Poppins', sans-serif;
    --font-display: 'Fredoka', sans-serif
}

body {
    font-family: var(--font-primary);
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--pastel-blue) 0%, var(--pastel-green) 100%);
    line-height: 1.6;
    overflow-x: hidden
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px
}

.section {
    min-height: 100vh;
    padding: 80px 0;
    display: flex;
    align-items: center;
    position: relative
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-dark);
    animation: fadeInDown .8s ease
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--dark-gray);
    margin-bottom: 3rem;
    animation: fadeInUp .8s ease
}

.header-section {
    background: linear-gradient(135deg, var(--pastel-blue) 0%, var(--pastel-purple) 100%)
}

.header-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center
}

.main-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: .5rem;
    animation: fadeInLeft 1s ease
}

.subtitle {
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 1rem;
    animation: fadeInLeft 1.2s ease
}

.tagline {
    font-size: 1.3rem;
    color: var(--dark-gray);
    margin-bottom: 2rem;
    animation: fadeInLeft 1.4s ease
}

.student-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 1s ease
}

.form-group {
    margin-bottom: 1.5rem
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: .5rem;
    color: var(--text-dark);
    font-size: .95rem
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: .8rem 1rem;
    border: 2px solid var(--gray);
    border-radius: 12px;
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all .3s ease
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 0;
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(168, 216, 234, .2)
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem
}

.btn-primary,
.btn-secondary,
.btn-tool {
    padding: .9rem 2rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: var(--shadow-sm)
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--pastel-blue) 100%);
    color: var(--white);
    width: 100%
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md)
}

.btn-secondary {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--pastel-green) 100%);
    color: var(--white);
    display: block;
    margin: 2rem auto 0
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md)
}

.btn-large {
    padding: 1.2rem 3rem;
    font-size: 1.2rem
}

.btn-tool {
    padding: .6rem 1.2rem;
    background: var(--white);
    border: 2px solid var(--gray);
    font-size: 1.2rem
}

.btn-tool:hover {
    background: var(--pastel-yellow);
    border-color: var(--yellow-dark)
}

.header-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: float 3s ease-in-out infinite
}

.header-illustration img {
    max-width: 100%;
    height: auto;
    border-radius: 20px
}

.rules-section {
    background: linear-gradient(135deg, var(--pastel-yellow) 0%, var(--pastel-pink) 100%)
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem
}

.rule-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all .3s ease;
    animation: fadeInUp .8s ease
}

.rule-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg)
}

.rule-icon {
    font-size: 3rem;
    margin-bottom: 1rem
}

.rule-card h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: .5rem;
    color: var(--text-dark)
}

.rule-card p {
    color: var(--dark-gray)
}

.number-line-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    text-align: center
}

.number-line-container h3 {
    font-family: var(--font-display);
    margin-bottom: 1.5rem;
    color: var(--text-dark)
}

.number-line-container img {
    max-width: 100%;
    height: auto
}

.movement-section {
    background: linear-gradient(135deg, var(--pastel-green) 0%, var(--pastel-blue) 100%)
}

.table-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    margin-bottom: 2rem
}

.interactive-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0
}

.interactive-table thead {
    background: linear-gradient(135deg, var(--pastel-blue) 0%, var(--pastel-purple) 100%)
}

.interactive-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--gray)
}

.interactive-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray)
}

.interactive-table tbody tr:hover {
    background: var(--light-gray)
}

.table-input {
    width: 100%;
    padding: .6rem;
    border: 2px solid var(--gray);
    border-radius: 8px;
    font-family: var(--font-primary);
    transition: all .3s ease
}

.table-input:focus {
    outline: 0;
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(168, 216, 234, .2)
}

.reflection-panel {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin: 2rem 0
}

.reflection-panel h3 {
    font-family: var(--font-display);
    margin-bottom: 1rem;
    color: var(--text-dark)
}

.reflection-panel textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray);
    border-radius: 12px;
    font-family: var(--font-primary);
    resize: vertical;
    transition: all .3s ease
}

.reflection-panel textarea:focus {
    outline: 0;
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(168, 216, 234, .2)
}

.illustration-container {
    text-align: center;
    margin: 2rem 0
}

.illustration-container img {
    max-width: 400px;
    height: auto;
    animation: float 3s ease-in-out infinite
}

.drawing-section {
    background: linear-gradient(135deg, var(--pastel-pink) 0%, var(--pastel-yellow) 100%)
}

.drawing-area {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem
}

.drawing-area h3 {
    font-family: var(--font-display);
    margin-bottom: 1rem;
    color: var(--text-dark);
    text-align: center
}

#drawing-canvas {
    display: block;
    margin: 0 auto 1rem;
    border: 3px solid var(--gray);
    border-radius: 12px;
    cursor: crosshair;
    background: var(--white);
    max-width: 100%
}

.drawing-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap
}

.escape-section {
    background: linear-gradient(135deg, var(--pastel-purple) 0%, var(--pastel-pink) 100%)
}

.escape-intro {
    margin-bottom: 2rem
}

.escape-story {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    text-align: center
}

.escape-story p {
    font-size: 1.1rem;
    color: var(--text-dark)
}

.escape-table {
    font-size: .95rem
}

.escape-table th {
    font-size: .9rem
}

.formula-section {
    background: linear-gradient(135deg, var(--pastel-green) 0%, var(--pastel-yellow) 100%)
}

.formula-table tbody tr:nth-child(odd) {
    background: var(--light-gray)
}

.reflection-section {
    background: linear-gradient(135deg, var(--pastel-blue) 0%, var(--pastel-green) 100%)
}

.reflection-questions {
    max-width: 900px;
    margin: 0 auto
}

.reflection-item {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    animation: fadeInUp .8s ease
}

.question-number {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--pastel-blue) 100%);
    color: var(--white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0
}

.question-content {
    flex: 1
}

.question-content label {
    display: block;
    font-weight: 600;
    margin-bottom: .8rem;
    color: var(--text-dark);
    font-size: 1.05rem
}

.question-content textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray);
    border-radius: 12px;
    font-family: var(--font-primary);
    resize: vertical;
    transition: all .3s ease
}

.question-content textarea:focus {
    outline: 0;
    border-color: var(--blue-dark);
    box-shadow: 0 0 0 3px rgba(168, 216, 234, .2)
}

.assessment-section {
    background: linear-gradient(135deg, var(--pastel-yellow) 0%, var(--pastel-purple) 100%)
}

.assessment-table-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    margin-bottom: 2rem
}

.assessment-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0
}

.assessment-table thead {
    background: linear-gradient(135deg, var(--pastel-yellow) 0%, var(--yellow-dark) 100%)
}

.assessment-table th,
.assessment-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--gray)
}

.assessment-table th:nth-child(2),
.assessment-table td:nth-child(2) {
    text-align: left
}

.assessment-table input[type=radio] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--blue-dark)
}

.assessment-table tbody tr:hover {
    background: var(--light-gray)
}

.footer {
    background: linear-gradient(135deg, var(--text-dark) 0%, #34495E 100%);
    color: var(--white);
    padding: 3rem 0;
    text-align: center
}

.footer-content {
    max-width: 800px;
    margin: 0 auto
}

.footer-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.8
}

.footer-credit {
    font-size: .95rem;
    opacity: .8
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-20px)
    }
}

@media (max-width:768px) {
    .header-content {
        grid-template-columns: 1fr;
        gap: 2rem
    }

    .main-title {
        font-size: 2rem
    }

    .subtitle {
        font-size: 1.3rem
    }

    .section-title {
        font-size: 1.8rem
    }

    .section {
        padding: 60px 0;
        min-height: auto
    }

    .form-row {
        grid-template-columns: 1fr
    }

    .rules-grid {
        grid-template-columns: 1fr
    }

    .reflection-item {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem
    }

    .question-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem
    }

    #drawing-canvas {
        width: 100%;
        height: 150px;
        touch-action: none
    }

    .table-container {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch
    }

    .interactive-table {
        min-width: 600px;
        font-size: 0.85rem
    }

    .interactive-table th,
    .interactive-table td {
        padding: .5rem;
        font-size: .8rem
    }

    .escape-table {
        font-size: .75rem;
        min-width: 700px
    }

    .escape-table .table-input {
        font-size: 0.75rem;
        padding: 0.4rem
    }

    .location-check {
        flex-direction: column;
        gap: 0.3rem
    }

    .btn-check {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.8rem
    }

    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        width: 100%
    }

    .final-actions {
        flex-direction: column !important;
        gap: 0.8rem !important
    }

    .student-form {
        padding: 1.5rem
    }

    .illustration-container img {
        max-width: 100%;
        height: auto
    }
}

@media (max-width:480px) {
    .section {
        padding: 60px 0
    }

    .main-title {
        font-size: 1.6rem
    }

    .subtitle {
        font-size: 1.1rem
    }

    .section-title {
        font-size: 1.6rem
    }

    .student-form {
        padding: 1.5rem
    }
}

html {
    scroll-behavior: smooth
}

::selection {
    background: var(--pastel-blue);
    color: var(--text-dark)
}

.loading {
    opacity: .6;
    pointer-events: none
}

.success-message {
    background: var(--pastel-green);
    color: var(--text-dark);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    margin: 1rem 0;
    animation: fadeInUp .5s ease
}

/* Interactive Number Line Styles */
.interactive-line-wrapper {
    position: relative;
    height: 120px;
    margin: 2rem 0;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-ticks {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #2c3e50;
    display: flex;
    justify-content: space-between;
    padding: 0 50px;
}

.tick {
    position: relative;
    width: 2px;
    height: 10px;
    background: #2c3e50;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tick::after {
    content: attr(data-value);
    position: absolute;
    top: 15px;
    font-size: 0.8rem;
    color: #6c757d;
}

.tick.zero {
    height: 20px;
    background: #FF6B6B;
}

.tick.zero::after {
    font-weight: bold;
    color: #FF6B6B;
}

.character {
    position: absolute;
    top: 20%;
    left: 50%;
    font-size: 2.5rem;
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.line-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.current-position {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Escape Room Locked States */
.location-check {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-check {
    background: var(--pastel-blue);
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
}

.btn-check:hover {
    background: var(--blue-dark);
    color: white;
    transform: translateY(-2px);
}

.btn-check:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.locked-content {
    background: #f8f9fa;
    color: #adb5bd;
    text-align: center;
    position: relative;
}

.lock-icon {
    font-size: 1.5rem;
    display: block;
}

.hidden {
    display: none !important;
}

.unlocked-row {
    background-color: #e8f5e9 !important;
    transition: background-color 0.5s ease;
}

.unlocked-row .locked-content {
    background: transparent;
    color: inherit;
}

/* PDF / Print Optimization Styles */
@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print,
    button,
    .btn-primary,
    .btn-secondary,
    .btn-tool,
    .btn-check,
    .drawing-controls,
    .line-controls {
        display: none !important;
    }

    .section {
        min-height: auto !important;
        padding: 15px 0 !important;
        page-break-after: auto;
        page-break-inside: avoid;
    }

    .container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 10px !important;
    }

    .table-container,
    .rule-card,
    .student-form,
    .reflection-item,
    .escape-story,
    .number-line-container,
    .reflection-panel,
    .drawing-area {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        margin-bottom: 10px !important;
    }

    .interactive-table th {
        background-color: #A8D8EA !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .interactive-table {
        page-break-inside: auto;
    }

    .interactive-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    input,
    textarea {
        border: 1px solid #ccc !important;
        background: white !important;
        color: #000 !important;
    }

    .header-illustration,
    .illustration-container {
        page-break-inside: avoid;
    }

    .header-illustration img,
    .illustration-container img {
        max-width: 300px !important;
        height: auto !important;
    }

    #drawing-canvas {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
}

/* Styles specifically for the html2pdf rendering class */
.printing-mode {
    background: white !important;
}

.printing-mode .section {
    min-height: auto !important;
    padding: 20px 0 !important;
    page-break-after: auto;
}

.printing-mode .container {
    width: 900px !important;
    max-width: 900px !important;
    margin: 0 auto;
    padding: 0 20px !important;
}

.printing-mode button,
.printing-mode .btn-primary,
.printing-mode .btn-secondary,
.printing-mode .btn-tool,
.printing-mode .btn-check,
.printing-mode .drawing-controls,
.printing-mode .line-controls {
    display: none !important;
}

.printing-mode .table-container {
    page-break-inside: avoid;
}

.printing-mode .interactive-table {
    font-size: 0.85rem;
}

.printing-mode .header-illustration img,
.printing-mode .illustration-container img {
    max-width: 350px !important;
}

.printing-mode #drawing-canvas {
    max-width: 100% !important;
    height: auto !important;
}