* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    overflow: hidden;
}

/* Login Page */
.login-page {
    background: #003366;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 400px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-box h1 {
    text-align: center;
    color: #003366;
    margin-bottom: 30px;
    font-size: 2em;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

.form-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-section input,
.form-section textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-section input:focus,
.form-section textarea:focus {
    outline: none;
    border-color: #003366;
}

.form-section textarea {
    min-height: 80px;
    resize: vertical;
}

.form-section button {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.form-section button:hover {
    background: #004080;
}

.form-section button:active {
    transform: scale(0.98);
}

.switch-form {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

.switch-form a {
    color: #003366;
    text-decoration: none;
    font-weight: bold;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.message.success {
    background: #e6f2ff;
    color: #003366;
    border: 1px solid #003366;
    display: block;
}

.message.error {
    background: #ffe6e6;
    color: #003366;
    border: 1px solid #003366;
    display: block;
}

/* Game Page */
.game-page {
    background: #87CEEB;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-width: 100vw;
}

#game-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 300px;
    min-height: 300px;
    z-index: 1;
    direction: ltr;
    overflow: hidden;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateZ(0);
    background: #87CEEB;
}
#game-container canvas {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 300px !important;
    min-height: 300px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.ui-overlay > * {
    pointer-events: auto;
}

.top-bar {
    background: linear-gradient(135deg, #003366 0%, #004080 50%, #003366 100%);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 45px;
    box-shadow: 0 4px 16px rgba(0,51,102,0.35);
}

.weather-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
    min-width: 120px;
}

.weather-icon {
    font-size: 1.2em;
}

.weather-text {
    color: white;
    font-weight: 500;
}

.player-info {
    display: flex;
    flex-direction: row;
    gap: 12px;
    font-size: 0.75em;
    align-items: center;
    flex-wrap: wrap;
}

.player-info span {
    display: inline;
    white-space: nowrap;
}

/* Mobile: Toggle button for player info */
.player-info-toggle {
    display: none;
}

.player-info-content {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .top-bar {
        padding: 6px 10px;
        min-height: 40px;
    }
    
    .player-info {
        position: relative;
    }
    
    .player-info-toggle {
        display: inline-block;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
        font-size: 16px;
        padding: 4px 8px;
        border-radius: 4px;
        cursor: pointer;
    }
    
    .player-info-content {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: #003366;
        padding: 10px;
        border-radius: 8px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        z-index: 1000;
        margin-top: 5px;
        min-width: 200px;
    }
    
    .player-info-content.show {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    
    .player-info-content span {
        display: block;
        padding: 2px 0;
    }
    
    .weather-info {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

#calories-display {
    font-size: 0.9em;
    color: #ffffff;
    opacity: 0.9;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.menu-btn:active {
    transform: scale(0.98);
}

.side-menu {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #f0f4f8 100%);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15), -2px 0 8px rgba(0,51,102,0.08);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid rgba(0,51,102,0.12);
}

.side-menu.open {
    right: 0;
    box-shadow: -8px 0 32px rgba(0,0,0,0.2), -4px 0 16px rgba(0,51,102,0.12);
}

.menu-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,51,102,0.25);
}

.menu-header button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: background 0.25s ease, transform 0.2s ease;
}

.menu-header button:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.menu-content {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Custom scrollbar for menu */
.menu-content::-webkit-scrollbar {
    width: 8px;
}

.menu-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.menu-content::-webkit-scrollbar-thumb {
    background: #003366;
    border-radius: 4px;
}

.menu-content::-webkit-scrollbar-thumb:hover {
    background: #004080;
}

.menu-content button {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid rgba(0,51,102,0.2);
    border-radius: 12px;
    font-size: 16px;
    text-align: right;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #003366;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.menu-content button:hover {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0,51,102,0.25);
    border-color: transparent;
}

.menu-content button:active {
    background: #004080;
    color: white;
    transform: translateX(-2px) scale(0.98);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    align-items: center;
    justify-content: center;
    animation: modalBackdropFade 0.25s ease;
}

@keyframes modalBackdropFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: visible;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,51,102,0.08);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 12px rgba(0,51,102,0.2);
}

.modal-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-header button:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.08);
}

.modal-body {
    padding: 20px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(85vh - 140px) !important;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    flex: 1;
    position: relative;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #003366;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #004080;
}

.add-food-section {
    background: #f8f9fa;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.add-food-section input,
.add-food-section select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
}

.add-food-section input:focus,
.add-food-section select:focus {
    outline: none;
    border-color: #003366;
    border-width: 2px;
}

.add-food-section button {
    width: 100%;
    padding: 10px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.add-food-section button:hover {
    background: #004080;
}

.food-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 10px 0;
    width: 100%;
}

.food-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #003366;
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.food-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #003366;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.food-item:hover {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
    border-color: #ffffff;
}

.food-item:hover::before {
    transform: scaleX(1);
    background: #ffffff;
}

.food-item:active {
    transform: translateY(-2px) scale(0.98);
}

.food-item .food-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #003366;
    transition: color 0.3s ease;
}

.food-item:hover .food-name {
    color: white;
}

.food-item .food-calories {
    color: #003366;
    font-size: 0.95em;
    font-weight: 600;
    padding: 5px 12px;
    background: rgba(0, 51, 102, 0.1);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.food-item:hover .food-calories {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

#stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    background: white;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
}

.stat-item label {
    font-weight: bold;
    color: #003366;
}

.subject-section {
    margin: 14px 0;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
}
.subject-section h3 { margin-bottom: 8px; color: #87ceeb; }

#players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-right: 4px solid #003366;
}

.player-card.consultant {
    border-right-color: #003366;
    background: #e6f2ff;
}

.player-card h3 {
    margin-bottom: 10px;
}

.player-card .consultant-badge {
    background: #003366;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8em;
    margin-right: 10px;
}

.chat-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,51,102,0.06);
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.25s ease;
}

.chat-container:hover {
    box-shadow: 0 -6px 24px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,51,102,0.08);
}

.chat-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 20px 20px 0 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    max-height: 300px;
    display: none;
}

.chat-messages.open {
    display: block;
}

.chat-message {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #003366;
    border-radius: 10px;
}

.chat-message .username {
    font-weight: bold;
    color: #003366;
    font-size: 0.9em;
}

.chat-input-container {
    display: none;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
}

.chat-input-container.open {
    display: flex;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
}

.chat-input-container input:focus {
    outline: none;
    border-width: 2px;
}

.chat-input-container button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-input-container button:hover {
    background: #004080;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 51, 102, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease-out;
}
.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    display: none;
}
/* כשהמשחק רץ (index.html) – מסך הטעינה לא מכסה */
body.game-ready .loading-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -9999 !important;
}
.loading-content {
    text-align: center;
    color: white;
}
.loading-content p {
    margin-top: 16px;
    font-size: 1.1em;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.disclosure {
    position: fixed;
    bottom: 0;
    right: 0;
    background: #003366;
    color: white;
    font-size: 0.7em;
    max-width: 300px;
    z-index: 50;
    border-radius: 10px 0 0 0;
    opacity: 0.9;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}
.disclosure .disclosure-content {
    padding: 10px;
    max-height: 120px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.25s ease;
}
.disclosure.collapsed .disclosure-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}
.disclosure-toggle {
    width: 100%;
    height: 32px;
    background: #003366;
    color: white;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.2s;
}
.disclosure-toggle:hover {
    background: #004080;
}

/* Music recorder / sheet music modal */
.music-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.music-controls button {
    padding: 8px 14px;
    background: #003366;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}
.music-controls button:hover:not(:disabled) {
    background: #004080;
}
.music-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.music-hint {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 10px;
}
.music-hint-row {
    font-size: 0.85em;
    color: #555;
    margin: 12px 0 6px 0;
}
.music-hint-row:first-of-type { margin-top: 0; }
.piano-white button {
    background: #f5f5f5;
    color: #1a1a1a;
    border: 2px solid #333;
}
.piano-black button {
    background: #2d2d2d;
    color: #fff;
    border: 2px solid #111;
}
.piano-black button:hover {
    background: #404040;
}
.music-notes-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.music-notes-row button {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1.2rem;
    background: #003366;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.piano-notes {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.piano-notes button {
    min-width: 44px;
    height: 44px;
    padding: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    background: #f0f0f0;
    color: #003366;
    border: 2px solid #003366;
    border-radius: 8px;
    cursor: pointer;
}
.piano-notes button:hover {
    background: #e0e8f0;
}
.sheet-music-wrap {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    overflow-x: auto;
}
#sheet-music-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.plan-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-right: 4px solid #003366;
    border: 1px solid #003366;
}

.plan-item h4 {
    margin-bottom: 10px;
    color: #003366;
}

.plan-item small {
    color: #666;
    font-size: 0.8em;
}

.settings-section {
    background: white;
    border: 1px solid #003366;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #003366;
}

.settings-section label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

.settings-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
    min-height: 80px;
    margin-bottom: 10px;
}

.settings-section textarea:focus {
    outline: none;
    border-width: 2px;
}

.settings-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #003366;
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 10px;
    background: white;
    color: #003366;
}

.settings-section select:focus {
    outline: none;
    border-width: 2px;
}

.settings-section button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.settings-section button:hover {
    background: #004080;
}

/* Shop Styles */
.shop-items {
    margin-bottom: 30px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.shop-item {
    background: white;
    border: 2px solid #003366;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.shop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
}

.shop-item-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.shop-item-name {
    font-weight: bold;
    font-size: 1.2em;
    color: #003366;
    margin-bottom: 8px;
}

.shop-item-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.shop-item-price {
    font-weight: bold;
    color: #003366;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.shop-buy-btn {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.shop-buy-btn:hover:not(:disabled) {
    background: #004080;
}

.shop-buy-btn:disabled {
    background: #4CAF50;
    cursor: not-allowed;
}

.my-gadgets {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #003366;
}

.gadget-item {
    background: #f8f9fa;
    border: 1px solid #003366;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.gadget-icon {
    font-size: 2em;
}

.gadget-name {
    font-weight: bold;
    color: #003366;
    font-size: 1.1em;
}

/* Education Styles */
.schools-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.school-item {
    background: white;
    border: 2px solid #003366;
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.school-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.2);
}

.school-item h4 {
    color: #003366;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.school-item p {
    color: #666;
    margin-bottom: 15px;
}

.school-item button {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.school-item button:hover {
    background: #004080;
}

.house-item {
    background: white;
    border: 1px solid #003366;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.house-item button {
    margin: 5px;
    padding: 8px 15px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.house-item button:hover {
    background: #004080;
}

.social-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.social-btn {
    padding: 15px;
    background: white;
    border: 2px solid #003366;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #003366;
    cursor: pointer;
    transition: all 0.3s;
}

.social-btn:hover {
    background: #003366;
    color: white;
    transform: translateY(-3px);
}

/* Quiz Styles */
.quiz-option-btn {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #003366;
    border-radius: 10px;
    font-size: 16px;
    color: #003366;
    cursor: pointer;
    transition: all 0.3s;
    text-align: right;
}

.quiz-option-btn:hover:not(:disabled) {
    background: #003366;
    color: white;
}

.quiz-option-btn:disabled {
    cursor: not-allowed;
}

#quiz-score {
    background: #003366;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
}

#quiz-question-container {
    margin-bottom: 20px;
}

#quiz-question-container h3 {
    color: #003366;
    font-size: 1.3em;
    margin-bottom: 15px;
}

#quiz-next-btn {
    width: 100%;
    padding: 15px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

#quiz-next-btn:hover {
    background: #004080;
}

/* Safe area for notched phones (מובייל) */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}
.ui-overlay .top-bar {
    padding-top: max(8px, env(safe-area-inset-top));
}

/* כפתורים ונגיעה – מינימום 44px לנוחות באצבע */
button, .menu-content button, .food-item, .chat-switch-btn, .profile-tab {
    min-height: 44px;
    min-width: 44px;
}
.menu-content button {
    padding: 14px 15px;
}
.modal-header button, .modal .modal-header button[onclick] {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

/* Mobile Touch Support */
@media (max-width: 768px) {
    .top-bar {
        padding: 6px 10px;
        min-height: 44px;
        font-size: 0.85em;
    }
    
    .player-info-toggle {
        display: inline-block !important;
        min-width: 44px;
        min-height: 44px;
    }
    
    .player-info-content {
        display: none !important;
    }
    
    .player-info-content.show {
        display: flex !important;
    }
    
    .weather-info {
        font-size: 0.75em;
        padding: 6px 10px;
        min-width: 80px;
    }
    
    .menu-btn {
        font-size: 22px;
        padding: 10px 14px;
        min-width: 48px;
        min-height: 48px;
    }
    
    .food-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
        padding: 5px 0;
    }
    
    .food-item {
        padding: 15px;
        min-height: 100px;
    }
    
    .food-item .food-name {
        font-size: 1em;
    }
    
    .food-item .food-calories {
        font-size: 0.85em;
        padding: 4px 10px;
    }
    
    .chat-container {
        max-width: 100%;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .modal {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        align-items: flex-end;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        max-height: 85vh;
        max-height: calc(85vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
    }
    
    .modal-body {
        padding: 15px;
        max-height: calc(85vh - 120px);
        -webkit-overflow-scrolling: touch;
    }
    
    .notification {
        right: max(10px, env(safe-area-inset-right));
        top: max(70px, env(safe-area-inset-top));
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .movement-instructions {
        max-width: 90%;
        padding: 24px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .food-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .food-item {
        padding: 12px;
        min-height: 90px;
    }
    
    .food-item .food-name {
        font-size: 0.9em;
        margin-bottom: 6px;
    }
    
    .food-item .food-calories {
        font-size: 0.8em;
        padding: 3px 8px;
    }
    
    .modal-body {
        padding: 10px;
    }
}

/* Touch-friendly buttons */
button, .food-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Virtual Joystick – מותאם מובייל, נוח לאצבע */
#joystick-area {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: max(20px, env(safe-area-inset-left));
    width: 140px;
    height: 140px;
    background: rgba(0, 51, 102, 0.35);
    border: 3px solid #003366;
    border-radius: 50%;
    z-index: 1000;
    touch-action: none;
    pointer-events: auto;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
@media (max-width: 768px) {
    #joystick-area {
        width: 130px;
        height: 130px;
        bottom: max(16px, env(safe-area-inset-bottom));
        left: max(16px, env(safe-area-inset-left));
    }
}

#joystick-handle {
    position: absolute;
    width: 56px;
    height: 56px;
    background: #003366;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}
@media (max-width: 768px) {
    #joystick-handle {
        width: 52px;
        height: 52px;
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    z-index: 10000;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
}

.notification.success {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    box-shadow: 0 4px 20px rgba(0,51,102,0.35);
}

.notification.info {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    box-shadow: 0 4px 20px rgba(0,51,102,0.35);
}

/* Timer / "when away" – welcome back style */
.notification.welcome-back,
.notification.away-timer {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}
.notification.welcome-back .welcome-back-msg {
    font-weight: bold;
}
.notification.welcome-back .away-duration {
    font-size: 12px;
    opacity: 0.92;
    font-weight: normal;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Movement Instructions */
.movement-instructions {
    position: fixed;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    background: white;
    color: #003366;
    padding: 30px;
    border-radius: 20px;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s ease-out;
    border: 3px solid #003366;
}

.movement-instructions.hidden {
    display: none;
}

.instructions-content h3 {
    margin-bottom: 15px;
    color: #003366;
    text-align: center;
}

.instructions-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.instructions-content button {
    width: 100%;
    padding: 12px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s;
}

.instructions-content button:hover {
    background: #004080;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(50%, -50%) scale(1);
    }
}

/* Context Menu */
#context-menu {
    position: fixed;
    background: white;
    border: 2px solid #003366;
    border-radius: 10px;
    padding: 10px;
    z-index: 10000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    min-width: 150px;
    direction: rtl;
}

#context-menu > div {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    color: #003366;
    font-weight: bold;
    transition: background 0.2s;
    margin-bottom: 5px;
}

#context-menu > div:last-child {
    margin-bottom: 0;
}

#context-menu > div:hover {
    background: #003366;
    color: white;
}

/* Private Chat Styles */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-switch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.chat-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-tabs {
    display: flex;
    background: rgba(0, 51, 102, 0.9);
    border-bottom: 2px solid #003366;
}

.chat-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.chat-tab.active {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: #ffffff;
}

.private-chat-list {
    max-height: 300px;
    overflow-y: auto;
    background: white;
}

.private-chat-item {
    padding: 15px;
    border-bottom: 1px solid #E0E0E0;
    cursor: pointer;
    transition: background 0.2s;
}

.private-chat-item:hover {
    background: #F5F5F5;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.unread-badge {
    background: #FF0000;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
}

.chat-item-preview {
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-time {
    color: #999;
    font-size: 11px;
}

.private-chat-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #F9F9F9;
    margin-bottom: 15px;
}

.private-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    max-width: 80%;
}

.private-message.sent {
    background: #003366;
    color: white;
    margin-left: auto;
    text-align: right;
}

.private-message.received {
    background: #E0E0E0;
    color: #333;
    margin-right: auto;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    opacity: 0.8;
}

.message-content {
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
}

.private-chat-input-container {
    display: flex;
    gap: 10px;
}

.private-chat-input-container input {
    flex: 1;
    padding: 10px;
    border: 2px solid #003366;
    border-radius: 5px;
}

.private-chat-input-container button {
    padding: 10px 20px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.private-chat-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.private-chat-btn:hover {
    background: #004488;
}

/* Profile Tab Styles */
.profile-tabs {
    display: flex;
    border-bottom: 2px solid #003366;
    margin-bottom: 20px;
}

.profile-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #003366;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.profile-tab.active {
    background: rgba(0, 51, 102, 0.1);
    border-bottom-color: #003366;
    font-weight: bold;
}

.profile-tab-content {
    min-height: 400px;
}

.profile-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #E0E0E0;
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: #666;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.btn-secondary:hover {
    background: #777;
}

/* Clothing and Color Picker Styles */
.clothing-section {
    margin-top: 20px;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.color-picker-container input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #003366;
    border-radius: 5px;
    cursor: pointer;
}

.color-picker-container span {
    font-weight: bold;
    color: #003366;
    font-size: 16px;
}

.color-suggestions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.suggestions-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    width: 100%;
}

.color-suggestion {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    border: 2px solid #003366;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-suggestion:hover {
    transform: scale(1.2);
    border-width: 3px;
}

.color-match-indicator {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    color: white;
    font-weight: bold;
}

.profession-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #003366;
    border-radius: 5px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* Finance Styles */
.finance-summary {
    margin-bottom: 20px;
    padding: 15px;
    background: #E3F2FD;
    border-radius: 10px;
}

.balance-display {
    text-align: center;
}

.balance-display h3 {
    font-size: 24px;
    color: #003366;
    margin-bottom: 10px;
}

.bills-section, .expenses-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #E0E0E0;
}

.bills-total {
    background: #FFE0B2;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 18px;
    color: #E65100;
}

.bill-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 2px solid #E0E0E0;
}

.bill-item.paid {
    opacity: 0.6;
    border-color: #4CAF50;
}

.bill-item.unpaid {
    border-color: #FF9800;
}

.bill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bill-name {
    font-weight: bold;
    font-size: 16px;
    color: #003366;
}

.bill-amount {
    font-size: 18px;
    font-weight: bold;
    color: #E65100;
}

.bill-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bill-status.paid {
    color: #4CAF50;
    font-weight: bold;
}

.bill-status.unpaid {
    color: #FF9800;
    font-weight: bold;
}

.bill-date.overdue {
    color: #F44336;
    font-weight: bold;
}

.pay-bill-btn {
    width: 100%;
    padding: 10px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.pay-bill-btn:hover {
    background: #004488;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 8px;
    border: 1px solid #E0E0E0;
}

.expense-name {
    flex: 1;
    color: #333;
}

.expense-amount {
    font-weight: bold;
    color: #E65100;
    margin: 0 15px;
}

.expense-date {
    color: #666;
    font-size: 12px;
}

/* Partner Styles */
.partner-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #E0E0E0;
}

.partner-card {
    background: #E8F5E9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.partner-badge {
    background: #FF69B4;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    margin-top: 5px;
}

.partnership-btn {
    margin-top: 5px;
    padding: 8px 15px;
    background: #FF69B4;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.partnership-btn:hover {
    background: #FF1493;
}

.divorce-btn {
    padding: 10px 20px;
    background: #F44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.divorce-btn:hover {
    background: #D32F2F;
}

.player-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

/* Side menu on mobile – רוחב מלא ונוח */
@media (max-width: 768px) {
    .side-menu {
        width: min(320px, 100vw);
        max-width: 100%;
    }
    
    .notification {
        right: max(10px, env(safe-area-inset-right));
        top: max(70px, env(safe-area-inset-top));
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .movement-instructions {
        max-width: 90%;
        padding: 24px;
    }
    
    .disclosure {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

