* { box-sizing: border-box; }
html, body {
    height: 100%;
    margin: 0;
}
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #000;
    color: #eee;
    overflow: hidden;
}
.empty { text-align: center; color: #888; padding: 40px; }

/* ---- Start screen ---- */
.start-screen {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 28px 16px 32px;
}
.start-screen[hidden] { display: none; }
.start-title {
    font-size: 26px; margin: 0 0 10px; color: #d4af37; font-weight: 700; letter-spacing: 0.01em;
    text-align: center; white-space: nowrap; max-width: 100%;
}
@media (max-width: 700px) {
    .start-title { white-space: normal; font-size: 22px; line-height: 1.25; }
}

.start-options {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch;
    gap: 14px; max-width: 920px; width: 100%;
}
.option-group {
    background: #000;
    border: 2px solid #4a90e2;
    border-radius: 12px;
    padding: 6px 16px;
    flex: 1 1 230px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.option-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 230px;
    max-width: 280px;
}
.option-col .option-group { max-width: none; flex: 1; margin-bottom: 5px; }

.photo-panel {
    position: relative;
    border: none;
    background: #000;
    padding: 0;
    overflow: visible;
}
.start-photo {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: auto;
    height: 385px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}
.photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center; text-align: center;
    color: #6b9fdb; font-size: 14px; line-height: 1.5;
    background: repeating-linear-gradient(135deg, #0a0a0a, #0a0a0a 10px, #000 10px, #000 20px);
}
.photo-placeholder[hidden] { display: none; }
.option-group legend {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: #4a90e2; padding: 0 4px;
}
.radio-row {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 14px; color: #eee; cursor: pointer;
    padding: 5px 6px; border-radius: 6px;
}
.radio-row:hover { background: rgba(255,255,255,0.05); }
.radio-row:has(input:checked) { background: rgba(74,144,226,0.16); color: #fff; }
.radio-row input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: #4a90e2; }
.sub-options {
    display: flex; flex-direction: column; gap: 0;
    margin: 0 0 0 14px; padding-left: 10px; border-left: 2px solid rgba(74,144,226,0.35);
}
.sub-options[hidden] { display: none; }
.seconds-input {
    width: 3.5em; padding: 3px 5px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 13px; text-align: center; background: #fff; color: #000;
}
.option-note { font-size: 11px; color: #fff; margin: 2px 0 0 6px; }

.start-btn {
    position: relative;
    z-index: 2;
    margin-top: 6px;
    padding: 14px 40px; border: none; border-radius: 10px; background: #2d7a2d; color: #fff;
    font-size: 17px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer;
    box-shadow: 0 4px 16px rgba(45,122,45,0.5);
}
.start-btn:hover { background: #34901f; box-shadow: 0 4px 20px rgba(45,144,31,0.65); }
.start-hint { font-size: 13px; color: #fff; margin: 4px 0 0; text-align: center; }

/* ---- Viewer: base layout is the inline/manual view (embedded on the page) ---- */
.viewer[hidden] { display: none; }
.viewer {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 32px;
}

.slideshow {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 65vh;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.slide-frame {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}
.slide-img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    opacity: 0;
    z-index: 1;
}
.slide-img.active { opacity: 1; z-index: 2; }
.slide-img.fade-transition { transition: opacity 0.7s ease; }

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 3;
}
.nav-btn:hover { background: rgba(255,255,255,0.25); }
.nav-btn.prev { left: 16px; }
.nav-btn.next { right: 16px; }

.pause-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
}

.caption {
    position: relative;
    z-index: 2;
    text-align: center;
    font-size: 27px;
    line-height: 1.3;
    margin: 16px auto 0;
    max-width: 80vw;
    width: fit-content;
    padding: 8px 16px;
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
}
.caption:empty { display: none; }
.counter {
    position: relative;
    z-index: 2;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin: 6px 0 0;
}
.return-btn {
    margin-top: 18px;
    padding: 10px 22px;
    border: 2px solid #4a90e2;
    border-radius: 8px;
    background: #000;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.return-btn:hover { background: rgba(74,144,226,0.16); }

/* ---- Fullscreen (Auto) override ---- */
.viewer.fullscreen-mode {
    overflow: hidden;
    padding: 0;
    display: block;
}
.viewer.fullscreen-mode .slideshow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}
.viewer.fullscreen-mode .slide-frame { border-radius: 0; }
.viewer.fullscreen-mode .caption {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 34px;
    margin: 0 auto;
    background: rgba(0,0,0,0.45);
    font-size: 41px;
}
.viewer.fullscreen-mode .counter {
    position: fixed;
    right: 16px;
    bottom: 12px;
    margin: 0;
}
.viewer.fullscreen-mode .return-btn {
    display: none;
}
