:root {
    --brand: #1a5cff;
    --brand-dark: #0b3fc4;
    --bg: #eef1f6;
    --panel: #ffffff;
    --border: #dde2eb;
    --text: #222833;
    --muted: #6b7280;
    --danger: #ff3b3b;
    --success: #14a44d;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    color: var(--text);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---------- ヘッダー（コントロールバー） ---------- */
#toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    z-index: 20;
}

#toolbar .title {
    font-weight: 700;
    font-size: 16px;
    margin-right: auto;
    white-space: nowrap;
}

.mode-switch {
    display: inline-flex;
    background: var(--bg);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid var(--border);
}
.mode-switch button {
    border: none;
    background: transparent;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    transition: all .15s ease;
}
.mode-switch button.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 1px 4px rgba(26,92,255,.4);
}

.score-box, .timer-box {
    font-size: 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 600;
    white-space: nowrap;
}
.timer-box span, .score-box span { color: var(--brand-dark); font-variant-numeric: tabular-nums; }

.btn {
    border: 1px solid var(--border);
    background: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #d92e2e; }

/* ---------- メイン比較エリア ---------- */
#compare-wrap {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}
#compare-wrap.disabled {
    pointer-events: none;
    opacity: .4;
    filter: grayscale(1);
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--border);
}
.pane:last-child { border-right: none; }

.pane-label {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    background: #f4f6fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pane-label.original { color: var(--success); }
.pane-label.fake { color: var(--danger); }
.pane-label .tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: currentColor;
    color: #fff !important;
}
.pane-label .tag span { color: #fff; }

.expand-btn {
    margin-left: auto;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.expand-btn:hover { background: var(--bg); }

.pane iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

/* パネル単体でのフルスクリーン表示時の調整 */
.pane:fullscreen,
.pane:-webkit-full-screen {
    background: #fff;
}
.pane:fullscreen iframe,
.pane:-webkit-full-screen iframe {
    height: 100%;
}

/* ---------- PC専用ブロッカー ---------- */
#pc-only-blocker {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}
#pc-only-blocker.hidden { display: none; }
.pc-blocker-box { max-width: 460px; }
.pc-blocker-icon { font-size: 44px; margin-bottom: 14px; }
.pc-blocker-box h2 { font-size: 18px; margin: 0 0 14px; }
.pc-blocker-box p { font-size: 13.5px; line-height: 1.8; color: var(--muted); margin: 0; }

/* ---------- 同意ポップアップ ---------- */
#consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 30, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
#consent-overlay.hidden { display: none; }

.consent-box {
    background: #fff;
    border-radius: 14px;
    max-width: 520px;
    width: 100%;
    padding: 28px 26px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.consent-box h2 {
    margin: 0 0 14px;
    font-size: 18px;
}
.consent-box p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    margin: 0 0 14px;
}
.consent-box a {
    color: var(--brand);
    font-weight: 600;
    word-break: break-all;
}
.consent-box .agree-line {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}
.consent-box .actions {
    display: flex;
    justify-content: flex-end;
}

/* ---------- 結果ポップアップ ---------- */
#result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 30, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    padding: 20px;
}
#result-overlay.hidden { display: none; }

.result-box {
    background: #fff;
    border-radius: 14px;
    max-width: 560px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 26px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.result-box h2 { margin: 0 0 16px; font-size: 18px; }
.explain-heading {
    font-size: 14px;
    margin: 4px 0 10px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.explain-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.explain-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}
.explain-item.found {
    background: #f0fbf3;
    border-color: #cdeed8;
}
.explain-item.missed {
    background: #fff5f5;
    border-color: #ffd6d6;
}
.explain-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.explain-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
}
.explain-item.found .explain-badge { background: var(--success); }
.explain-item.missed .explain-badge { background: var(--danger); }
.explain-no {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}
.explain-page {
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 999px;
}
.explain-label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}
.explain-body {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text);
}
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.result-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.result-item .num { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.result-item .lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }

.missed-list {
    font-size: 12.5px;
    line-height: 1.7;
    background: #fff5f5;
    border: 1px solid #ffd6d6;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    max-height: 160px;
    overflow-y: auto;
}
.missed-list.all-found {
    background: #f0fbf3;
    border-color: #cdeed8;
}
.submit-status {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
}
.result-box .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---------- トースト（誤クリック通知など） ---------- */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #222833;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s ease;
    z-index: 200;
    white-space: nowrap;
}
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#toast.err { background: #7a1f1f; }
#toast.ok { background: #1f5c33; }
