* {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    background-color: #f8fafc;
    background-image: radial-gradient(#e2e8f0 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    color: #0f172a;
    min-height: 100vh;
}

header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    min-height: 52px;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', -apple-system, sans-serif;
}

h1 {
    font-size: 2rem;
    margin: 0;
    color: #0f172a;
    font-weight: 800;
    letter-spacing: -0.5px;
}

#btn-back {
    padding: 10px 18px;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    background-color: #ffffff;
    color: #ea580c;
    border: 2px solid #fdba74;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(234, 88, 12, 0.1);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 46px;
}

#btn-back:hover {
    background-color: #ea580c;
    color: #ffffff;
    border-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(234, 88, 12, 0.25);
}

#btn-back:active {
    transform: scale(0.95);
}

.btn-primary {
    padding: 15px 25px;
    font-size: 1.2rem;
    background-color: #ea580c;
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
    transition: transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* ========================================== */
/* Breadcrumb Path Navigation                */
/* ========================================== */
.breadcrumbs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    background: #ffffff;
    padding: 10px 18px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #475569;
    flex-wrap: wrap;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
}

.breadcrumb-item {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 10px;
    font-weight: 700;
    color: #475569;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.breadcrumb-item:hover {
    background: #fff7ed;
    color: #ea580c;
    border-color: #fed7aa;
}

.breadcrumb-item.active {
    color: #ea580c;
    font-weight: 800;
    cursor: default;
    background: #fff7ed;
    border-color: #fed7aa;
}

.breadcrumb-separator {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 900;
    user-select: none;
}

/* ========================================== */
/* Grid & Child-Friendly Tile System          */
/* ========================================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    padding: 6px 0 30px 0;
}

.tile {
    --tile-accent: #ea580c;
    background-color: #ffffff;
    border: 3px solid #e2e8f0;
    border-radius: 24px;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 6px 16px -3px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    user-select: none;
    min-height: 220px;
}

.tile:hover {
    transform: translateY(-6px);
    border-color: var(--tile-accent);
    box-shadow: 0 18px 28px -6px rgba(0, 0, 0, 0.12), 0 0 0 2px var(--tile-accent);
}

.tile:active {
    transform: scale(0.97) translateY(-2px);
}

/* Top bar with grade badge & audio speak button */
.tile-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    min-height: 32px;
}

.tile-grade-badge {
    font-size: 11px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.tile-speak-btn {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #475569;
    outline: none;
}

.tile-speak-btn:hover {
    background: #fff7ed;
    border-color: #fdba74;
    transform: scale(1.18);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.2);
}

.tile-speak-btn.pulse-anim {
    animation: speaker-pulse 0.5s ease;
}

@keyframes speaker-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); background: #fed7aa; }
    100% { transform: scale(1); }
}

/* Big visual icon */
.tile-icon-wrap {
    width: 82px;
    height: 82px;
    border-radius: 22px;
    background: #fff7ed;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 2px solid #fed7aa;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tile:hover .tile-icon-wrap {
    transform: scale(1.1) rotate(4deg);
    border-color: var(--tile-accent);
}

.tile-icon {
    font-size: 46px;
    line-height: 1;
    display: inline-block;
}

/* Card Content: Title & Subtitle */
.tile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.tile-title {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    line-height: 1.25;
}

.tile-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    font-weight: 500;
}

/* Bottom Action Pill */
.tile-action {
    margin-top: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: var(--tile-accent);
    background: #f8fafc;
    padding: 6px 18px;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.tile:hover .tile-action {
    background: var(--tile-accent);
    color: white;
    border-color: var(--tile-accent);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* ========================================== */
/* Active App View Container                  */
/* ========================================== */
#app-container {
    width: 100%;
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
}

/* ========================================== */
/* Pi der Pinguin Mascot Animations           */
/* ========================================== */
@keyframes pi-idle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes pi-bounce {
    0%, 100% { transform: translateY(0) scaleY(1); }
    40% { transform: translateY(-20px) scaleY(0.95); }
    60% { transform: translateY(-15px) scaleY(1.02); }
    80% { transform: translateY(0) scaleY(0.98); }
}

@keyframes pi-tilt {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

.pi-animated-idle {
    animation: pi-idle 3s ease-in-out infinite;
    transform-origin: bottom center;
    display: inline-block;
}

.pi-happy {
    animation: pi-bounce 0.6s cubic-bezier(0.25, 1, 0.5, 1) 2;
    transform-origin: bottom center;
    display: inline-block;
}

.pi-sad {
    animation: pi-tilt 0.5s ease-in-out 1;
    transform-origin: bottom center;
    display: inline-block;
}

@media (max-width: 640px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ========================================== */
/* Start Screen / Welcoming Hub Styling       */
/* ========================================== */
.start-screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 36px 20px 96px 20px;
    background: radial-gradient(circle at 15% 15%, rgba(254, 215, 170, 0.5) 0%, rgba(255, 237, 213, 0.75) 45%, rgba(255, 247, 237, 0.95) 100%), linear-gradient(135deg, #fff7ed 0%, #ffedd5 50%, #fed7aa 100%);
    box-sizing: border-box;
}

/* Floating background math symbols */
.start-bg-decorations {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.math-symbol-floating {
    position: absolute;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-weight: 900;
    color: #ea580c;
    opacity: 0.12;
    user-select: none;
    animation: floatSlow 7s ease-in-out infinite alternate;
}

@keyframes floatSlow {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-22px) rotate(12deg); }
}

.start-hub {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 840px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(253, 186, 116, 0.45);
    border-radius: 28px;
    padding: 38px 42px;
    box-shadow: 0 24px 50px -15px rgba(234, 88, 12, 0.18), 0 6px 20px rgba(0, 0, 0, 0.04);
    margin: auto 0;
    box-sizing: border-box;
}

/* Hero Section */
.start-hero {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 2px dashed #fed7aa;
}

.start-mascot-wrap {
    flex-shrink: 0;
    text-align: center;
}

.start-mascot-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 10px 18px rgba(234, 88, 12, 0.22));
}

.start-hero-content {
    flex: 1;
}

.start-speech-bubble {
    display: inline-block;
    position: relative;
    background: #fff7ed;
    border: 2px solid #fdba74;
    color: #9a3412;
    padding: 8px 16px;
    border-radius: 16px 16px 16px 4px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.08);
}

.start-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 12px;
    border-width: 8px 8px 0 0;
    border-style: solid;
    border-color: #fdba74 transparent transparent transparent;
}

.start-hub-title {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 2.35rem;
    font-weight: 800;
    margin: 0 0 6px 0;
    color: #ea580c;
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.start-hub-subtitle {
    color: #475569;
    font-size: 1.05rem;
    margin: 0 0 16px 0;
    line-height: 1.45;
}

.start-pill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.start-pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 5px 13px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.start-pill-tag.accent {
    background: #ffedd5;
    color: #c2410c;
    border-color: #fdba74;
}

/* Action Cards Grid */
.start-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 24px;
}

.start-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
}

.start-card:hover {
    border-color: #fdba74;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(234, 88, 12, 0.12);
}

.start-card.primary-card {
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
    border-color: #fdba74;
}

.start-card-header {
    margin-bottom: 18px;
}

.start-card-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: inline-block;
}

.start-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.start-card-desc {
    font-size: 0.92rem;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
}

/* Big Action Buttons */
.btn-start-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-start-action.primary {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.28);
}

.btn-start-action.primary:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.38);
}

.btn-start-action.secondary {
    background: #f1f5f9;
    color: #334155;
    border: 2px solid #cbd5e1;
}

.btn-start-action.secondary:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.btn-start-action:active {
    transform: scale(0.97);
}

/* Class Login Form Inside Card */
.class-login-box {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #cbd5e1;
}

.form-group {
    margin-bottom: 12px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 5px;
    font-family: 'Outfit', sans-serif;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

/* Logged-In Student Banner */
.student-status-card {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: 16px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 16px;
}

.student-status-info {
    font-size: 0.95rem;
    color: #1e40af;
    line-height: 1.5;
}

/* Teacher Area Banner at the bottom */
.start-teacher-bar {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.start-teacher-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.start-teacher-link:hover {
    color: #ea580c;
    background: #fff7ed;
}

/* Alert Notification Boxes */
.start-alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}
.start-alert.error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.start-alert.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.start-alert.info {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* Responsive adjustments */
@media (max-width: 720px) {
    .start-screen-overlay {
        padding: 20px 14px 96px 14px;
    }
    .start-hub {
        padding: 26px 20px;
        border-radius: 22px;
    }
    .start-hero {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding-bottom: 22px;
        margin-bottom: 24px;
    }
    .start-speech-bubble {
        border-radius: 16px;
    }
    .start-speech-bubble::after {
        display: none;
    }
    .start-hub-title {
        font-size: 1.85rem;
    }
    .start-pill-tags {
        justify-content: center;
    }
    .start-action-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .student-status-card {
        flex-direction: column;
        align-items: flex-start;
    }
}