/* 经期记录：所有规则均以 period 前缀隔离，避免影响旧页面。 */
:root {
    --period-ink: #4b2734;
    --period-muted: #886875;
    --period-paper: #fffaf7;
    --period-blush: #f7d7d8;
    --period-rose: #c94f6d;
    --period-rose-dark: #9b3653;
    --period-plum: #623247;
    --period-line: rgba(110, 58, 76, 0.16);
    --period-shadow: 0 24px 60px rgba(104, 47, 68, 0.13);
}

#period-section {
    max-width: 1280px;
    padding-top: 112px;
    color: var(--period-ink);
}

.period-shell {
    position: relative;
    min-height: 720px;
    padding: clamp(22px, 4vw, 52px);
    overflow: hidden;
    border: 1px solid rgba(122, 63, 84, 0.12);
    border-radius: 36px;
    background:
        radial-gradient(circle at 91% 8%, rgba(222, 135, 147, 0.22), transparent 28%),
        radial-gradient(circle at 4% 90%, rgba(237, 193, 163, 0.2), transparent 28%),
        linear-gradient(145deg, rgba(255, 253, 249, 0.97), rgba(255, 244, 242, 0.96));
    box-shadow: var(--period-shadow);
    isolation: isolate;
}

.period-shell::before,
.period-shell::after {
    position: absolute;
    z-index: -1;
    width: 230px;
    height: 230px;
    border: 1px solid rgba(161, 79, 101, 0.12);
    border-radius: 50%;
    content: "";
}

.period-shell::before { top: -118px; right: 8%; }
.period-shell::after { bottom: -150px; left: 2%; width: 310px; height: 310px; }

.period-heading,
.period-card__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.period-heading {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--period-line);
}

#period-section .period-heading h2 {
    margin: 4px 0 7px !important;
    color: var(--period-plum);
    font-family: "STKaiti", "KaiTi", "Songti SC", serif;
    font-size: clamp(2rem, 5vw, 3.4rem) !important;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.period-heading p,
.period-gate p,
.period-cycle-copy p { margin: 0; color: var(--period-muted); line-height: 1.7; }

.period-eyebrow {
    display: block;
    color: var(--period-rose-dark);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.period-button,
.period-icon-button {
    border: 0;
    font: inherit;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.period-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
}

.period-button--primary {
    color: #fff;
    background: linear-gradient(115deg, var(--period-plum), var(--period-rose));
    box-shadow: 0 9px 22px rgba(166, 59, 88, 0.22);
}

.period-button--quiet {
    color: var(--period-plum);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px var(--period-line);
}

.period-button:hover,
.period-icon-button:hover { transform: translateY(-2px); }
.period-button:active,
.period-icon-button:active { transform: translateY(0); }
.period-button:focus-visible,
.period-icon-button:focus-visible,
#period-section input:focus-visible,
#period-section select:focus-visible,
#period-section textarea:focus-visible,
.period-calendar-day:focus-visible { outline: 3px solid rgba(201, 79, 109, 0.28); outline-offset: 2px; }

.period-icon-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    color: var(--period-plum);
    background: rgba(255, 255, 255, 0.68);
    box-shadow: inset 0 0 0 1px var(--period-line);
}

.period-gate {
    display: grid;
    max-width: 760px;
    margin: 58px auto;
    grid-template-columns: 190px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--period-line);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 20px 50px rgba(97, 48, 67, 0.1);
}

.period-gate__mark {
    display: grid;
    min-height: 330px;
    place-items: center;
    color: rgba(255, 255, 255, 0.92);
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.16), transparent 28%),
        linear-gradient(160deg, var(--period-plum), #9f4762 70%, #d37c83);
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 5rem;
}

.period-gate__content { padding: 42px; }
.period-gate__content h3,
.period-card h3,
.period-cycle-copy h3 { margin: 6px 0 12px; color: var(--period-plum); font-family: "STKaiti", "KaiTi", serif; font-size: 1.65rem; }
.period-gate__form { display: grid; gap: 10px; margin-top: 24px; }

#period-section label,
#period-section legend {
    color: var(--period-plum);
    font-size: 0.88rem;
    font-weight: 700;
}

#period-section input[type="password"],
#period-section input[type="date"],
#period-section select,
#period-section textarea {
    width: 100%;
    border: 1px solid rgba(116, 62, 80, 0.2);
    border-radius: 14px;
    color: var(--period-ink);
    background: rgba(255, 255, 255, 0.9);
    font: inherit;
}

#period-section input[type="password"],
#period-section input[type="date"],
#period-section select { height: 46px; padding: 0 13px; }
#period-section textarea { min-height: 88px; padding: 12px 13px; resize: vertical; }

.period-password-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.period-form-error { min-height: 20px; margin: 0; color: #aa284f !important; font-size: 0.83rem; }

.period-app[hidden], .period-gate[hidden] { display: none !important; }
.period-button[hidden],
.period-toast[hidden],
#period-import-file[hidden] { display: none !important; }

.period-app { animation: periodRise 400ms ease both; }

@keyframes periodRise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.period-overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr); gap: 20px; }

.period-cycle-card {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    min-height: 250px;
    padding: 30px;
    border-radius: 30px;
    color: #fff;
    background:
        radial-gradient(circle at 72% 15%, rgba(255, 255, 255, 0.14), transparent 28%),
        linear-gradient(135deg, #4c2838, #82405a 64%, #bd6572);
    box-shadow: 0 20px 45px rgba(84, 39, 56, 0.2);
}

.period-cycle-dial {
    position: relative;
    display: grid;
    width: 172px;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#f4c1bd var(--cycle-progress), rgba(255, 255, 255, 0.14) 0);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), inset 0 0 35px rgba(255, 255, 255, 0.06);
}

.period-cycle-dial::before {
    position: absolute;
    width: 134px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #633047;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.15);
    content: "";
}

.period-cycle-dial__center { position: relative; display: flex; align-items: baseline; gap: 5px; text-align: center; }
.period-cycle-dial__center span { position: absolute; right: 0; bottom: 100%; left: 0; font-size: 0.78rem; opacity: 0.78; }
.period-cycle-dial__center strong { font-family: Georgia, serif; font-size: 3.4rem; line-height: 1; }
.period-cycle-dial__center small { font-size: 0.76rem; opacity: 0.78; }
.period-cycle-copy .period-eyebrow { color: #f5c9c8; }
.period-cycle-copy h3 { color: #fff; font-size: 1.8rem; }
.period-cycle-copy p { color: rgba(255, 255, 255, 0.76); }
.period-cycle-copy .period-button { margin-top: 20px; color: var(--period-plum); background: #fff5f1; box-shadow: none; }

.period-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.period-stats article {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    border: 1px solid var(--period-line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.68);
}
.period-stats span { color: var(--period-muted); font-size: 0.75rem; }
.period-stats strong { margin-top: 4px; color: var(--period-plum); font-family: Georgia, serif; font-size: 2.2rem; line-height: 1; }
.period-stats small { color: var(--period-muted); font-size: 0.7rem; }

.period-workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr); gap: 20px; margin-top: 20px; }
.period-card { padding: 26px; border: 1px solid var(--period-line); border-radius: 28px; background: rgba(255, 255, 255, 0.72); box-shadow: 0 12px 35px rgba(83, 42, 57, 0.06); }
.period-card__heading { margin-bottom: 20px; }
.period-card__heading h3 { margin-bottom: 0; }

.period-calendar-actions,
.period-data-actions { display: flex; align-items: center; gap: 8px; }
.period-calendar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 2px 0 18px; color: var(--period-muted); font-size: 0.75rem; }
.period-calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.period-legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.period-legend-dot--recorded { background: var(--period-rose); }
.period-legend-dot--predicted { border: 1px dashed var(--period-rose); background: #fff0ec; }
.period-legend-dot--today { background: var(--period-plum); box-shadow: 0 0 0 3px rgba(98, 50, 71, 0.12); }

.period-weekdays,
.period-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.period-weekdays { margin-bottom: 7px; color: var(--period-muted); font-size: 0.72rem; font-weight: 800; text-align: center; }
.period-calendar-day {
    position: relative;
    display: grid;
    min-height: 49px;
    place-items: center;
    border: 0;
    border-radius: 14px;
    color: var(--period-ink);
    background: rgba(255, 250, 247, 0.82);
    font: 700 0.88rem/1 Georgia, serif;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}
.period-calendar-day:hover { transform: translateY(-2px); background: #fff; }
.period-calendar-day--outside { opacity: 0.3; }
.period-calendar-day--recorded { color: #fff; background: linear-gradient(145deg, #db7283, var(--period-rose)); box-shadow: 0 7px 16px rgba(190, 74, 100, 0.23); }
.period-calendar-day--predicted { color: var(--period-rose-dark); border: 1px dashed rgba(183, 68, 96, 0.55); background: #fff0ed; }
.period-calendar-day--today::after { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }

.period-record-form { display: grid; gap: 17px; }
.period-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.period-record-form label { display: grid; gap: 7px; }
.period-record-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.period-record-form legend { margin-bottom: 8px; }
.period-choice-row,
.period-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.period-choice-row input,
.period-chip-row input { position: absolute; opacity: 0; pointer-events: none; }
.period-choice-row span,
.period-chip-row span { display: inline-flex; min-height: 36px; align-items: center; padding: 7px 13px; border: 1px solid var(--period-line); border-radius: 999px; color: var(--period-muted); background: #fffaf7; cursor: pointer; transition: 150ms ease; }
.period-choice-row input:checked + span,
.period-chip-row input:checked + span { color: #fff; border-color: transparent; background: var(--period-rose); box-shadow: 0 6px 14px rgba(183, 68, 96, 0.2); }
.period-choice-row input:focus-visible + span,
.period-chip-row input:focus-visible + span { outline: 3px solid rgba(201, 79, 109, 0.25); outline-offset: 2px; }

.period-history-card { margin-top: 20px; }
.period-history { display: grid; gap: 10px; }
.period-history-empty { padding: 34px 20px; border: 1px dashed var(--period-line); border-radius: 20px; color: var(--period-muted); text-align: center; }
.period-history-item { display: grid; grid-template-columns: 85px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 15px 16px; border-radius: 20px; background: rgba(255, 247, 244, 0.85); }
.period-history-date { display: grid; place-items: center; align-self: stretch; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--period-plum), var(--period-rose)); text-align: center; }
.period-history-date strong { font: 700 1.6rem/1 Georgia, serif; }
.period-history-date span { margin-top: 3px; font-size: 0.68rem; opacity: 0.8; }
.period-history-copy strong { display: block; color: var(--period-plum); }
.period-history-copy p { margin: 5px 0 0; color: var(--period-muted); font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.period-history-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.period-history-tags span { padding: 4px 8px; border-radius: 999px; color: var(--period-rose-dark); background: rgba(201, 79, 109, 0.1); font-size: 0.68rem; }
.period-history-actions { display: flex; gap: 7px; }
.period-history-actions button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--period-muted); background: #fff; cursor: pointer; box-shadow: inset 0 0 0 1px var(--period-line); }
.period-history-actions button:hover { color: var(--period-rose-dark); }

.period-toast { position: fixed; right: 24px; bottom: 24px; z-index: 1300; max-width: min(360px, calc(100vw - 32px)); padding: 13px 18px; border-radius: 15px; color: #fff; background: var(--period-plum); box-shadow: 0 14px 35px rgba(69, 31, 46, 0.24); animation: periodRise 220ms ease; }

@media (min-width: 769px) and (max-width: 1320px) {
    .navbar { padding: 14px 20px !important; }
    .nav-links { gap: 7px !important; }
    .nav-links a { gap: 5px !important; padding: 9px 11px !important; font-size: 0.82rem !important; }
    .nav-brand { font-size: 1.15rem !important; }
}

@media (max-width: 980px) {
    .period-overview,
    .period-workspace { grid-template-columns: 1fr; }
    .period-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    #period-section.section { padding: 156px 10px 34px !important; }
    .period-shell { min-height: 600px; padding: 22px 14px; border-radius: 24px; }
    .period-heading { align-items: center; margin-bottom: 22px; padding: 0 4px 18px; }
    #period-section .period-heading h2 { margin-bottom: 3px !important; font-size: 2.2rem !important; }
    .period-heading p { font-size: 0.82rem; }
    .period-gate { margin: 26px 0; grid-template-columns: 1fr; }
    .period-gate__mark { min-height: 92px; font-size: 2.8rem; }
    .period-gate__content { padding: 25px 20px; }
    .period-cycle-card { grid-template-columns: 135px minmax(0, 1fr); min-height: 220px; gap: 19px; padding: 22px 18px; }
    .period-cycle-dial { width: 130px; }
    .period-cycle-dial::before { width: 100px; }
    .period-cycle-dial__center strong { font-size: 2.65rem; }
    .period-cycle-copy h3 { font-size: 1.45rem; }
    .period-stats article { min-height: 94px; padding: 13px; }
    .period-card { padding: 20px 14px; border-radius: 22px; }
    .period-calendar-day { min-height: 43px; border-radius: 11px; }
    .period-history-item { grid-template-columns: 64px minmax(0, 1fr); }
    .period-history-actions { grid-column: 2; justify-content: flex-end; }
}

@media (max-width: 520px) {
    #period-section.section { padding-top: 176px !important; }
    .period-heading .period-button { width: 42px; padding: 0; font-size: 0; }
    .period-heading .period-button i { font-size: 0.9rem; }
    .period-cycle-card { grid-template-columns: 1fr; text-align: center; }
    .period-cycle-dial { margin: 0 auto; }
    .period-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
    .period-stats article { min-width: 0; padding: 10px 7px; text-align: center; }
    .period-stats strong { font-size: 1.8rem; }
    .period-calendar-card .period-card__heading,
    .period-history-card .period-card__heading { align-items: flex-start; flex-direction: column; }
    .period-calendar-actions,
    .period-data-actions { width: 100%; justify-content: space-between; }
    .period-calendar-day { min-height: 38px; font-size: 0.78rem; }
    .period-form-row { grid-template-columns: 1fr; }
    .period-history-item { padding: 12px; gap: 11px; }
}

@media (max-width: 375px) {
    #period-section.section { padding-top: 198px !important; }
    .period-calendar-grid, .period-weekdays { gap: 3px; }
    .period-calendar-day { min-height: 34px; border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    .period-app,
    .period-toast { animation: none; }
    .period-button,
    .period-icon-button,
    .period-calendar-day { transition: none; }
}
