/* Light theme, white ground. Deliberately committed to one look rather than
   following the OS: the demo's whole output is an image with a translucent
   overlay on it, and judging that overlay means judging it against a known,
   neutral background rather than one that changes underneath it. */

:root {
    --bg: #ffffff;
    --surface: #F2F6F9;
    --border: #dfe3e8;
    --ink: #313844;
    --ink-2: #64748B;
    --accent: #1B3A73;
    --male: #0b6bcb;     /* app.js の MALE_BOX と対応 */
    --female: #d02a5a;   /* app.js の FEMALE_BOX と対応 */
    --gated: #888d96;
    --tint: #d633d6;
    --edge: #e8a81a;
    --error: #c02d2d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    /* 共通ヘッダー(/common/header.shtml)の .navArea は position:fixed。
       高さは PC 60px / 1023px 以下 48px。 */
    padding-top: 60px;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.65 system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
        "Noto Sans JP", sans-serif;
}

@media (max-width: 1023px) {
    body { padding-top: 48px; }
}

/* 共通ヘッダーはリンクの下線をリセットしないので、各ページ側で打ち消す */
.navArea a { text-decoration: none; }

.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

h1 {
    margin: 0 0 8px;
    font-size: 26px;
    letter-spacing: .01em;
}

h2 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--ink-2);
    font-weight: 600;
}

/* 元のソリューションページへ戻る導線 */
.back {
    margin: 0 0 6px;
    font-size: 13px;
}

.back a {
    color: var(--ink-2);
    text-decoration: none;
}

.back a:hover { color: var(--accent); text-decoration: underline; }

/* ---------------------------------------------------------------- status */

.status {
    margin: 20px 0 16px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: var(--surface);
    font-size: 14px;
    color: var(--ink-2);
}

.status.error {
    border-left-color: var(--error);
    color: var(--error);
    background: #fdf3f3;
}

/* ------------------------------------------------------------------ tabs */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    appearance: none;
    border: 1px solid transparent;
    border-bottom: none;
    background: none;
    padding: 9px 18px;
    font: inherit;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    margin-bottom: -1px;
}

.tab:hover { color: var(--ink); background: var(--surface); }

.tab.is-active {
    color: var(--accent);
    background: var(--bg);
    border-color: var(--border);
    border-bottom: 1px solid var(--bg);
}

body:not(.ready) .tab { pointer-events: none; opacity: .5; }

/* ----------------------------------------------------------------- panes */

.panes {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.pane {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    min-height: 40px;
}

.pane-image {
    width: 100%;
    height: 100%;
    justify-content: center;
    padding: 24px;
}

/* display を指定したクラスは UA の [hidden]{display:none} に勝ってしまう。
   明示的に打ち消さないと、非選択のタブのペインが出たままになる。 */
.pane[hidden] { display: none; }

/* Web カメラ側のペインは中身が無い。min-height の分だけ「画像を選ぶ」ボタン用の
   余白が残ってしまうので畳む。:empty は空白文字にも反応するので、中身を足すときは
   このセレクタが外れる（＝余白が戻る）ことを想定しておくこと。 */
.pane:empty { display: none; }

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(380px, 100%);
    padding: 40px 24px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease;
}

.dropzone:hover { border-color: #a9b8cf; background: rgba(255, 255, 255, .35); }

.dropzone:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dropzone.is-dragover {
    background: #eaf2fb;
}

.pane-image.has-image .dropzone {
    width: 100%;
    height: 100%;
    padding: 0;
    border-color: transparent;
    border-radius: 7px;
    background: transparent;
}

.pane-image.has-image .dropzone-icon,
.pane-image.has-image .dropzone-title,
.pane-image.has-image .dropzone-sub {
    display: none;
}

.pane-image.has-image .dropzone:hover,
.pane-image.has-image .dropzone:focus-visible {
    background: rgba(255, 255, 255, .08);
}

.pane-image.has-image .dropzone.is-dragover {
    background: rgba(234, 242, 251, .85);
}

.dropzone-icon {
    width: 26px;
    height: 26px;
    color: var(--ink-2);
}

.dropzone-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

.dropzone-sub {
    font-size: 13px;
    color: var(--ink-2);
}

.file-input { display: none; }

.preview {
    display: block;
    margin-top: 12px;
    max-width: 100%;
    max-height: 320px;
    border: 1px solid var(--border);
    border-radius: 8px;
}


.options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 16px 0 20px;
    font-size: 14px;
    color: var(--ink-2);
}

.options label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.options label[hidden] { display: none; }   /* 上と同じ理由 */
.options input[type="checkbox"] { accent-color: var(--accent); }

/* ----------------------------------------------------------------- stage */

.stage { margin: 0; }

.stage-box {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.output-canvas {
    display: block;
    width: 100%;
    height: auto;
    min-height: 420px;
    max-height: 70vh;
    object-fit: contain;
}

@media (max-width: 640px) {
    .output-canvas {
        min-height: 320px;
    }
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--ink-2);
}

.legend span { display: inline-flex; align-items: center; gap: 7px; }

.sw {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    display: inline-block;
}

.sw-male { background: var(--male); }
.sw-female { background: var(--female); }
.sw-gated { background: var(--gated); }
.sw-tint { background: var(--tint); opacity: .45; }
.sw-edge { background: var(--edge); }

/* --------------------------------------------------------------- details */

.details { margin-top: 28px; }

.readout {
    margin: 0;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    min-height: 3.2em;
    color: var(--ink);
}

/* the frame sources are read by script, never shown */
.input-image, .input-video, .work-canvas {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    left: -9999px;
}
