:root {
    color-scheme: light;

    --background: #f6f4ef;
    --surface: #ffffff;
    --surface-subtle: #eeece5;
    --text: #20231f;
    --text-subtle: #64685f;
    --border: #d7d5cc;
    --accent: #195c4a;
    --accent-hover: #114436;
    --accent-soft: #e2f0ea;
    --error: #9d2d2d;
    --error-soft: #f8e5e5;
    --shadow:
        0 16px 50px rgba(31, 41, 35, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at 85% 5%,
            rgba(25, 92, 74, 0.12),
            transparent 28rem
        ),
        var(--background);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Kaku Gothic ProN",
        "Hiragino Sans",
        "Yu Gothic",
        "Meiryo",
        sans-serif;
    line-height: 1.7;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.site-header {
    border-bottom: 1px solid rgba(215, 213, 204, 0.8);
    background: rgba(246, 244, 239, 0.88);
}

.site-header__inner,
.main-content,
.site-footer__inner {
    width: min(100% - 32px, 980px);
    margin-inline: auto;
}

.site-header__inner {
    display: flex;
    gap: 18px;
    align-items: baseline;
    padding-block: 18px;
}

.site-name {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.site-description {
    color: var(--text-subtle);
    font-size: 0.85rem;
}

.main-content {
    padding-block: 64px 80px;
}

.hero {
    max-width: 760px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.3rem, 7vw, 4.6rem);
    font-weight: 780;
    letter-spacing: -0.055em;
    line-height: 1.05;
}

.lead {
    max-width: 620px;
    margin: 24px 0 0;
    color: var(--text-subtle);
    font-size: 1.05rem;
}

.search-form {
    margin-top: 42px;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.search-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.search-input {
    width: 100%;
    min-height: 58px;
    padding: 13px 17px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
    box-shadow: var(--shadow);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow:
        0 0 0 4px rgba(25, 92, 74, 0.13),
        var(--shadow);
}

.search-button {
    min-height: 58px;
    padding-inline: 28px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 750;
    transition:
        background 160ms ease,
        transform 160ms ease;
}

.search-button:hover {
    background: var(--accent-hover);
}

.search-button:active {
    transform: translateY(1px);
}

.search-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.search-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    margin: 13px 0 0;
    color: var(--text-subtle);
    font-size: 0.88rem;
}

.example-button {
    padding: 0;
    border: 0;
    border-bottom: 1px dotted currentColor;
    background: transparent;
    color: var(--accent);
}

.status {
    margin-top: 34px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.status--loading {
    color: var(--text-subtle);
}

.status--success {
    border-color: rgba(25, 92, 74, 0.25);
    background: var(--accent-soft);
}

.status--error {
    border-color: rgba(157, 45, 45, 0.3);
    background: var(--error-soft);
    color: var(--error);
}

.results {
    display: grid;
    gap: 20px;
    margin-top: 30px;
}

.results-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
}

.results-title {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.025em;
}

.results-meta {
    color: var(--text-subtle);
    font-size: 0.85rem;
}

.sense-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sense-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.sense-title {
    margin: 0;
    font-size: 1.15rem;
}

.part-of-speech {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding-inline: 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

.synset-id {
    margin-left: auto;
    color: var(--text-subtle);
    font-size: 0.75rem;
}

.definition-list {
    margin: 0;
    padding-left: 1.4rem;
}

.definition-list li + li {
    margin-top: 6px;
}

.related-heading {
    margin: 10px 0 10px;
    color: var(--text-subtle);
    font-size: 0.85rem;
    font-weight: 700;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-button {
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-subtle);
    color: var(--text);
    transition:
        border-color 150ms ease,
        background 150ms ease;
}

.word-button:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/*
 * JMdict xref LINK uses an <a> element instead of
 * the button/span elements used by the existing
 * related-word chips.
 *
 * Keep exactly the same visual treatment and
 * suppress the browser's default anchor underline.
 */
.xref-related-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.xref-related-link:hover,
.xref-related-link:focus,
.xref-related-link:active,
.xref-related-link:visited {
    color: var(--text);
    text-decoration: none;
}

.word-button--static {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    cursor: default;
}

.word-button--static:hover {
    border-color: var(--border);
    background: var(--surface);
}

.empty-message {
    padding: 28px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    color: var(--text-subtle);
    text-align: center;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.52);
}

.site-footer__inner {
    padding-block: 28px 42px;
    color: var(--text-subtle);
    font-size: 0.78rem;
}

.site-footer p {
    margin: 0;
}

.site-footer p + p {
    margin-top: 8px;
}

.copyright a {
    color: inherit;
}

@media (max-width: 600px) {
    .main-content {
        padding-block: 44px 64px;
    }

    .search-controls {
        grid-template-columns: 1fr;
    }

    .search-button {
        width: 100%;
    }

    .sense-card {
        padding: 20px;
    }

    .synset-id {
        width: 100%;
        margin-left: 0;
    }
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 16px;
}

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

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

/* 読みから検索した単語候補 */
.reading-candidates {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.reading-candidates__heading {
    margin: 0;
    font-size: 1.2rem;
}

.reading-candidates__description {
    margin: 8px 0 18px;
    color: var(--text-subtle);
}

.reading-candidates__list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.reading-candidate-button {
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.reading-candidate-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* BEGIN THESAURUS BREADCRUMB CSS */
.breadcrumb {
    margin: 0 auto 18px;
    font-size: 0.8rem;
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.breadcrumb li {
    display: flex;
    gap: 6px;
    align-items: center;
}

.breadcrumb li + li::before {
    color: var(--text-subtle);
    content: "›";
}

.breadcrumb a {
    color: var(--text-subtle);
    text-decoration: none;
}

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

.breadcrumb li[aria-current="page"] a {
    color: var(--text);
    pointer-events: none;
}
/* END THESAURUS BREADCRUMB CSS */

/* BEGIN WORD PAGE PRESENTATION CSS */
.meaning-summary-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 5px;
    line-height: 1.65;
}

/*
 * 色・枠線・角丸などは既存の
 * .part-of-speechのデザインをそのまま使用します。
 */
.meaning-summary-heading > .part-of-speech {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.meaning-summary-definitions {
    display: grid;
    flex: 1 1 auto;
    gap: 5px;
    min-width: 0;
}

.meaning-summary-definition {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.65;
}

.meaning-summary-definitions.is-multiple
.meaning-summary-definition {
    position: relative;
    padding-left: 1.1em;
}

.meaning-summary-definitions.is-multiple
.meaning-summary-definition::before {
    position: absolute;
    left: 0;
    content: "・";
}

@media (max-width: 640px) {
    .meaning-summary-heading {
        display: grid;
        gap: 8px;
    }

    .meaning-summary-heading > .part-of-speech {
        justify-self: start;
    }

    .meaning-summary-definition {
        font-size: 0.95rem;
    }
}
/* END WORD PAGE PRESENTATION CSS */

/* BEGIN HOME DISCOVERY */

.home-discovery {
    margin-top: 40px;
}

.home-discovery-header {
    margin-bottom: 16px;
}

.home-discovery-header h2 {
    margin: 0 0 5px;
    font-size: 1.3rem;
    font-weight: 700;
}

.home-discovery-header p {
    margin: 0;
    color: var(--text-subtle);
    font-size: 0.9rem;
    line-height: 1.7;
}

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

.home-discovery-card {
    min-width: 0;
}

.home-discovery-word {
    margin: 0;
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.home-discovery-word a {
    color: inherit;
    text-decoration: none;
}

.home-discovery-word a:hover {
    text-decoration: underline;
}

.home-discovery-definitions {
    line-height: 1.7;
}

.home-discovery-definitions p {
    margin: 0 0 4px;
}

.home-discovery-definitions p:last-child {
    margin-bottom: 0;
}

.home-discovery-related {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.home-discovery-related .word-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

@media (max-width: 720px) {
    .home-discovery {
        margin-top: 30px;
    }

    .home-discovery-grid {
        grid-template-columns: 1fr;
    }
}

/* END HOME DISCOVERY */

/* BEGIN CONTENT EXPANSION */

.sense-examples {
    margin-top: 1.25rem;
}

.example-heading {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.example-list {
    margin: 0;
    padding-left: 1.4rem;
}

.example-item + .example-item {
    margin-top: 0.4rem;
}

.expression-card {
    margin-top: 1.5rem;
}

.expression-section-title {
    margin-top: 0;
}

.expression-group + .expression-group {
    margin-top: 1.25rem;
}

.expression-group-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.expression-list {
    margin: 0;
    padding-left: 1.4rem;
}

.expression-item + .expression-item {
    margin-top: 0.6rem;
}

.expression-reading {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.875rem;
    opacity: 0.75;
}

.expression-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* END CONTENT EXPANSION */

/* BEGIN INLINE SENSE EXAMPLES */

/*
 * HTMLの意味構造は変更せず、
 * h4「例文」と例文リストを横並びにします。
 *
 * 複数の例文が存在する場合、
 * 2件目以降は例文本体の列に揃えて表示します。
 */
.sense-examples {
    display: grid;
    grid-template-columns:
        max-content minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: start;
}

.example-heading {
    margin: 0;
    padding: 0;
    line-height: 1.7;
}

.example-list {
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.example-item {
    margin: 0;
    line-height: 1.7;
}

.example-item + .example-item {
    margin-top: 4px;
}

/* END INLINE SENSE EXAMPLES */


/* BEGIN JMdict ANTONYM LINKS */

.antonym-list .antonym-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* END JMdict ANTONYM LINKS */
