/* ChottoFix WEB 版。色は Windows 版(Views/Theme.xaml)と揃える。 */
:root {
    --page: #F4F6F8;
    --card: #FFFFFF;
    --line: #D8DEE4;
    --text: #1F2328;
    --muted: #59636E;
    --accent: #1A66D2;
    --accent-soft: #E3EEFC;
    --mark: #CFE2FF;
    --warn: #FFE58F;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: "Yu Gothic UI", "Meiryo UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

#app {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 16px 88px;
}

h1, h2, p {
    margin: 0;
}

h2 {
    font-size: 16px;
    margin: 4px 0 8px;
}

button, select {
    font: inherit;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 14px;
    cursor: pointer;
}

    button:hover:not(:disabled) {
        opacity: 0.85;
    }

    button:disabled {
        opacity: 0.4;
        cursor: default;
    }

    button.primary {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        font-weight: 600;
    }

    button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

[hidden] {
    display: none !important;
}

.pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.note {
    color: var(--muted);
    font-size: 12.5px;
    margin: 4px 0 8px;
}

/* --- 見出し --- */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    margin-bottom: 12px;
}

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

.brand-icon {
    width: 36px;
    height: 36px;
}

.brand-name {
    font-size: 22px;
    color: var(--accent);
    line-height: 1.2;
}

.brand-tagline {
    color: var(--muted);
    font-size: 12.5px;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

    .steps .step {
        white-space: nowrap;
        background: transparent;
        border-color: transparent;
        color: var(--muted);
        padding: 6px 12px;
    }

        .steps .step.current {
            background: var(--accent-soft);
            color: var(--accent);
            font-weight: 600;
        }

.topbar-actions {
    display: flex;
    gap: 8px;
}

/* --- カード --- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    min-width: 0;
}

.guide-card {
    margin-bottom: 12px;
}

    .guide-card button {
        margin-top: 8px;
    }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.big-text {
    display: block;
    width: 100%;
    min-height: 360px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    background: var(--card);
    color: var(--text);
}

    .big-text.small {
        min-height: 140px;
        font-size: 14px;
    }

/* ① 入力欄が空のときの説明(入力の邪魔をしないよう、クリックを通す) */
.input-area {
    position: relative;
}

.guide-overlay {
    position: absolute;
    inset: 24px 24px auto 24px;
    max-width: 620px;
    max-height: calc(100% - 32px);  /* 入力欄の外にはみ出さない */
    overflow: hidden;
    color: var(--muted);
    line-height: 1.8;
    pointer-events: none;
}

/* ② 伏せる: 広い画面では左に候補と手動、右にプレビュー。狭い画面では縦に並べる */
.mask-layout {
    display: grid;
    grid-template-columns: 5fr 6fr;
    grid-template-areas:
        "candidates preview"
        "manual preview";
    gap: 12px 16px;
}

    .mask-layout > :nth-child(1) {
        grid-area: candidates;
    }

    .mask-layout > :nth-child(2) {
        grid-area: manual;
    }

    .mask-layout > :nth-child(3) {
        grid-area: preview;
    }

.restore-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 800px) {
    /* 見出し: ロゴとボタンを1行目、手順を2行目に横一列で並べる */
    .topbar {
        gap: 8px;
    }

    .topbar-actions {
        margin-left: auto;
    }

        .topbar-actions button {
            padding: 5px 10px;
            font-size: 13px;
        }

    .steps {
        order: 3;
        flex-basis: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

        .steps .step {
            padding: 5px 8px;
            font-size: 13.5px;
        }

    .mask-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "candidates" "preview" "manual";
    }

    .restore-layout {
        grid-template-columns: 1fr;
    }

    .big-text {
        min-height: 220px;
    }

    /* ① の入力欄は、空のときの説明が収まる高さを保つ */
    .input-area .big-text {
        min-height: 400px;
    }

    .guide-overlay {
        inset: 14px 14px auto 14px;
        font-size: 13.5px;
        line-height: 1.7;
    }
}

.candidates, .manual-rules {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .candidates li, .manual-rules li {
        padding: 3px 0;
    }

    .candidates label {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }

    .candidates input[type=checkbox] {
        width: 18px;
        height: 18px;
        margin: 0;
    }

    .manual-rules li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }

.value {
    overflow-wrap: anywhere;
}

.badge {
    display: inline-block;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}

    .badge.warn {
        background: var(--warn);
        color: var(--text);
    }

.small-button {
    padding: 2px 8px;
}

.preview .highlighted {
    font-size: 15px;
    line-height: 1.8;
}

.highlighted mark {
    background: var(--mark);
    color: inherit;
    font-weight: 600;
    border-radius: 2px;
}

.highlighted.unresolved mark {
    background: var(--warn);
}

/* ③ 用途・トーン */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.chip {
    border-radius: 16px;
    padding: 6px 16px;
}

    .chip[aria-pressed=true] {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

.warning {
    background: var(--warn);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 13.5px;
}

/* 下部: お知らせと移動(スクロールしても見える) */
.bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--page);
    border-top: 1px solid var(--line);
}

    .bottombar .status {
        flex: 1;
        color: var(--accent);
        font-weight: 600;
        font-size: 13.5px;
    }

    .bottombar .actions {
        margin-top: 0;
    }

/* --- Blazor の読み込み表示・エラー表示 --- */
#blazor-error-ui {
    background: var(--warn);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--accent);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "読み込み中");
    }

/* コピー用の一時的な入力欄(画面の外に置く) */
.offscreen {
    position: fixed;
    left: -9999px;
    top: 0;
    opacity: 0;
}

/* 他のサイトの中で開かれたときの案内 */
.framed-notice {
    max-width: 480px;
    margin: 40px auto;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
}

a {
    color: var(--accent);
}
