:root {
    --primary: #ffd600;
    --primary-dark: #ffb800;
    --secondary: #1e3a5f;
    --accent-action: #ff6b00;
    --success: #22c55e;
    --background: #ffd600;
    --card: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #ffe082;
    --bg: var(--background);
    --surface: var(--card);
    --surface-soft: #fffdf5;
    --surface-warm: #fff7d1;
    --ink: var(--text);
    --muted: var(--text-muted);
    --line: var(--border);
    --accent: var(--secondary);
    --accent-dark: var(--secondary);
    --accent-food: var(--accent-action);
    --accent-food-soft: #fff0df;
    --energy: var(--primary);
    --energy-soft: #fff6bf;
    --energy-strong: var(--primary-dark);
    --warning: #b95736;
    --error: #b42318;
    --shadow: 0 18px 45px rgba(30, 58, 95, 0.1);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--primary);
    color: var(--ink);
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    line-height: 1.7;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.site-header,
.site-footer,
.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    padding: 18px 0 10px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    color: var(--secondary);
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.08);
    font-size: 0.88rem;
}

.site-nav a {
    border-radius: 6px;
    color: var(--secondary);
    font-weight: 800;
    padding: 7px 10px;
    text-decoration: none;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.site-nav a:hover {
    background: var(--secondary);
    color: #fff;
}

.menu-toggle {
    display: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.app-shell {
    margin-bottom: 48px;
}

.hero {
    min-height: clamp(430px, 52vh, 560px);
    display: grid;
    align-items: center;
    margin-top: 14px;
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(255, 253, 247, 0.95) 0%, rgba(255, 253, 247, 0.9) 40%, rgba(255, 253, 247, 0.58) 68%, rgba(255, 253, 247, 0.28) 100%),
        url("../assets/hero-nutrition.webp") center right / cover no-repeat;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hero-copy,
.card,
.field,
.result-column {
    min-width: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-action);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

h1 {
    max-width: 780px;
    margin-bottom: 10px;
    font-size: clamp(2rem, 4.2vw, 3.15rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.hero-subcopy {
    margin-bottom: 10px;
    color: var(--ink);
    font-size: clamp(1.15rem, 2.5vw, 1.55rem);
    font-weight: 800;
}

.lead {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.hero-chips span {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--primary);
    color: var(--secondary);
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

.section-title span,
.result-label,
.feature-card span {
    color: var(--accent-action);
    font-size: 0.78rem;
    font-weight: 800;
}

.feature-section {
    padding: 4px 0 22px;
}

.section-title {
    margin-bottom: 18px;
}

.section-title.compact {
    margin-bottom: 12px;
}

.section-title h2 {
    margin: 2px 0 0;
    font-size: 1.35rem;
}

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

.feature-card,
.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.feature-card {
    box-shadow: none;
    background: var(--card);
    padding: 16px;
}

.feature-card h3 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.feature-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: start;
}

.form-card,
.empty-state,
.loading-state,
.result-card {
    padding: 22px;
}

.form-group {
    min-width: 0;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.form-group legend {
    padding: 0 8px;
    color: var(--secondary);
    font-weight: 800;
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.wide {
    grid-column: 1 / -1;
}

.field span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
}

.field:has([required]) > span::after {
    content: "必須";
    border-radius: 999px;
    background: var(--primary);
    color: var(--secondary);
    padding: 1px 7px;
    font-size: 0.7rem;
    line-height: 1.6;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink);
    padding: 10px 12px;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 3px solid rgba(255, 214, 0, 0.32);
    border-color: var(--primary-dark);
}

.field.is-invalid input,
.field.is-invalid select,
.field.is-invalid textarea {
    border-color: var(--error);
    background: #fff8f6;
}

.field.is-invalid input:focus,
.field.is-invalid select:focus,
.field.is-invalid textarea:focus {
    outline-color: rgba(180, 35, 24, 0.14);
    border-color: var(--error);
}

.field small {
    color: var(--warning);
    font-size: 0.82rem;
}

.field-error {
    color: var(--error) !important;
    font-weight: 700;
}

.actions,
.result-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions {
    margin-top: 18px;
}

.primary-button,
.secondary-button {
    min-height: 52px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 11px 18px;
    font-weight: 800;
}

.primary-button {
    background: var(--accent-action);
    color: #fff;
}

.primary-button:hover {
    background: var(--secondary);
}

.secondary-button {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.notice-details {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

.notice-details summary {
    color: var(--secondary);
    cursor: pointer;
    font-weight: 800;
}

.notice-details p {
    margin: 10px 0 0;
}

.result-column {
    display: grid;
    gap: 14px;
}

.empty-state {
    text-align: center;
}

.empty-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--energy-soft);
    color: var(--secondary);
    font-weight: 900;
    font-size: 1.4rem;
}

.empty-state h2 {
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.loading-state {
    display: grid;
    gap: 10px;
}

.loading-state p {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--surface-warm);
    color: var(--secondary);
    font-weight: 800;
}

.message {
    padding: 12px 14px;
    border-radius: 8px;
}

.message.error {
    border: 1px solid rgba(180, 35, 24, 0.24);
    background: #fff4f2;
    color: var(--error);
}

.results {
    display: grid;
    gap: 12px;
}

.result-toolbar {
    justify-content: flex-end;
}

.result-toolbar-top {
    padding-bottom: 2px;
}

.result-toolbar-bottom {
    padding-top: 2px;
}

.copy-status {
    justify-self: end;
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 800;
}

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

.result-card h2 {
    margin: 4px 0 14px;
    font-size: 1.22rem;
}

.result-label {
    display: inline-flex;
    margin-bottom: 8px;
}

.result-point-card {
    border-color: var(--primary-dark);
    background: linear-gradient(180deg, var(--energy-soft), var(--surface));
}

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

.summary-item {
    min-height: 82px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
}

.summary-item span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.summary-item strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-size: 1.08rem;
}

.meal-result-card p {
    margin-bottom: 0;
    font-size: 1.03rem;
}

.pattern-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.pattern-card + .pattern-card {
    margin-top: 12px;
}

.pattern-card h3 {
    margin-bottom: 10px;
    color: var(--secondary);
}

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

.meal-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.meal-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--accent-action);
    font-size: 0.82rem;
    font-weight: 800;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.list-block {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.list-block h3 {
    margin-bottom: 8px;
    font-size: 0.96rem;
}

.list-block ul,
.notes-list {
    margin: 0;
    padding-left: 1.2em;
}

.notes-list {
    color: var(--muted);
}

.site-footer {
    padding: 28px 0 34px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    text-align: center;
    font-size: 0.86rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--secondary);
    font-weight: 700;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.site-footer p {
    margin-bottom: 0;
}

.page-card {
    width: 100%;
    max-width: 860px;
    margin: 20px auto 42px;
    padding: 0;
    overflow: hidden;
}

.page-rich {
    background:
        linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 253, 247, 0.92)),
        var(--surface);
}

.page-hero {
    display: grid;
    align-items: center;
    min-height: 260px;
    padding: 34px;
    background:
        linear-gradient(90deg, rgba(255, 253, 247, 0.96) 0%, rgba(255, 253, 247, 0.92) 48%, rgba(255, 253, 247, 0.72) 75%, rgba(255, 253, 247, 0.5) 100%),
        url("../assets/hero-nutrition.webp") center right / cover no-repeat;
    border-bottom: 1px solid var(--line);
}

.page-hero > *,
.page-section > div,
.operator-card {
    min-width: 0;
}

.page-card h1 {
    max-width: 100%;
    margin-bottom: 14px;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.28;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-hero p:last-child {
    max-width: 560px;
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 700;
}

.page-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.24rem;
}

.page-card p,
.page-card li {
    color: var(--muted);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-card ul {
    margin: 0;
    padding-left: 1.2em;
}

.page-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 30px 0;
}

.page-summary span {
    border: 1px solid rgba(47, 143, 107, 0.2);
    border-radius: 999px;
    background: var(--primary);
    color: var(--secondary);
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

.page-section {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 16px;
    margin: 22px 30px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.page-section-warm {
    background: var(--card);
}

.page-number {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--secondary);
    font-size: 0.82rem;
    font-weight: 900;
}

.operator-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 24px 30px 0;
}

.operator-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    padding: 18px;
}

.operator-card span {
    color: var(--accent-action);
    font-size: 0.78rem;
    font-weight: 900;
}

.operator-card h2 {
    margin: 4px 0 8px;
}

.operator-card a {
    color: var(--secondary);
    font-weight: 800;
}

.guide-illustration {
    margin: 20px 30px 0;
}

.guide-illustration img,
.article-card img,
.article-hero-image {
    display: block;
    width: 100%;
    height: auto;
}

.guide-illustration img {
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 260px;
    object-fit: cover;
}

.article-links-section {
    margin: 24px 30px 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.article-mini-grid {
    display: grid;
    gap: 10px;
}

.article-mini-grid a,
.article-card {
    color: var(--ink);
    text-decoration: none;
}

.article-mini-grid a {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    padding: 12px 14px;
    font-weight: 800;
}

.article-mini-grid a:hover,
.article-card:hover {
    border-color: var(--primary-dark);
}

.page-back-inline {
    margin: 16px 0 0;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 24px 30px 0;
}

.article-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    transition: border-color 0.16s ease, transform 0.16s ease;
}

.article-card:hover {
    transform: translateY(-2px);
}

.article-card img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.article-card span {
    display: inline-flex;
    margin: 14px 14px 0;
    color: var(--accent-action);
    font-size: 0.78rem;
    font-weight: 900;
}

.article-card h2 {
    margin: 6px 14px 8px;
    font-size: 1.05rem;
    line-height: 1.45;
}

.article-card p {
    margin: 0 14px 16px;
    color: var(--muted);
    font-size: 0.92rem;
}

.article-page {
    max-width: 860px;
}

.article-hero-image {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.article-body {
    padding: 30px;
}

.article-body h1 {
    margin-bottom: 14px;
}

.article-body h1,
.article-body h2,
.article-body p,
.article-body li,
.article-card h2,
.article-card p {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-lead {
    color: var(--ink);
    font-size: 1.04rem;
    font-weight: 700;
}

.article-body h2 {
    margin-top: 28px;
    margin-bottom: 10px;
}

.article-body p,
.article-body li {
    color: var(--muted);
}

.article-body ul {
    margin: 0;
    padding-left: 1.2em;
}

.article-note {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--primary-dark);
    border-radius: 8px;
    background: var(--energy-soft);
}

.article-note h2 {
    margin-top: 0;
}

.article-note p:last-child,
.article-note ul:last-child {
    margin-bottom: 0;
}

.article-disclaimer {
    margin-top: 24px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    font-size: 0.9rem;
}

.page-back {
    display: inline-flex;
    margin: 24px 30px 30px;
    color: var(--secondary);
    font-weight: 800;
    text-decoration: none;
}

.page-back:hover {
    text-decoration: underline;
}

.mobile-break {
    display: none;
}

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

    .header-inner {
        position: relative;
    }

    .menu-toggle {
        display: inline-flex;
        position: relative;
        z-index: 12;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--primary);
        color: var(--secondary);
        box-shadow: 0 8px 18px rgba(30, 58, 95, 0.12);
    }

    .menu-toggle span:not(.visually-hidden) {
        width: 20px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transition: transform 0.16s ease, opacity 0.16s ease;
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .site-nav {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        z-index: 10;
        display: none;
        width: min(280px, calc(100vw - 32px));
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--card);
        box-shadow: var(--shadow);
    }

    .site-nav.is-open {
        display: grid;
        gap: 4px;
    }

    .site-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        border-radius: 8px;
        padding: 8px 10px;
        color: var(--secondary);
    }

    .site-nav a:hover {
        background: var(--primary);
        color: var(--secondary);
        text-decoration: none;
    }

    .hero {
        min-height: 430px;
        padding: 28px;
        background:
            linear-gradient(180deg, rgba(255, 253, 247, 0.97) 0%, rgba(255, 253, 247, 0.91) 54%, rgba(255, 253, 247, 0.66) 100%),
            url("../assets/hero-nutrition.webp") center bottom / cover no-repeat;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 620px) {
    .site-header,
    .site-footer,
    .app-shell {
        width: min(1120px, calc(100% - 24px));
    }

    h1 {
        font-size: 2.15rem;
        line-height: 1.12;
    }

    .hero-subcopy {
        font-size: 1.08rem;
        line-height: 1.45;
    }

    .hero {
        padding: 24px 20px;
    }

    .hero-actions {
        gap: 8px;
    }

    .hero-chips {
        gap: 6px;
    }

    .hero-chips span {
        padding: 4px 8px;
        font-size: 0.78rem;
    }

    .mobile-break {
        display: block;
    }

    .lead,
    .empty-state p,
    .field small,
    .notice-details p {
        max-width: 100%;
        line-break: anywhere;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .hero-actions,
    .actions,
    .result-toolbar {
        display: grid;
    }

    .field-grid,
    .meal-grid,
    .list-grid,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .form-card,
    .empty-state,
    .loading-state,
    .result-card,
    .page-card {
        padding: 18px;
    }

    .page-card {
        padding: 0;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .page-hero {
        grid-template-columns: 1fr;
        min-height: 190px;
        padding: 24px 18px;
        max-width: 100%;
        overflow: hidden;
        background:
            linear-gradient(180deg, rgba(255, 253, 247, 0.98) 0%, rgba(255, 253, 247, 0.94) 62%, rgba(255, 253, 247, 0.82) 100%),
            url("../assets/hero-nutrition.webp") center bottom / cover no-repeat;
    }

    .page-summary,
    .operator-grid,
    .article-grid {
        padding: 16px 18px 0;
    }

    .page-section {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 16px 18px 0;
        padding: 16px;
        max-width: calc(100% - 36px);
        overflow: hidden;
    }

    .operator-grid {
        grid-template-columns: 1fr;
    }

    .guide-illustration,
    .article-links-section {
        margin: 16px 18px 0;
    }

    .guide-illustration img {
        max-height: 170px;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .article-body {
        padding: 22px 18px;
        overflow: hidden;
    }

    .article-hero-image {
        max-height: 220px;
    }

    .page-back {
        margin: 22px 18px 24px;
    }

    .form-group {
        padding: 14px;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    .page-card h1,
    .page-card h2,
    .page-card p,
    .page-card li {
        max-width: 100%;
        width: 100%;
        line-break: anywhere;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .page-hero h1,
    .page-hero p {
        width: min(100%, 280px);
    }

    .page-section h2,
    .page-section p,
    .page-section li {
        width: min(100%, 260px);
    }

    .page-card h1 {
        font-size: 1.45rem;
    }

    .page-card p,
    .page-card li {
        font-size: 0.94rem;
    }

    .article-body h1,
    .article-body h2,
    .article-body p,
    .article-body li,
    .article-card h2,
    .article-card p {
        width: min(100%, 300px);
        line-break: anywhere;
        word-break: break-all;
    }
}
