/* ===========================================================================
   Church of Chocolate — Cult Membership App
   Ported from the original desktop app, kept true to form, made responsive
   for both desktop and mobile. Structural look/colours/wording unchanged;
   all responsive behaviour lives in the media queries at the bottom.
   =========================================================================== */

@font-face {
    font-family: 'Kefa';
    src: url('KefaIII.ttf') format('truetype');
    font-display: swap;
}

:root {
    --primary-color: #5D4037;
    /* Chocolate Brown */
    --secondary-color: #8D6E63;
    /* Lighter Brown */
    --accent-color: #D7CCC8;
    /* Creamy White */
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-color: #3E2723;
    --border-color: #E0E0E0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh;
    /* Allow scroll */
    overflow-y: auto;
}

img {
    max-width: 100%;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* Header */
.dashboard-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.logo-link {
    display: flex;
    align-items: center;
}

.logo-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    cursor: pointer;
}

.dashboard-header h1 {
    font-size: 2rem;
    color: #000000;
    font-weight: 800;
    letter-spacing: 1px;
    font-family: 'Kefa', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Dashboard Grid */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    padding-bottom: 40px;
    /* Extra space at bottom */
}

.dashboard-row {
    display: flex;
    gap: 20px;
}

.top-row {
    flex: 1;
    min-height: 400px;
    /* Increased height */
}

.bottom-row {
    flex: 1.5;
    min-height: 500px;
    /* Increased height for calendar */
}

/* Dashboard Cards */
.dashboard-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header {
    margin-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
}

.card-header h2 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Devotional Section */
#devotional-section {
    flex: 1;
}

.devotional-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

#note-input {
    flex: 1;
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    background-color: #FAFAFA;
    transition: border-color 0.3s;
}

#note-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
}

.devotional-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Daily Schedule Section */
.schedule-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Space between card and buttons */
}

#schedule-section {
    flex: 1;
    /* Take remaining space in column */
}

.schedule-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.schedule-lists {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    overflow-y: auto;
}

.schedule-group h3 {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: 600;
}

.simple-list {
    list-style: none;
    padding-left: 10px;
    border-left: 2px solid var(--accent-color);
}

.simple-list li {
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.empty-state {
    color: #999;
    font-style: italic;
    font-size: 0.85rem !important;
}

.schedule-actions {
    display: flex;
    gap: 10px;
    /* margin-top handled by gap in .schedule-column */
}

.action-btn {
    flex: 1;
    padding: 12px;
    /* Slightly larger touch target */
    border: 1px solid var(--secondary-color);
    background: var(--card-bg);
    /* Give it a background since it's outside now */
    color: var(--secondary-color);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    /* Add shadow to stand out */
}

.action-btn:hover {
    background: var(--secondary-color);
    color: white;
}

/* Calendar Section */
#calendar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.calendar-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-controls-header h2 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 0;
}

.calendar-filter-tabs {
    display: flex;
    background: var(--bg-color);
    border-radius: 20px;
    padding: 4px;
    gap: 4px;
}

.filter-tab {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.month-nav button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 5px;
}

/* Calendar scroll wrapper — inert on desktop, a horizontal-scroll safety net
   on very small screens so the 7-column grid can never overflow the page. */
.calendar-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    min-height: 400px;
    /* Ensure calendar has height */
}

.calendar-day {
    background-color: white;
    min-height: 80px;
    padding: 5px;
    font-size: 0.9rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-day.header {
    background-color: var(--bg-color);
    font-weight: bold;
    text-align: center;
    padding: 10px 0;
    min-height: auto;
    color: var(--secondary-color);
}

.calendar-day.empty {
    background-color: #fafafa;
}

.calendar-day.today {
    background-color: #fff8e1;
    /* Light yellow highlight */
}

/* Calendar Event Labels */
.calendar-event {
    font-size: 12pt;
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 3px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    line-height: 1.2;
}

.calendar-event.note-event {
    background-color: var(--secondary-color);
    color: white;
}

.calendar-event.meeting-event {
    background-color: #2196F3;
    color: white;
}

.calendar-event.reminder-event {
    background-color: #4CAF50;
    color: white;
}

.day-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: auto;
    padding-top: 4px;
}

/* Buttons */
button {
    font-family: inherit;
}

#add-note-btn,
#save-new-meeting-btn,
#save-new-reminder-btn,
#add-color-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

#add-note-btn:hover,
#save-new-meeting-btn:hover,
#save-new-reminder-btn:hover,
#add-color-btn:hover {
    background-color: #4E342E;
}

.icon-only-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-only-btn:hover {
    color: var(--primary-color);
}

.icon-only-btn svg {
    display: block;
}

.secondary-btn {
    background: transparent;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--card-bg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 25px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0 4px;
}

.close-modal:hover {
    color: var(--primary-color);
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

.form-row input,
.form-row select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.form-row input[type="color"] {
    width: 80px;
    height: 80px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    align-self: flex-start;
}

.form-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.form-row input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Meeting notes textarea inside the Add Meeting modal (inline-styled in markup) */
#new-meeting-notes {
    font-size: 1rem;
}

/* Color Management Modal */
.color-management-section {
    margin-bottom: 20px;
}

.color-management-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

.color-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.color-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.color-list-item:hover {
    background-color: #f0f0f0;
}

.color-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-info span {
    font-weight: 500;
    color: var(--text-color);
}

.color-list-item .delete-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.color-list-item .delete-btn:hover {
    background-color: #ffebee;
    color: #dc3545;
}

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

/* Devotionals Detail Page */
.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-family: inherit;
}

.back-button:hover {
    background: var(--secondary-color);
    color: white;
}

.back-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.devotionals-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.devotionals-header {
    margin-bottom: 30px;
    text-align: center;
}

.devotionals-header h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.devotionals-count {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 500;
}

.devotionals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.devotional-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.devotional-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.devotional-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bg-color);
}

.devotional-number {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.devotional-time {
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.devotional-card-body {
    color: var(--text-color);
    line-height: 1.6;
}

.devotional-card-body p {
    margin: 0;
    white-space: pre-wrap;
}

.empty-state-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.empty-state-page p {
    font-size: 1.2rem;
    color: #999;
    margin-bottom: 20px;
}

/* Keep the "Return to Dashboard" button its natural size inside the
   centered column flexbox (otherwise flex:1 stretches it full-height). */
.empty-state-page .action-btn {
    flex: 0 0 auto;
    padding-left: 28px;
    padding-right: 28px;
}

/* ===========================================================================
   RESPONSIVE
   Desktop rendering above is unchanged. Below: tablet, then phone.
   =========================================================================== */

/* Tablet / small laptop — stack the two dashboard rows, ease fixed heights */
@media (max-width: 900px) {
    .dashboard-row {
        flex-direction: column;
    }

    .top-row,
    .bottom-row {
        min-height: 0;
    }

    .dashboard-grid {
        overflow-y: visible;
        padding-bottom: 20px;
    }

    body {
        overflow: auto;
    }

    .devotionals-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* Phone / large phone */
@media (max-width: 640px) {
    #app {
        padding: 14px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .dashboard-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
        letter-spacing: 0.5px;
    }

    .logo-image {
        width: 48px;
        height: 48px;
    }

    .dashboard-card {
        padding: 16px;
    }

    /* Devotional entry: give the textarea a sane minimum, let actions wrap */
    #note-input {
        min-height: 140px;
    }

    .devotional-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .devotional-actions #add-note-btn {
        flex: 1 1 auto;
    }

    /* Calendar controls: stack the title, filter pills and month nav */
    .calendar-controls-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .calendar-filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }

    .filter-tab {
        flex: 1 0 auto;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .month-nav {
        justify-content: space-between;
    }

    .month-nav button {
        font-size: 1.4rem;
        padding: 6px 14px;
    }

    #current-month-year {
        font-weight: 600;
    }

    /* Calendar grid: keep all 7 columns (true to form), shrink to fit.
       .calendar-scroll is the overflow safety net if a device is narrower
       than the grid's floor width. */
    .calendar-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-grid {
        min-height: 300px;
        min-width: 300px;
    }

    .calendar-day {
        min-height: 56px;
        padding: 3px;
        font-size: 0.8rem;
    }

    .calendar-day .date-number {
        font-size: 0.78rem;
    }

    .calendar-day.header {
        padding: 6px 0;
        font-size: 0.68rem;
    }

    .calendar-event {
        font-size: 0.6rem;
        padding: 1px 3px;
    }

    .day-content {
        padding-top: 2px;
    }

    /* Modals: a touch wider, a touch less padding */
    .modal-content {
        width: 94%;
        padding: 20px;
    }

    .close-modal {
        font-size: 32px;
        padding: 0 8px;
    }

    /* 16px form controls stop iOS Safari from auto-zooming on focus */
    .form-row input,
    .form-row select,
    #note-input,
    #new-meeting-notes {
        font-size: 16px;
    }

    /* Devotionals detail page */
    .devotionals-page {
        padding: 14px;
    }

    .devotionals-header {
        margin-bottom: 20px;
    }

    .devotionals-header h2 {
        font-size: 1.35rem;
    }

    .devotionals-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    #devotionals-date-header {
        flex-basis: 100%;
        font-size: 1.25rem;
    }

    /* Collapse the back button to just its icon to save the top row */
    .back-button {
        padding: 8px;
    }

    .back-button-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* Small phone */
@media (max-width: 400px) {
    .dashboard-header h1 {
        font-size: 1.25rem;
    }

    .schedule-actions {
        flex-direction: column;
    }

    .calendar-day {
        min-height: 48px;
    }

    .calendar-event {
        font-size: 0.55rem;
    }
}

/* Coarse pointers: make the small tap targets in the calendar comfortable */
@media (pointer: coarse) {
    .filter-tab {
        min-height: 36px;
    }

    .month-nav button {
        min-height: 40px;
        min-width: 40px;
    }

    .close-modal {
        min-width: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===========================================================================
   SITE NAV  (added for the multi-page build — Dashboard / Survey / Membership /
   Chocolate Chess). Inline links on desktop; hamburger drawer on phones.
   =========================================================================== */

.site-nav {
    margin-left: auto;
    position: relative;
}

.site-nav-links {
    display: flex;
    gap: 6px;
}

.site-nav-links a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
}

.site-nav-links a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.site-nav-links a.active {
    background: var(--primary-color);
    color: #fff;
}

/* "Depart the Church" — the way out. Set apart from the section links. */
.site-nav-depart {
    color: var(--primary-color) !important;
    border: 1px solid var(--secondary-color) !important;
    font-style: italic;
    margin-left: 6px;
}

.site-nav-depart:hover {
    background: var(--primary-color) !important;
    color: #fff !important;
}

.site-nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.site-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.site-nav.open .site-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-nav.open .site-nav-toggle span:nth-child(2) {
    opacity: 0;
}

.site-nav.open .site-nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 760px) {
    .site-nav-toggle {
        display: flex;
    }

    .site-nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        flex-direction: column;
        gap: 4px;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
        padding: 8px;
        min-width: 200px;
        z-index: 200;
        display: none;
    }

    .site-nav.open .site-nav-links {
        display: flex;
    }

    .site-nav-links a {
        padding: 12px 14px;
    }

    .site-nav-depart {
        margin-left: 0;
        margin-top: 4px;
        border: none !important;
        border-top: 1px solid var(--border-color) !important;
        border-radius: 0 !important;
    }
}

/* ===========================================================================
   SHARED PAGE HELPERS  (survey / membership pages)
   =========================================================================== */

.page-narrow {
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 40px;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.6rem;
    color: var(--primary-color);
    font-family: 'Kefa', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.close-link {
    font-size: 30px;
    line-height: 1;
    text-decoration: none;
    color: #aaa;
    padding: 0 8px;
}

.close-link:hover {
    color: var(--primary-color);
}

/* ===========================================================================
   CHURCH SURVEY
   =========================================================================== */

.survey-progress {
    margin-bottom: 20px;
}

.survey-progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.survey-progress-bar {
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
}

.survey-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.survey-card .card-header h2 {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-color);
    font-size: 1.15rem;
    line-height: 1.4;
}

.survey-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

.survey-answer {
    text-align: left;
    padding: 16px;
    border: 2px solid var(--secondary-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.15s;
}

.survey-answer:hover {
    background: var(--bg-color);
}

.survey-answer.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.survey-nav {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.survey-nav .action-btn,
.survey-nav .survey-next-btn {
    flex: 1;
}

.survey-nav--stack {
    flex-direction: column;
}

.survey-next-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.survey-next-btn:hover {
    background: #4E342E;
}

.survey-next-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.survey-complete-text {
    text-align: center;
    line-height: 1.6;
    margin-bottom: 14px;
}

.survey-complete-sub {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.survey-membership {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
    margin: 0 auto 22px;
    max-width: 320px;
    background: var(--bg-color);
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius);
}

.survey-membership-label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-weight: 600;
}

.survey-membership-number {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary-color);
}

/* ===========================================================================
   MEMBERSHIP CARD  (flip + idle wiggle, ported from the mobile app)
   =========================================================================== */

.membership-empty {
    text-align: center;
    line-height: 1.6;
    margin-bottom: 18px;
}

.membership-cta {
    display: block;
    max-width: 240px;
    margin: 0 auto;
}

.membership-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding-top: 10px;
}

.membership-card-wrap {
    width: 100%;
    max-width: 400px;
    perspective: 1400px;
}

.membership-card-wrap.wiggle {
    animation: card-wiggle 0.45s ease-in-out;
}

@keyframes card-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    50% { transform: rotate(-2deg); }
    75% { transform: rotate(1deg); }
}

.membership-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1.6 / 1;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.membership-card.flipped {
    transform: rotateY(180deg);
}

.membership-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: #5A3391;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.membership-back {
    transform: rotateY(180deg);
}

.membership-card-head {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.membership-card-head--end {
    justify-content: flex-end;
}

.membership-logo-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #F2E3CA;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.membership-logo-btn img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.membership-card-title {
    color: #D7CCC8;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.membership-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.membership-card-body--center {
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.membership-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.membership-id {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 2px;
    font-family: monospace;
}

.membership-date {
    color: #fff;
    font-size: 1rem;
}

.membership-card-foot {
    text-align: right;
    color: #D7CCC8;
    font-size: 0.6rem;
    letter-spacing: 2px;
    font-weight: 700;
}

.membership-qr {
    width: 96px;
    height: 96px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.membership-sign {
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    padding-top: 6px;
    width: 70%;
    text-align: center;
}

.membership-sign span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.62rem;
    font-style: italic;
}

.membership-info {
    text-align: center;
    font-style: italic;
    color: var(--text-color);
    max-width: 340px;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* ===========================================================================
   HIDDEN: triple-tap "Calendar" reveal overlay
   =========================================================================== */

.secret-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 2s ease;
    z-index: 9999;
    pointer-events: none;
}

.secret-overlay.show {
    opacity: 1;
    visibility: visible;
}

.secret-overlay-logo {
    width: min(80vw, 420px);
    height: auto;
}

/* ===========================================================================
   HIDDEN: "the old ways" — runic theme (type #000001 in the devotional box).
   Session-scoped; keyed off <html class="runic">.
   =========================================================================== */

:root.runic {
    --primary-color: #8b0000;
    --secondary-color: #c56b6b;
    --accent-color: #a52a2a;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --border-color: #444;
}

html.runic body {
    background-color: #1a1a1a;
}

html.runic .dashboard-header h1,
html.runic .page-title {
    color: #f0dede;
    font-style: italic;
    letter-spacing: 2px;
}

html.runic #note-input {
    background-color: #222;
    color: #e0e0e0;
}

html.runic #note-input:focus {
    background-color: #262626;
}

html.runic .calendar-grid {
    background-color: #444;
    border-color: #444;
}

html.runic .calendar-day {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

html.runic .calendar-day.empty {
    background-color: #262626;
}

html.runic .calendar-day.today {
    background-color: #3a2a2a;
}

html.runic .calendar-day.header {
    background-color: #222;
    color: #c56b6b;
}

html.runic .filter-tab {
    color: #ddd;
}

html.runic .filter-tab.active {
    background: #2d2d2d;
    color: #ff9999;
}

html.runic .action-btn,
html.runic .secondary-btn {
    color: #ff9999;
}

html.runic .action-btn {
    border-color: #ff9999;
    background: transparent;
}

html.runic #add-note-btn,
html.runic #save-new-meeting-btn,
html.runic #save-new-reminder-btn,
html.runic #add-color-btn,
html.runic .survey-next-btn {
    background-color: #8b0000;
}

html.runic .simple-list {
    border-left-color: #8b0000;
}

html.runic .modal-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

html.runic .form-row input,
html.runic .form-row select {
    background: #222;
    color: #e0e0e0;
    border-color: #444;
}

/* ===========================================================================
   HIDDEN: runic-mode transition — slow crossfade + a big proclamation
   ("The Gods Awake" / "The Gods Slumber") when #000001 toggles the theme.
   =========================================================================== */

.runic-veil {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 1.2s ease, visibility 1.2s ease;
}

.runic-veil.show {
    opacity: 1;
    visibility: visible;
}

.runic-veil.to-dark {
    background: #120d0b;
}

.runic-veil.to-light {
    background: #f4f1ec;
}

.runic-veil__msg {
    font-family: 'Kefa', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 800;
    font-size: clamp(2.25rem, 9vw, 5rem);
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    filter: blur(8px);
    transition: opacity 1s ease 0.2s, transform 1.3s ease 0.2s, filter 1s ease 0.2s;
}

.runic-veil__msg.show {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

.runic-veil.to-dark .runic-veil__msg {
    color: #c62828;
    text-shadow: 0 0 28px rgba(139, 0, 0, 0.7), 0 0 4px rgba(0, 0, 0, 0.5);
}

.runic-veil.to-light .runic-veil__msg {
    color: #5D4037;
    text-shadow: 0 0 18px rgba(93, 64, 55, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    .runic-veil,
    .runic-veil__msg {
        transition-duration: 0.35s;
    }
}

/* Ease the themed surfaces so the sliver of time at the edges of the veil
   still slews rather than snapping. (Elements with their own hover
   transitions are deliberately left out.) */
body,
.dashboard-card,
.simple-list,
.calendar-grid,
.calendar-day,
.calendar-day.header,
.card-header,
.card-header h2,
.schedule-group h3,
.dashboard-header h1,
.page-title,
.modal-content {
    transition: background-color 0.9s ease, color 0.9s ease, border-color 0.9s ease;
}
