﻿/* ChronoMirror Car Demo - Web Capture スタイルシート */
:root {
    --bg-dark: #0b1220;
    --bg-panel: #131f35;
    --bg-panel-soft: #1c2c4a;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-blue: #0ea5e9;
    --accent-green: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-subtle: rgba(148, 163, 184, 0.22);
    --radius-lg: 20px;
    --radius-pill: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    background: radial-gradient(circle at top, #172a4d 0%, var(--bg-dark) 68%);
    color: var(--text-main);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* ヘッダー */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 40;
}

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

.brand-badge {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.header-links {
    display: flex;
    gap: 8px;
}

.nav-pill {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-panel-soft);
    border: 1px solid var(--border-subtle);
    transition: background 0.15s ease;
}

.nav-pill:hover {
    background: #273c63;
}

/* メインコンテナ */
.app-main {
    flex: 1;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 16px 16px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    animation: fadeIn 0.25s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* スタート画面カード */
.hero-card {
    width: 100%;
    max-width: 560px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 26px;
    padding: 0 24px 28px;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.checker-bar {
    height: 16px;
    margin: 0 -24px 22px;
    background-image:
        linear-gradient(45deg, #ffffff 25%, transparent 25%),
        linear-gradient(-45deg, #ffffff 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ffffff 75%),
        linear-gradient(-45deg, transparent 75%, #ffffff 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #0f172a;
    opacity: 0.9;
}

.hero-tag {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 14px;
}

.hero-heading {
    font-size: clamp(1.5rem, 4.5vw, 2.1rem);
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 10px;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.step-guide {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.step-guide li {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px 14px;
}

.step-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    display: grid;
    place-items: center;
    font-weight: 900;
    flex-shrink: 0;
}

.step-guide strong {
    display: block;
    font-size: 0.98rem;
}

.step-guide small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.privacy-note {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ステップ見出し */
.step-banner {
    text-align: center;
}

.step-pill {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
    margin-bottom: 6px;
}

.step-pill.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.step-banner h2 {
    font-size: clamp(1.1rem, 3.6vw, 1.45rem);
    font-weight: 800;
}

/* カメラ・プレビュー枠（3:5 縦長厳守） */
.camera-stage,
.preview-stage {
    width: 100%;
    display: flex;
    justify-content: center;
}

.viewport-frame {
    position: relative;
    background: #020617;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.aspect-3-5 {
    aspect-ratio: 3 / 5;
    width: min(86vw, 340px);
    max-height: 60dvh;
}

.viewport-frame video,
.viewport-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.viewport-frame video.mirror {
    transform: scaleX(-1);
}

/* 撮影ガイドオーバーレイ */
.guide-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.car-guide .guide-box {
    width: 90%;
    height: 82%;
    border: 3px dashed rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
}

.guide-text {
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
}

.guide-text.bottom {
    position: absolute;
    bottom: 14px;
}

.selfie-guide .face-oval {
    width: 58%;
    height: 46%;
    border: 3px dashed rgba(56, 189, 248, 0.85);
    border-radius: 50%;
    margin-bottom: 18%;
}

/* カウントダウン・フラッシュ */
.countdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    display: grid;
    place-items: center;
    font-size: 6rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.8);
    z-index: 20;
}

.flash-layer {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
}

.flash-layer.active {
    animation: flashAnim 0.25s ease-out;
}

@keyframes flashAnim {
    0% { opacity: 0.95; }
    100% { opacity: 0; }
}

.camera-fallback {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    z-index: 15;
}

/* ボタン・操作バー */
.controls-bar {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-pill);
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.3);
}

.btn-ghost {
    background: var(--bg-panel-soft);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    padding: 9px 14px;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 6px 12px;
}

.btn-xl,
.btn-shutter {
    width: 100%;
    padding: 15px 24px;
    font-size: 1.08rem;
}

.file-btn {
    font-size: 0.85rem;
    padding: 9px 14px;
}

/* ローディング画面 */
.loading-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 26px;
    padding: 36px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner-ring {
    width: 68px;
    height: 68px;
    border: 6px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-right-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.loading-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* 完成画面レイアウト */
.result-layout {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.result-side-panel {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.display-notice {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #6ee7b7;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 14px;
    text-align: center;
}

.qr-card {
    background: #ffffff;
    color: #0f172a;
    border-radius: 18px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.qr-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.qr-card img {
    width: 170px;
    height: 170px;
    object-fit: contain;
    margin: 0 auto 6px;
    display: block;
}

.qr-caption {
    font-size: 0.78rem;
    color: #475569;
}

/* エラートースト */
.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc2626;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 92vw;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    z-index: 100;
    font-weight: 700;
    font-size: 0.9rem;
}

.error-toast button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
}

/* タブレット・PC横幅時の結果表示2カラム化 */
@media (min-width: 720px) {
    .result-layout {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 28px;
    }

    .aspect-3-5 {
        width: 340px;
        max-height: 68dvh;
    }
}
