:root {
    --primary-blue: #2563eb;
    --dark-blue: #1e3a8a;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --fewing-color: #fef3c7;
    --fewing-border: #d97706;
    --nkusi-color: #fee2e2;
    --nkusi-border: #dc2626;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    padding: 16px;
    overflow-x: hidden;
}

header {
    text-align: center;
    margin-bottom: 16px;
}

h1 {
    font-size: 1.5rem;
    color: var(--dark-blue);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Prominent Display */
.prominent-card {
    text-align: center;
    background: var(--primary-blue);
    color: white;
    padding: 24px 16px;
}

#prominent-gregorian {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.9;
}

#prominent-village {
    font-size: 2.5rem;
    font-weight: 800;
    margin-top: 8px;
    text-transform: uppercase;
}

/* Daily Saying */
.saying-card {
    text-align: center;
    font-style: italic;
    color: var(--dark-blue);
    background: #eff6ff;
    border-left: 4px solid var(--primary-blue);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.selectors, .nav-buttons {
    display: flex;
    gap: 8px;
}

select, input[type="number"], button {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

button {
    background: var(--primary-blue);
    color: white;
    border: none;
    font-weight: 600;
}

button:hover {
    background: var(--dark-blue);
}

input[type="number"] {
    width: 80px;
}

/* Calendar Grid */
.calendar-container {
    padding: 8px;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
}

.day-cell {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 1px;
    text-align: center;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    width: 100%;
}

.day-cell:hover {
    background: #e5e7eb;
}

.day-cell.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.gregorian-date {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
}

.village-day {
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
    max-width: 100%;
    line-height: 1;
}

/* Special Highlights */
.day-cell.fewing {
    background-color: var(--fewing-color);
    border-color: var(--fewing-border);
}
.day-cell.fewing .village-day {
    color: var(--fewing-border);
    font-weight: 700;
}

.day-cell.nkusi {
    background-color: var(--nkusi-color);
    border-color: var(--nkusi-border);
}
.day-cell.nkusi .village-day {
    color: var(--nkusi-border);
    font-weight: 700;
}

.day-cell.selected {
    outline: 3px solid var(--primary-blue);
    outline-offset: -1px;
}

/* Marketing */
.marketing-section {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-marketing {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: opacity 0.2s;
}

.btn-marketing:hover {
    opacity: 0.9;
}

.brainfueler-btn {
    background-color: #10b981;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 320px;
    width: 90%;
    position: relative;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Footer */
footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 32px;
    padding-bottom: 16px;
}

.footer-link {
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 600;
}

.footer-link:hover {
    text-decoration: underline;
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark-blue);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    z-index: 90;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}

.install-text {
    font-size: 0.85rem;
    flex: 1;
}

.install-actions {
    display: flex;
    gap: 8px;
}

.install-actions button {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: white;
    color: var(--dark-blue);
    border-radius: 6px;
}

.install-actions #btn-dismiss {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
}

/* =========================================
   MOBILE ADJUSTMENTS
   ========================================= */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .selectors, .nav-buttons {
        justify-content: space-between;
    }

    select, input[type="number"] {
        flex: 1;
    }

    #prominent-village {
        font-size: 1.8rem;
    }

    #prominent-gregorian {
        font-size: 0.95rem;
    }

    .card {
        padding: 12px;
        border-radius: 10px;
    }

    .calendar-container {
        padding: 6px;
    }

    .day-cell {
        min-height: 50px;
        padding: 2px 0;
        border-radius: 5px;
    }

    .gregorian-date {
        font-size: 0.8rem;
    }

    .village-day {
        font-size: 0.5rem;
        letter-spacing: -0.4px;
        margin-top: 2px;
    }

    .weekdays {
        font-size: 0.7rem;
    }

    .saying-card {
        font-size: 0.85rem;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .village-day {
        font-size: 0.45rem;
        letter-spacing: -0.5px;
    }

    .gregorian-date {
        font-size: 0.75rem;
    }

    .day-cell {
        min-height: 44px;
    }
}