/* ちょっとした時差変換の専用CSS。 */
:root {
    color-scheme: light;
    --ink: #18242c;
    --muted: #5f7280;
    --line: #d8e3ea;
    --panel: #ffffff;
    --soft: #f5f8fa;
    --accent: #315f86;
    --accent-dark: #1f4564;
    --green: #176f49;
    --warning-bg: #fff9e9;
    --warning-line: #d7b84d;
    --error-bg: #fff3f2;
    --error-line: #c7564d;
    --shadow: 0 16px 40px rgba(30, 52, 70, 0.10);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 0;
    scroll-behavior: smooth;
}

body {
    min-width: 0;
    margin: 0;
    overflow-x: hidden;
    background: linear-gradient(180deg, #edf4fb 0%, #ffffff 34%, #f5f8fa 100%);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
    line-height: 1.7;
}

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

button,
input,
textarea {
    max-width: 100%;
    font: inherit;
}

button,
input,
textarea {
    border-radius: 7px;
}

button {
    min-height: 44px;
    border: 1px solid #bad0df;
    background: #fff;
    color: var(--ink);
    padding: 9px 14px;
    cursor: pointer;
}

button:hover,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
    border-color: var(--accent);
    outline: 3px solid rgba(49, 95, 134, 0.24);
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.site-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 44px;
}

.hero {
    padding: 28px 0 22px;
}

.series-label,
.section-kicker,
.ad-label {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

h1,
h2,
h3,
p,
li,
dd {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(1.9rem, 5vw, 3.2rem);
    line-height: 1.16;
}

h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
    line-height: 1.35;
}

h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.subtitle {
    margin: 12px 0 0;
    font-size: 1.08rem;
    font-weight: 700;
}

.lead {
    max-width: 820px;
    margin: 12px 0 0;
}

.note,
.status-line,
.field-help,
.field-meta,
.panel-head p:last-child,
.candidate-fieldset > p {
    color: var(--muted);
    font-size: 0.92rem;
}

.note {
    margin: 10px 0 0;
}

.panel,
.site-return-link,
.mothership-link,
.app-comments,
.app-comment-form-section {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.tool-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 20px;
}

.panel-head p:last-child {
    margin-bottom: 0;
}

.text-label {
    display: grid;
    gap: 6px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
}

textarea {
    min-height: 128px;
    resize: vertical;
}

textarea[readonly] {
    background: #fbfdff;
}

.field-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.field-meta p,
.field-help {
    margin: 0;
}

.field-meta p:last-child {
    flex: 0 0 auto;
    white-space: nowrap;
}

.field-help {
    margin-top: 6px;
}

.action-row,
.copy-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.action-row button,
.copy-row button {
    flex: 1 1 140px;
}

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

.save-button {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
    font-weight: 700;
}

.quiet-button {
    color: var(--muted);
}

.status-line {
    min-height: 1.7em;
    margin: 10px 0 0;
}

.state-badge {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    margin: 2px 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    padding: 4px 12px;
    font-size: 0.86rem;
    font-weight: 700;
}

.state-badge[data-state="valid"] {
    border-color: #9ecdb5;
    background: #eef9f3;
    color: #145c3d;
}

.state-badge[data-state="warning"],
.state-badge[data-state="ambiguous"] {
    border-color: var(--warning-line);
    background: var(--warning-bg);
    color: #6d5511;
}

.state-badge[data-state="error"] {
    border-color: var(--error-line);
    background: var(--error-bg);
    color: #7d2824;
}

.clear-notice {
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 0.88rem;
}

.result-details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.result-details > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.result-details dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.result-details dd {
    margin: 2px 0 0;
    color: var(--accent-dark);
    font-weight: 700;
}

.message-box {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid;
    border-radius: 8px;
}

.message-box ul,
.correction-list {
    margin: 6px 0 0;
    padding-left: 1.25rem;
}

.warning-box {
    border-color: var(--warning-line);
    background: var(--warning-bg);
}

.error-box {
    border-color: var(--error-line);
    background: var(--error-bg);
}

.candidate-fieldset {
    min-width: 0;
    margin: 14px 0 0;
    padding: 12px;
    border: 1px solid var(--warning-line);
    border-radius: 8px;
    background: #fffdf4;
}

.candidate-fieldset legend {
    padding: 0 6px;
    color: #6d5511;
    font-weight: 700;
}

.candidate-fieldset > p {
    margin: 0;
}

.candidate-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.candidate-option {
    display: flex;
    min-width: 0;
    gap: 8px;
    align-items: flex-start;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
}

.candidate-option input {
    flex: 0 0 auto;
    width: auto;
    min-height: 20px;
    margin-top: 3px;
    padding: 0;
}

.candidate-option span {
    min-width: 0;
}

.copy-fallback {
    margin-top: 10px;
    min-height: 110px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.info-grid ol,
.info-grid ul {
    margin: 0;
    padding-left: 1.25rem;
}

.info-grid li + li {
    margin-top: 6px;
}

.related-tools,
.app-comment-section {
    margin-top: 18px;
}

.tool-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tool-links a {
    display: block;
    min-height: 92px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.tool-links a:hover,
.tool-links a:focus-visible {
    border-color: var(--accent);
}

.tool-links strong,
.tool-links span {
    display: block;
}

.tool-links span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.88rem;
}

.app-comment-section > h2 {
    margin-bottom: 12px;
}

.site-return-link,
.mothership-link {
    max-width: 560px;
    margin: 18px auto 0;
    padding: 14px;
    text-align: center;
}

.site-return-link span,
.mothership-link span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.site-return-link a,
.mothership-link a {
    display: inline-block;
    margin-top: 4px;
    font-weight: 700;
}

.site-return-link p,
.mothership-link p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.lab-footer {
    margin-top: 22px;
    color: var(--muted);
    text-align: center;
    font-size: 0.86rem;
}

@media (max-width: 900px) {
    .tool-layout,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .tool-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .site-shell {
        width: min(100% - 20px, 100%);
        padding-top: 20px;
    }

    .hero {
        padding: 8px 0 10px;
    }

    .series-label {
        margin-bottom: 4px;
        font-size: 0.7rem;
    }

    h1 {
        font-size: clamp(1.75rem, 8vw, 2.2rem);
        line-height: 1.1;
    }

    .subtitle {
        margin-top: 6px;
        font-size: 1rem;
    }

    .lead {
        max-height: 2.9em;
        margin-top: 6px;
        overflow: hidden;
        font-size: 0.9rem;
        line-height: 1.45;
    }

    .tool-layout {
        gap: 12px;
    }

    .panel {
        padding: 12px;
    }

    .panel-head h2 {
        margin-bottom: 6px;
    }

    .panel-head p:last-child {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .text-label {
        gap: 4px;
        margin-top: 10px;
    }

    textarea {
        min-height: 88px;
    }

    .field-meta {
        margin-top: 4px;
        display: block;
    }

    .field-meta p,
    .field-help {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .field-meta p:last-child {
        margin-top: 3px;
    }

    .action-row {
        gap: 8px;
        margin-top: 10px;
    }

    .action-row button {
        flex: 1 1 100px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .status-line {
        margin-top: 6px;
        font-size: 0.8rem;
    }

    .privacy-note {
        margin-top: 12px;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .tool-links {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
