:root {
    --green: #12AB78;
    --green-dark: #0e8f64;
    --ink: #31393F;
    --muted: #6b757b;
    --bg: #f6f8f7;
    --card: #ffffff;
    --line: #e4e9e7;
    --radius: 16px;
    --shadow: 0 2px 10px rgba(49, 57, 63, .08);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: .75rem 1rem;
    padding-top: calc(.75rem + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-logo { display: inline-flex; }
.app-main { flex: 1; padding-top: 1.25rem; padding-bottom: 2rem; max-width: 880px; }
.app-footer { max-width: 880px; padding: 1rem; text-align: center; }

/* Dashboard */
.dashboard-hero { margin: 1rem 0 1.75rem; }
.dashboard-title { color: var(--ink); letter-spacing: -.02em; margin: 0; }
.title-rule { display: block; width: 96px; height: 5px; border-radius: 3px; background: var(--green); margin-top: .75rem; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 720px) { .category-grid { grid-template-columns: repeat(4, 1fr); } }

.category-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1rem 1.25rem;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    transition: transform .12s ease, box-shadow .12s ease;
    min-height: 150px;
}
.category-card:active { transform: scale(.98); }
@media (hover:hover) { .category-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(49,57,63,.12); } }

.category-icon { color: var(--green); width: 44px; height: 44px; margin-bottom: .35rem; }
.category-icon svg { width: 100%; height: 100%; }
.category-name { font-size: 1.35rem; font-weight: 700; }
.category-tagline { font-size: .85rem; color: var(--muted); line-height: 1.3; }

/* Section headers (category / tool pages) */
.back-link { color: var(--green-dark); text-decoration: none; font-weight: 600; font-size: .95rem; }
.back-link:hover { text-decoration: underline; }

.section-head { margin: 1rem 0 1.5rem; }
.section-icon { color: var(--green); display: inline-block; width: 40px; height: 40px; }
.section-icon svg { width: 100%; height: 100%; }
.section-title { font-size: 2rem; font-weight: 800; margin: .35rem 0 .25rem; letter-spacing: -.02em; }
.section-tagline { color: var(--muted); margin: 0; }
.scripture { font-style: italic; color: var(--green-dark); font-weight: 600; }

/* Tool list (multi-tool categories) */
.tool-list { display: flex; flex-direction: column; gap: .75rem; }
.tool-list-item {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.25rem; text-decoration: none; color: var(--ink);
    display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow);
}
.tool-list-name { font-weight: 700; font-size: 1.1rem; display: block; }
.tool-list-scripture { color: var(--muted); font-size: .85rem; }
.chevron { color: var(--green); font-size: 1.6rem; line-height: 1; }

/* Resource cards */
.resource-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 560px) { .resource-grid { grid-template-columns: repeat(4, 1fr); } }

.resource-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem 1rem; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem;
    text-decoration: none; color: var(--ink); cursor: pointer; font: inherit; width: 100%;
    transition: transform .12s ease, box-shadow .12s ease;
}
.resource-card:active { transform: scale(.98); }
@media (hover:hover) { .resource-card:hover:not(.is-disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(49,57,63,.12); } }
.resource-icon { color: var(--green); width: 40px; height: 40px; }
.resource-icon svg { width: 100%; height: 100%; }
.resource-label { font-weight: 700; }
.resource-sub { font-size: .8rem; color: var(--muted); }
.resource-card.is-disabled { opacity: .55; cursor: default; box-shadow: none; }
.resource-card.is-disabled .resource-icon { color: var(--muted); }

/* Viewer overlays (slideshow + video) */
.viewer {
    position: fixed; inset: 0; z-index: 1000; background: rgba(20,24,26,.94);
    display: flex; flex-direction: column;
}
.viewer[hidden] { display: none; }
.viewer-bar {
    display: flex; align-items: center; gap: 1rem; color: #fff;
    padding: .75rem 1rem; padding-top: calc(.75rem + env(safe-area-inset-top));
}
.viewer-title { font-weight: 600; font-size: .95rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-counter { font-variant-numeric: tabular-nums; opacity: .85; font-size: .9rem; }
.viewer-close { background: none; border: none; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 .25rem; }
.viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; padding: .5rem; min-height: 0; }
.viewer-slide { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,.5); user-select: none; }
.viewer-video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.14); color: #fff; border: none; cursor: pointer;
    width: 48px; height: 64px; font-size: 2.2rem; line-height: 1; border-radius: 10px;
}
.viewer-nav:hover { background: rgba(255,255,255,.26); }
.viewer-nav.prev { left: .5rem; }
.viewer-nav.next { right: .5rem; }
.viewer-nav:disabled { opacity: .3; cursor: default; }
