:root {
    --primary-color: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-lighter: #BBDEFB;
    --primary-bg: #E3F2FD;
    --accent-color: #2E7D32;
    --accent-bg: #E8F5E9;
    --warn-color: #F57F17;
    --warn-bg: #FFF8E1;
    --danger-color: #C62828;
    --danger-bg: #FFEBEE;
    --sidebar-width: 280px;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --shadow: 0 2px 12px rgba(21, 101, 192, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ── Top Bar ── */
.topbar {
    background: linear-gradient(135deg, #0D47A1, #1565C0);
    color: white;
    padding: 0.9rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-logo {
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    color: white;
    letter-spacing: -0.02em;
}

.topbar-title {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 400;
}

.topbar-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-btn {
    border: 2px solid rgba(255,255,255,0.4);
    background: transparent;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.lang-btn:hover:not(.active) {
    background: rgba(255,255,255,0.15);
}

.back-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s;
}

.back-link:hover { color: white; }

/* ── Layout ── */
.layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    padding: 1.5rem 0;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding: 0.6rem 1.5rem 0.3rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.5rem;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
    border-left-color: var(--primary-light);
}

.sidebar-link.active {
    background: var(--primary-bg);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.sidebar-icon { font-size: 1rem; flex-shrink: 0; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem;
    max-width: 860px;
}

/* ── Section Headings ── */
.manual-section {
    margin-bottom: 4rem;
    scroll-margin-top: 72px;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-bg);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

h1.page-title {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.page-intro {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    max-width: 680px;
}

h2.section-heading {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3.subsection-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.8rem 0 0.6rem;
}

p {
    color: var(--text-light);
    margin-bottom: 0.8rem;
    font-size: 0.97rem;
}

/* ── Use Case Blocks ── */
.usecase {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.usecase-header {
    background: var(--primary-bg);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.usecase-icon { font-size: 1.6rem; flex-shrink: 0; }

.usecase-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.usecase-id {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-light);
    background: white;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--primary-lighter);
    white-space: nowrap;
}

.usecase-body { padding: 1.2rem 1.5rem; }

.usecase-body p {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

/* ── Steps ── */
.steps {
    list-style: none;
    margin: 0.8rem 0;
    counter-reset: step-counter;
}

.steps li {
    counter-increment: step-counter;
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 0.5rem 0;
    color: var(--text-dark);
    font-size: 0.93rem;
    line-height: 1.55;
    border-bottom: 1px solid var(--bg-light);
}

.steps li:last-child { border-bottom: none; }

.steps li::before {
    content: counter(step-counter);
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* ── Result Box ── */
.result-box {
    background: var(--accent-bg);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    padding: 0.7rem 1rem;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: var(--accent-color);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ── Notes / Warnings ── */
.note {
    background: var(--warn-bg);
    border-left: 3px solid var(--warn-color);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    font-size: 0.9rem;
    color: #5f4a00;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.tip {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    font-size: 0.9rem;
    color: var(--primary-dark);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.danger {
    background: var(--danger-bg);
    border-left: 3px solid var(--danger-color);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    font-size: 0.9rem;
    color: var(--danger-color);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }

/* ── Info Table ── */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.info-table th {
    background: var(--primary-color);
    color: white;
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

.info-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    vertical-align: top;
}

.info-table tr:last-child td { border-bottom: none; }
.info-table tr:nth-child(even) td { background: var(--bg-light); }

/* ── Platform Badges ── */
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.platform-badge.android {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #A5D6A7;
}

.platform-badge.ios {
    background: #E3F2FD;
    color: #1565C0;
    border: 1px solid #90CAF9;
}

.platform-badge.both {
    background: #F3E5F5;
    color: #6A1B9A;
    border: 1px solid #CE93D8;
}

/* ── TOC Overview ── */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2.5rem;
}

.toc-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: var(--shadow);
}

.toc-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 101, 192, 0.15);
    color: var(--primary-color);
}

.toc-card-icon { font-size: 1.8rem; flex-shrink: 0; }

.toc-card-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: inherit;
}

.toc-card-text span {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ── Divider ── */
.section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 3rem 0;
}

/* ── Print button ── */
.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1.5px solid var(--border-color);
    color: var(--text-light);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { padding: 1.5rem; }
}

@media (max-width: 600px) {
    h1.page-title { font-size: 1.8rem; }
    h2.section-heading { font-size: 1.4rem; }
    .main-content { padding: 1rem; }
    .toc-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
    .topbar, .sidebar, .print-btn { display: none; }
    .main-content { padding: 0; max-width: 100%; }
    .usecase { break-inside: avoid; }
}

/* ── Screenshot Gallery ── */
.ss-gallery-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 1.8rem 0 0.6rem;
}

.ss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.ss-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid var(--border-color);
    cursor: zoom-in;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #1565C0;
}

.ss-item:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(21,101,192,0.25);
}

.ss-item img {
    width: 100%;
    height: auto;
    display: block;
}

.ss-item .ss-caption {
    padding: 0.45rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-light);
    text-align: center;
    background: white;
}

.ss-placeholder {
    aspect-ratio: 9/19;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.75rem;
}

.ss-placeholder .ss-pl-icon { font-size: 1.8rem; }

@media (max-width: 600px) {
    .ss-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Lightbox ── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: zoom-out;
}

.lightbox-overlay.lb-open {
    opacity: 1;
}

.lightbox-overlay.lb-visible {
    opacity: 1;
}

.lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.lightbox-inner img {
    max-width: 90vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.6);
    display: block;
}

.lightbox-caption {
    margin-top: 12px;
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    text-align: center;
    max-width: 80vw;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.ss-item img { cursor: zoom-in; }
