/* Pixel Playtime 15 - Mobile-First Styles */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #f472b6;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #fafafa;
    --bg-dark: #f3f4f6;
    --text: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --transition: 0.2s ease-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body.reduced-motion * {
    animation: none !important;
    transition: opacity 0.1s !important;
}

#app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-dark);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
    min-height: 48px;
    min-width: 48px;
}

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

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-dark);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-large {
    padding: 16px 32px;
    font-size: 20px;
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 24px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: var(--shadow);
}

.btn-group {
    display: flex;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-light);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid var(--bg-dark);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.header-timer {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-dark);
    padding: 6px 12px;
    border-radius: var(--radius);
}

/* Screen Container */
.screen {
    flex: 1;
    padding: 16px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* Auth Screen */
.auth-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 32px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    min-width: 80px;
}

.auth-tab.active {
    background: var(--white);
    box-shadow: var(--shadow);
}

.auth-form {
    width: 100%;
    max-width: 320px;
}

/* Dashboard */
.dashboard {
    padding-bottom: 80px;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 24px;
}

.dashboard-greeting {
    font-size: 14px;
    color: var(--text-light);
}

.dashboard-title {
    font-size: 24px;
    font-weight: 700;
}

.children-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.child-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}

.child-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.child-card.selected {
    border: 3px solid var(--primary);
}

.child-avatar {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: var(--radius);
}

.child-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.child-info p {
    font-size: 14px;
    color: var(--text-light);
}

.add-child-btn {
    width: 100%;
    padding: 20px;
    border: 2px dashed var(--text-light);
    background: transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-light);
    transition: all var(--transition);
}

.add-child-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Play Button */
.play-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, var(--bg));
}

.play-btn {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: block;
    padding: 20px;
    font-size: 22px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
}

/* Kid Mode - Map */
.map-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(180deg, #e0e7ff 0%, #fef3c7 100%);
}

.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255,255,255,0.9);
}

.map-container {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 32px;
    overflow-y: auto;
}

.map-node {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform var(--transition);
    position: relative;
}

.map-node::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 28px;
    background: var(--text-light);
    opacity: 0.3;
}

.map-node:last-child::after {
    display: none;
}

.map-node.completed {
    background: var(--success);
    color: var(--white);
}

.map-node.current {
    background: var(--primary);
    color: var(--white);
    animation: pulse 2s infinite;
}

.map-node.locked {
    background: var(--bg-dark);
    color: var(--text-light);
    cursor: not-allowed;
}

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

.mascot-area {
    text-align: center;
    padding: 16px;
}

.mascot-emoji {
    font-size: 64px;
}

.mascot-message {
    font-size: 18px;
    font-weight: 500;
    margin-top: 8px;
    color: var(--text);
}

/* Game Screen */
.game-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--white);
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.game-prompt {
    text-align: center;
    margin-bottom: 24px;
}

.game-prompt h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.game-prompt p {
    color: var(--text-light);
}

.game-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 24px;
}

.game-image {
    font-size: 100px;
}

.game-word {
    font-size: 36px;
    font-weight: 700;
}

.game-target {
    font-size: 64px;
    font-weight: 700;
    color: var(--primary);
    padding: 16px 32px;
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
}

/* Game Options */
.game-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.game-option {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 3px solid var(--bg-dark);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 48px;
    gap: 4px;
}

.game-option span {
    font-size: 14px;
    color: var(--text-light);
}

.game-option.selected {
    border-color: var(--primary);
    background: #eef2ff;
}

.game-option.correct {
    border-color: var(--success);
    background: #dcfce7;
}

.game-option.incorrect {
    border-color: var(--error);
    background: #fee2e2;
}

/* Syllable Clap Game */
.clap-counter {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary);
}

.drum-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 64px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.1s;
}

.drum-btn:active {
    transform: scale(0.9);
}

/* Build Word Game */
.build-slots {
    display: flex;
    gap: 8px;
    justify-content: center;
    min-height: 72px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
}

.build-slot {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    background: var(--white);
    border: 2px dashed var(--text-light);
    border-radius: var(--radius);
}

.build-slot.filled {
    border-style: solid;
    border-color: var(--primary);
}

.syllable-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
}

.syllable-btn {
    width: 72px;
    height: 72px;
    font-size: 32px;
    font-weight: 700;
    background: var(--white);
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.syllable-btn:hover {
    background: #eef2ff;
}

.syllable-btn.used {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Spot the Same */
.spot-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.spot-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    background: var(--white);
    border: 3px solid var(--bg-dark);
    border-radius: var(--radius);
    cursor: pointer;
}

.spot-option.selected {
    border-color: var(--primary);
    background: #eef2ff;
}

/* Game Actions */
.game-actions {
    padding: 16px;
    display: flex;
    gap: 12px;
}

.game-actions .btn {
    flex: 1;
}

/* Game Result */
.game-result {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    z-index: 200;
    padding: 24px;
}

.result-emoji {
    font-size: 100px;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.result-message {
    font-size: 28px;
    font-weight: 700;
    margin: 16px 0;
}

.result-sticker {
    font-size: 64px;
    margin: 16px 0;
}

.result-sticker-text {
    font-size: 16px;
    color: var(--text-light);
}

/* End Screen */
.end-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    text-align: center;
    background: linear-gradient(180deg, #fef3c7 0%, #fecaca 100%);
}

.end-mascot {
    font-size: 100px;
}

.end-title {
    font-size: 32px;
    font-weight: 700;
    margin: 16px 0;
}

.end-stats {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 24px 0;
    width: 100%;
    max-width: 320px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-dark);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-light);
}

.stat-value {
    font-weight: 600;
}

/* Settings */
.settings-screen {
    padding: 16px;
}

.settings-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 14px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-dark);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-weight: 500;
}

/* Toggle Switch */
.toggle {
    width: 52px;
    height: 32px;
    background: var(--bg-dark);
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle.active {
    background: var(--primary);
}

.toggle::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    background: var(--white);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition);
    box-shadow: var(--shadow);
}

.toggle.active::after {
    transform: translateX(20px);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.modal-content h2 {
    margin-bottom: 8px;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Parent Gate */
.gate-hold-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--white);
    font-size: 32px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    margin: 24px auto;
    display: block;
}

.gate-hold-btn .progress-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--secondary);
}

.gate-hold-btn.holding .progress-ring {
    animation: gate-spin 2s linear forwards;
}

@keyframes gate-spin {
    to { transform: rotate(360deg); }
}

#pin-entry {
    margin-top: 24px;
}

#pin-input {
    width: 160px;
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    margin: 16px auto;
    display: block;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.toast {
    background: var(--text);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius);
    margin-top: 8px;
    animation: toast-in 0.3s;
}

.toast.error {
    background: var(--error);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.avatar-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--bg-dark);
    border: 3px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

.avatar-option.selected {
    border-color: var(--primary);
    background: #eef2ff;
}

/* Sticker Collection */
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.sticker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.sticker-item.locked {
    opacity: 0.3;
    filter: grayscale(1);
}

/* Hidden utility */
.hidden {
    display: none !important;
}
