:root {
    color-scheme: light;
    --paper: #f5f2eb;
    --surface: #fffdf9;
    --ink: #292b27;
    --muted: #666a61;
    --green: #345e50;
    --line: #e2e0d6;
    --red: #a13a31;
    --blue: #35668a;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: var(--ink);
    background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.page-width { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.page-header { background: #284d42; color: #fffdf6; padding: 36px 0 42px; border-bottom: 4px solid #b6a16c; }
.eyebrow { font-size: .875rem; letter-spacing: .1em; color: #dce8dd; margin: 0 0 6px; }
h1, h2, p { margin-top: 0; }
h1 { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1.35; margin-bottom: 10px; font-weight: 700; }
h2 { font-size: 1.25rem; line-height: 1.5; margin-bottom: 16px; color: #2d5147; }
.intro { margin: 0; font-size: .95rem; color: #e5ece6; }
main { padding: 24px 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 20px; box-shadow: 0 3px 12px #3d361509; }
.birth-form { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.date-fields { display: grid; grid-template-columns: minmax(150px, 1.7fr) minmax(76px, 1fr) minmax(76px, 1fr); gap: 12px; flex: 1; max-width: 600px; }
.date-fields label { display: grid; gap: 5px; font-size: .875rem; font-weight: 650; }
select, button { font: inherit; }
select { width: 100%; min-width: 0; height: 48px; padding: 6px 10px; color: var(--ink); background: white; border: 1px solid #b8bdb4; border-radius: 8px; }
button { cursor: pointer; min-height: 46px; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #a68032; outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
.primary-button { background: var(--green); color: white; border: none; border-radius: 8px; padding: 10px 24px; font-weight: 700; min-height: 48px; }
.primary-button:hover { background: #264b3f; }
.profile-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; margin: 0; gap: 12px; }
.profile-grid > div { background: #f0f2ed; border-radius: 8px; padding: 10px 14px; }
.profile-grid dt { color: var(--muted); font-size: .8rem; }
.profile-grid dd { margin: 3px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 510px; margin: 0 auto; }
.month-nav button { flex: 0 0 auto; background: #edf1eb; color: #2b5146; border: 1px solid #c8d4c9; border-radius: 8px; padding: 8px 15px; font-weight: 650; }
.month-nav button:hover:not(:disabled) { background: #dce8df; }
.month-label { font-size: clamp(1.05rem, 3vw, 1.55rem); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: center; }
.month-nav:has(button:disabled) .month-label { visibility: hidden; }
.period-note { text-align: center; color: var(--muted); font-size: .83rem; margin: 12px 0 20px; }
.calendar-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .95rem; line-height: 1.65; }
.calendar-table th { background: #345e50; color: white; padding: 10px 8px; text-align: left; font-size: .85rem; }
.calendar-table th:first-child { border-radius: 8px 0 0 0; width: 8%; text-align: center; }
.calendar-table th:nth-child(2) { width: 6%; text-align: center; }
.calendar-table th:nth-child(3) { width: 7%; }
.calendar-table th:nth-child(4), .calendar-table th:nth-child(5), .calendar-table th:nth-child(6) { width: 12%; }
.calendar-table th:nth-child(7) { width: 22%; }
.calendar-table th:last-child { border-radius: 0 8px 0 0; width: 21%; }
.calendar-table td { border-bottom: 1px solid var(--line); padding: 11px 8px; vertical-align: top; overflow-wrap: anywhere; }
.calendar-table tr:nth-child(even) td { background: #f6f7f3; }
.calendar-table td:nth-child(1), .calendar-table td:nth-child(2) { text-align: center; font-weight: 700; }
.calendar-table .sunday td:nth-child(-n+2) { color: var(--red); }
.calendar-table .saturday td:nth-child(-n+2) { color: var(--blue); }
.calendar-table .calendar-status { text-align: center; color: var(--muted); padding: 24px 12px; font-weight: 400; }
.footer-nav { margin-top: 22px; }
.characterArea { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); align-items: start; gap: 24px; }
.iconImage { display: block; width: 100%; height: auto; border-radius: 10px; }
#character p, .reading-panel p { margin-bottom: 12px; line-height: 1.9; }
a { color: #315f56; overflow-wrap: anywhere; }
.elm-data { position: relative; }
.data { display: none; }
footer { border-top: 1px solid var(--line); color: var(--muted); padding: 16px 0 30px; text-align: center; }

@media (max-width: 900px) {
    .page-width { width: calc(100% - 24px); }
    .page-header { padding: 27px 0 29px; }
    main { padding-top: 14px; }
    .panel { padding: 16px; margin-bottom: 14px; border-radius: 12px; }
    .birth-form { display: grid; gap: 14px; }
    .date-fields { gap: 8px; grid-template-columns: minmax(0, 1.75fr) minmax(0, .8fr) minmax(0, .8fr); }
    .primary-button { width: 100%; }
    .profile-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .profile-grid > div:first-child { grid-column: 1 / -1; }
    .calendar-section { padding: 16px 12px; }
    .month-nav button { padding: 8px 12px; }
    .calendar-table, .calendar-table tbody { display: block; }
    .calendar-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .calendar-table tbody { display: grid; gap: 12px; }
    .calendar-table tbody tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: white; }
    .calendar-table tbody td, .calendar-table tr:nth-child(even) td { background: transparent; border: 0; padding: 8px 12px; }
    .calendar-table tbody td:nth-child(-n+3) { background: #edf1eb; border-bottom: 1px solid #dce4da; padding: 12px; align-content: center; }
    .calendar-table tbody td:nth-child(1) { font-size: 1.45rem; line-height: 1.2; padding-right: 0; }
    .calendar-table .day-number::after { content: "日"; font-size: .85rem; margin-left: 3px; }
    .calendar-table tbody td:nth-child(2) { padding-inline: 8px; }
    .calendar-table tbody td:nth-child(2)::before { content: "（"; }
    .calendar-table tbody td:nth-child(2)::after { content: "）"; }
    .calendar-table tbody td:nth-child(3) { text-align: right; color: #33564b; font-weight: 650; }
    .calendar-table tbody td:nth-child(n+4) { grid-column: 1 / -1; display: grid; grid-template-columns: 75px minmax(0, 1fr); align-items: baseline; gap: 10px; font-size: .96rem; line-height: 1.65; }
    .calendar-table tbody td:nth-child(n+4)::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 650; }
    .calendar-table tbody td:nth-child(n+5) { border-top: 1px solid #f0efe9; }
    .calendar-table tbody td.calendar-status { grid-column: 1 / -1; background: transparent; padding: 20px 14px; font-size: .95rem; line-height: 1.7; border: 0; }
    .calendar-table tbody td.calendar-status::after { content: none; }
    .characterArea { grid-template-columns: 1fr; gap: 18px; }
    .iconImage { width: min(100%, 250px); margin: auto; }
}

/* 今日と大吉日・大凶日の強調 */
.fortune-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 15px; }
.day-number { display: block; }
.today-badge, .fortune-badge { display: block; width: fit-content; max-width: 100%; margin: 4px auto 0; border-radius: 5px; padding: 1px 5px; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.fortune-legend .fortune-badge { margin: 0; font-size: .85rem; padding: 3px 9px; }
.today-badge { background: #345e50; color: white; }
.big-good { background: #ffebbb; color: #854300; }
.big-bad { background: #fbe1e4; color: #a1253e; }
.fortune-label { font-weight: 700; border-radius: 4px; padding: 1px 3px; }
.calendar-table tbody tr.today-row td { background: #edf5e9; border-top: 2px solid #53815a; border-bottom: 2px solid #53815a; }
.calendar-table tbody tr.today-row td:first-child { border-left: 2px solid #53815a; }
.calendar-table tbody tr.today-row td:last-child { border-right: 2px solid #53815a; }
@media (max-width: 900px) {
    .calendar-table tbody tr.today-row { border: 2px solid #53815a; }
    .calendar-table tbody tr.today-row td { border: 0; background: #f5f9f2; }
    .calendar-table tbody tr.today-row td:nth-child(-n+3) { background: #dcebd9; }
    .calendar-table tbody td:nth-child(1) { min-width: 70px; padding-left: 8px; }
    .calendar-table tbody td:nth-child(1) .fortune-badge { font-size: .72rem; }
}

/* 暦注ごとの説明 */
.term-help { text-align: center; color: var(--muted); font-size: .85rem; margin: 0 0 16px; }
.calendar-terms { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; }
.calendar-term {
    min-height: 0;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 4px;
    padding: 2px 3px;
    font: inherit;
    text-align: left;
    text-decoration: underline dotted;
    text-underline-offset: 4px;
    overflow-wrap: anywhere;
    max-width: 100%;
    cursor: pointer;
}
.calendar-term:hover { background: #dfe9dd; }
.calendar-term.big-good { background: #ffebbb; color: #854300; font-weight: 700; }
.calendar-term.big-bad { background: #fbe1e4; color: #a1253e; font-weight: 700; }
.description-dialog {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0;
    width: min(560px, calc(100% - 24px));
    max-height: min(82dvh, 740px);
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 18px 60px #17271f4d;
}
.description-dialog::backdrop { background: #182b23a6; }
.description-panel { display: flex; flex-direction: column; max-height: min(82dvh, 740px); }
.description-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.description-header h2 { margin: 0; overflow-wrap: anywhere; }
.description-close { background: #edf1eb; color: var(--green); border: 0; border-radius: 50%; width: 44px; min-height: 44px; font-size: 1.6rem; line-height: 1; }
.description-body { overflow-y: auto; padding: 20px; font-size: 1rem; line-height: 1.9; overflow-wrap: anywhere; }
.description-body .data { display: block; position: static; }
.description-body .data + .data { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.description-body h3 { color: var(--green); font-size: 1.1rem; margin: 0 0 10px; line-height: 1.5; }
.description-footer { flex-shrink: 0; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.description-footer .primary-button { width: 100%; }
@media (max-width: 900px) {
    .calendar-term { padding: 5px 4px; min-height: 38px; }
    .calendar-table tbody td:nth-child(3) .calendar-terms { justify-content: flex-end; }
    .description-body { padding: 16px; }
}

.birth-memory { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; flex-basis: 100%; font-size: .9rem; }
.remember-label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.remember-label input { width: 19px; height: 19px; accent-color: var(--green); flex: 0 0 auto; }
.forget-button { min-height: 38px; border: 1px solid var(--line); border-radius: 7px; background: #f0f2ed; color: var(--green); padding: 5px 12px; font-size: .85rem; }
.memory-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .85rem; }

/* LINE公式「今日の暦」への案内 */
.line-promo { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; margin-bottom: 20px; border: 1px solid #b9ddc8; border-radius: 14px; background: #eaf6ee; }
.line-promo-copy { flex: 1; min-width: 0; }
.line-promo-label { margin: 0 0 4px; color: #246b43; font-weight: 700; font-size: .8rem; }
.line-promo h2 { margin: 0 0 6px; color: #234e37; font-size: clamp(1.15rem, 2.6vw, 1.5rem); }
.line-promo p:not(.line-promo-label) { margin: 0 0 13px; font-size: .94rem; color: #365244; }
.line-add { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 48px; padding: 11px 18px; border-radius: 8px; color: #fff; background: #00883f; font-weight: 700; text-decoration: none; line-height: 1.5; box-shadow: 0 2px 4px #075c3320; }
.line-add:hover { background: #007435; color: #fff; }
.line-arrow { margin-left: 4px; font-size: 1.4rem; line-height: 1; }
.line-qr { display: grid; gap: 5px; justify-items: center; flex-shrink: 0; color: #365244; font-size: .74rem; text-decoration: none; }
.line-qr img { display: block; width: 126px; height: 126px; background: white; border-radius: 7px; }
.line-promo-bottom p:not(.line-promo-label) { margin-bottom: 0; }
@media (max-width: 600px) {
    .line-promo { padding: 16px; flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
    .line-add { width: 100%; }
    .line-qr { display: none; }
}

/* 写真と実際の配信画面を組み合わせたLINE案内 */
.line-promo-feature {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(220px, 1fr) auto;
    gap: 18px;
    padding: 16px;
}
.line-promo-visual {
    display: block;
    overflow: hidden;
    border-radius: 10px;
    background: #f7f2e7;
}
.line-promo-visual img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 1;
}
.line-promo-feature .line-promo-copy { align-self: center; }
.line-promo-feature .line-add { padding-inline: 12px; }
@media (max-width: 1020px) {
    .line-promo-feature { grid-template-columns: minmax(0, 1fr) auto; }
    .line-promo-visual { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .line-promo-feature { grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 12px; }
    .line-promo-feature .line-promo-copy { padding: 0 4px 4px; }
    .line-promo-feature .line-qr { display: none; }
}

.line-promo-visual { position: relative; }
.line-banner-message {
    position: absolute;
    inset: 0 auto 0 0;
    width: 49%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
    padding: clamp(10px, 2.4vw, 28px);
    color: #fffdf7;
    background: linear-gradient(90deg, rgba(28, 60, 45, .92), rgba(28, 60, 45, .7) 57%, rgba(28, 60, 45, 0));
    text-shadow: 0 1px 3px #182c20aa;
}
.line-banner-title {
    font-size: clamp(.95rem, 2.6vw, 2.1rem);
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: .015em;
    white-space: nowrap;
}
.line-banner-subtitle {
    font-size: clamp(.72rem, 1.6vw, 1.2rem);
    font-weight: 650;
    line-height: 1.45;
}
@media (min-width: 1021px) {
    .line-banner-title { font-size: clamp(1rem, 1.7vw, 1.5rem); }
    .line-banner-subtitle { font-size: clamp(.8rem, 1vw, 1rem); }
}
@media (max-width: 600px) {
    .line-banner-message { width: 58%; padding: 8px 10px; gap: 4px; }
    .line-banner-title { font-size: clamp(.85rem, 4vw, 1.3rem); }
    .line-banner-subtitle { font-size: clamp(.65rem, 3vw, .9rem); }
}

/* 納音占いの共有 */
.natchin-share-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.natchin-share-actions .memory-status:empty { display: none; }
.share-copy-button, .share-calendar-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px; border: 1px solid #b8cbbd; border-radius: 8px; background: #edf1eb; color: var(--green); font-weight: 700; text-decoration: none; text-align: center; }
.share-url { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.share-result-page { max-width: 900px; }
@media (max-width: 900px) {
    .natchin-share-actions > button, .natchin-share-actions > a { width: 100%; }
}

/* 納音占いのSNS共有メニュー */
.natchin-share-menu {
    display: flex;
    flex: 0 0 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.natchin-share-menu[hidden] {
    display: none;
}

.natchin-share-menu a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 180px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
    transition: opacity .2s;
}

.natchin-share-menu a:hover {
    opacity: .8;
}

.natchin-share-menu .sns-line {
    background: #06C755;
}

.natchin-share-menu .sns-x {
    background: #111;
}

.natchin-share-menu .sns-facebook {
    background: #1877F2;
}

@media (max-width: 480px) {
    .natchin-share-menu a {
        padding: 10px 8px;
        font-size: .85rem;
    }
}

/* Instagram向け納音画像共有 */
.instagram-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(
        45deg,
        #f09433,
        #e6683c,
        #dc2743,
        #cc2366,
        #bc1888
    );
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: opacity .2s;
}

.instagram-share-button:hover {
    opacity: .85;
}

.instagram-share-guide {
    display: flex;
    flex: 0 0 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
}

.instagram-share-guide[hidden] {
    display: none;
}

.instagram-share-guide p {
    flex: 0 0 100%;
    text-align: center;
    margin: 0;
}

.instagram-share-guide textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    resize: vertical;
    box-sizing: border-box;
}
