:root {
    --night: #07080b;
    --night-raised: #0d0e12;
    --panel: rgba(16, 17, 22, .76);
    --paper: #eee8e1;
    --paper-soft: #d3cbc2;
    --muted: #92949b;
    --quiet: #6f727a;
    --pink: #ec4e82;
    --amber: #d99a6a;
    --amber-bright: #efb989;
    --line: rgba(255, 255, 255, .10);
    --line-soft: rgba(255, 255, 255, .065);
}

html { scroll-behavior: smooth; background: var(--night); }
body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--paper);
    background:
        linear-gradient(90deg, transparent calc(20% - .5px), rgba(255,255,255,.018) 20%, transparent calc(20% + .5px)),
        linear-gradient(90deg, transparent calc(40% - .5px), rgba(255,255,255,.018) 40%, transparent calc(40% + .5px)),
        linear-gradient(90deg, transparent calc(60% - .5px), rgba(255,255,255,.018) 60%, transparent calc(60% + .5px)),
        linear-gradient(90deg, transparent calc(80% - .5px), rgba(255,255,255,.018) 80%, transparent calc(80% + .5px)),
        radial-gradient(circle at 85% 0%, rgba(119, 55, 34, .25), transparent 29rem),
        var(--night);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}
body.dialog-open { overflow: hidden; }
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle 360px at 78% 18%, rgba(225, 143, 83, .07), transparent 72%);
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: .075;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

a { color: inherit; }
button { color: inherit; font: inherit; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--amber-bright); outline-offset: 3px; }
[hidden] { display: none !important; }

.nightbar-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 62px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 8, 11, .78);
    backdrop-filter: blur(18px) saturate(120%);
}
.nav-shell, .festival-main, .footer-shell { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.nav-shell { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark, .footer-mark {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: #fff;
    background: var(--pink);
    box-shadow: 0 0 28px rgba(236, 78, 130, .22);
    font-size: 9px;
    font-weight: 800;
}
.brand-name { font-size: 12px; letter-spacing: .13em; }
.nav-links { display: flex; align-items: center; gap: 25px; }
.nav-links a { position: relative; color: #777981; text-decoration: none; font-size: 9px; letter-spacing: .12em; }
.nav-links a::after { content: ""; position: absolute; bottom: -8px; left: 0; width: 0; height: 1px; background: linear-gradient(90deg, var(--amber), transparent); transition: width .3s ease; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: #d8d0c7; }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { width: 100%; }

.festival-main { position: relative; z-index: 1; padding: 24px 0 54px; }
.festival-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 38px; padding: 6px 0 18px; }
.eyebrow, .result-kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; color: var(--amber); font-size: 8px; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow::before, .result-kicker::before { content: ""; width: 28px; height: 1px; background: var(--amber); box-shadow: 0 0 9px rgba(221, 160, 111, .42); }
.festival-hero h1 { margin: 0; color: var(--paper); font: 400 clamp(34px, 4vw, 52px)/1 "Songti SC", STSong, Georgia, serif; letter-spacing: -.055em; }
.hero-deck { margin: 9px 0 0; color: #85878e; font-size: 11px; line-height: 1.6; letter-spacing: .01em; }
.month-overview { min-width: 154px; padding: 0 0 4px; text-align: right; }
.month-overview span, .month-overview strong { display: block; }
.month-overview span { color: var(--quiet); font-size: 8px; letter-spacing: .17em; text-transform: uppercase; }
.month-overview strong { margin-top: 6px; color: var(--paper-soft); font: italic 17px Georgia, "Songti SC", serif; }

.festival-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 58px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.period-switcher { display: flex; align-items: center; gap: 13px; }
.round-button { display: grid; width: 36px; height: 36px; place-items: center; padding: 0; border: 1px solid #35373d; border-radius: 50%; background: rgba(255, 255, 255, .02); color: #a39e98; cursor: pointer; transition: border-color .24s, background .24s, color .24s, transform .24s; }
.round-button:hover:not(:disabled) { transform: translateY(-1px); border-color: #a56c48; background: rgba(221, 160, 111, .10); color: #f0bc91; }
.round-button:disabled, .current-month-button:disabled { opacity: .3; cursor: default; }
.period-title { min-width: 118px; text-align: center; }
.period-title span { display: block; color: #858890; font-size: 8px; letter-spacing: .13em; }
.period-title strong { display: block; margin-top: 2px; color: #ddd5cc; font: italic 16px Georgia, "Songti SC", serif; }
.current-month-button { min-height: 34px; padding: 6px 14px; border: 1px solid #34363c; border-radius: 999px; color: #9a9ca2; background: rgba(255, 255, 255, .018); cursor: pointer; font-size: 10px; letter-spacing: .04em; transition: border-color .24s, color .24s, background .24s; }
.current-month-button:hover:not(:disabled) { border-color: rgba(217, 154, 106, .55); color: var(--amber-bright); background: rgba(217, 154, 106, .08); }

.browse-rails { border-bottom: 1px solid var(--line); }
.month-rail, .category-strip, .week-rail { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.month-rail::-webkit-scrollbar, .category-strip::-webkit-scrollbar, .week-rail::-webkit-scrollbar { display: none; }
.month-rail { padding: 13px 0 8px; }
.category-strip { padding: 0 0 12px; }
.month-button, .category-button, .week-jump { flex: 0 0 auto; border: 1px solid #303238; border-radius: 999px; background: rgba(255, 255, 255, .015); color: #777a81; cursor: pointer; white-space: nowrap; transition: border-color .22s, color .22s, background .22s; }
.month-button { min-width: 52px; min-height: 29px; padding: 4px 10px; font: italic 10px Georgia, serif; }
.category-button { min-height: 29px; padding: 4px 11px; color: #8f9198; font-size: 9.5px; }
.month-button:hover, .month-button.active, .category-button:hover, .category-button.active, .week-jump:hover, .week-jump.active { border-color: #9d6744; color: #e9b487; background: rgba(216, 149, 101, .10); }
.month-button:disabled { opacity: .22; cursor: default; }

.result-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 20px 0 12px; }
.result-heading h2 { margin: 0; color: #d8d0c7; font: 400 clamp(22px, 2.4vw, 31px) "Songti SC", STSong, Georgia, serif; }
.result-heading > p { margin: 0 0 2px; color: #989aa1; font-size: 10.5px; }
.week-rail { min-height: 41px; padding: 0 0 12px; }
.week-rail[aria-busy="true"]::before { content: ""; display: block; width: 112px; min-height: 29px; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; background: linear-gradient(90deg, rgba(255,255,255,.035), rgba(221,160,111,.10), rgba(255,255,255,.035)); background-size: 200% 100%; animation: loading-shimmer 1.8s ease-in-out infinite; }
.week-jump { min-height: 29px; padding: 4px 11px; font-size: 9.5px; }

.festival-weeks { display: grid; grid-template-columns: repeat(var(--week-count, 5), minmax(0, 1fr)); gap: 10px; align-items: start; min-height: 520px; }
.festival-loading-shell { position: relative; grid-column: 1 / -1; min-height: 520px; display: grid; place-items: center; border: 1px solid var(--line); color: #777a81; font-size: 10px; letter-spacing: .06em; background: linear-gradient(145deg, rgba(255,255,255,.025), rgba(255,255,255,.008)); }
.festival-loading-shell::before { content: ""; position: absolute; width: min(260px, 42%); height: 1px; background: linear-gradient(90deg, transparent, rgba(221,160,111,.32), transparent); transform: translateY(28px); }
.week-section { min-width: 0; scroll-margin-top: 78px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012) 34%), rgba(12, 13, 17, .72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 18px 44px rgba(0, 0, 0, .16); }
.week-section.is-current { border-color: rgba(217, 154, 106, .42); box-shadow: inset 0 1px 0 rgba(242, 185, 137, .12), 0 0 42px rgba(135, 67, 36, .12); }
.week-header { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .018); }
.week-heading { min-width: 0; }
.week-index { display: block; color: var(--amber); font-size: 9px; font-weight: 650; letter-spacing: .08em; }
.week-range { display: block; margin-top: 6px; overflow: hidden; color: #9b9da3; font: italic 10.5px Georgia, "Songti SC", serif; text-overflow: ellipsis; white-space: nowrap; }
.week-count { flex: 0 0 auto; color: #696c73; font-size: 8.5px; }
.week-section.is-current .week-header { background: radial-gradient(circle at 14% 30%, rgba(224, 145, 89, .11), transparent 60%), rgba(255, 255, 255, .018); }
.week-section.is-current .week-count { color: #aa8268; }

.festival-list { display: grid; }
.festival-item { position: relative; min-width: 0; min-height: 70px; display: grid; grid-template-columns: 39px minmax(0, 1fr) 15px; align-items: center; gap: 9px; padding: 10px 10px 10px 12px; border: 0; border-top: 1px solid var(--line-soft); color: inherit; background: transparent; text-align: left; cursor: pointer; transition: background .24s, box-shadow .24s; }
.festival-item:first-child { border-top: 0; }
.festival-item::before { content: ""; position: absolute; left: 0; top: 15%; width: 1px; height: 70%; background: var(--amber); opacity: 0; transform: scaleY(.35); transition: opacity .24s, transform .24s; }
.festival-item:hover { background: radial-gradient(circle at 9% 50%, rgba(230, 157, 101, .115), transparent 52%), rgba(255, 255, 255, .018); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025); }
.festival-item:hover::before, .festival-item:focus-visible::before { opacity: .75; transform: scaleY(1); }
.festival-item.is-today { background: rgba(217, 154, 106, .055); }
.festival-date { align-self: stretch; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line-soft); }
.festival-day { color: #d9a17a; font: italic 18px/1 Georgia, serif; }
.festival-weekday { margin-top: 5px; color: #6f7279; font-size: 8px; }
.festival-item-copy { min-width: 0; display: block; }
.festival-item-title { display: block; overflow: hidden; color: #dcd5cd; font: 500 13.5px/1.35 "Songti SC", STSong, Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.festival-kind { display: block; margin-top: 7px; overflow: hidden; color: #7f8188; font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.festival-item-arrow { color: #5f6269; font-size: 11px; transition: color .22s, transform .22s; }
.festival-item:hover .festival-item-arrow { color: var(--amber-bright); transform: translate(1px, -1px); }

.festival-empty { padding: 66px 24px; border: 1px solid var(--line); text-align: center; background: rgba(255, 255, 255, .018); }
.festival-empty strong { color: #d8d0c7; font: 400 22px "Songti SC", STSong, Georgia, serif; }
.festival-empty p { margin: 10px 0 0; color: #92949b; font-size: 11.5px; }

.nightbar-footer { position: relative; z-index: 1; min-height: 80px; border-top: 1px solid var(--line); background: rgba(7, 8, 11, .66); }
.footer-shell { min-height: 80px; display: flex; align-items: center; gap: 14px; color: #85888f; font-size: 9.5px; letter-spacing: .04em; }
.footer-mark { width: 26px; height: 26px; font-size: 8px; }
.footer-data { color: #686b72; }
.footer-shell a { margin-left: auto; color: #777981; text-decoration: none; }
.footer-shell a:hover { color: var(--amber); }

.festival-dialog { position: fixed; inset: 0 0 0 auto; width: min(760px, calc(100% - 70px)); height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; border-left: 1px solid rgba(221, 160, 111, .34); color: var(--paper); background: linear-gradient(145deg, rgba(29, 30, 36, .995), rgba(11, 12, 16, .998)); box-shadow: -34px 0 110px rgba(0, 0, 0, .72); animation: drawer-enter .34s cubic-bezier(.2, .75, .25, 1) both; }
.festival-dialog::backdrop { background: rgba(0, 0, 0, .68); backdrop-filter: blur(7px); }
.dialog-layout { display: grid; grid-template-columns: 108px minmax(0, 1fr); min-height: 100dvh; }
.dialog-rail { padding: 27px 19px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(8, 9, 12, .62); }
.dialog-day { color: var(--amber); font: italic 31px Georgia, serif; }
.dialog-rail-label { margin-top: 30px; color: #858890; font-size: 8px; letter-spacing: .13em; text-transform: uppercase; writing-mode: vertical-rl; }
.dialog-year { margin-top: auto; color: #7f8289; font-size: 8.5px; letter-spacing: .04em; }
.dialog-reader { position: relative; min-width: 0; height: 100dvh; overflow: hidden; }
.dialog-close { position: absolute; top: 18px; right: 20px; z-index: 2; display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid #3a3c42; border-radius: 50%; color: #bbb4ac; background: rgba(255, 255, 255, .025); cursor: pointer; font-size: 20px; }
.dialog-close:hover { border-color: #c47c52; color: #fff; }
.dialog-content { height: 100dvh; padding: 32px clamp(28px, 5vw, 56px) 48px; overflow-y: auto; scrollbar-color: #6e4934 transparent; scrollbar-width: thin; }
.dialog-header { padding: 0 50px 26px 0; border-bottom: 1px solid var(--line); }
.dialog-meta { margin: 0; color: var(--amber); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.dialog-header h2 { margin: 13px 0 16px; color: var(--paper); font: 400 clamp(28px, 4vw, 45px)/1.14 "Songti SC", STSong, Georgia, serif; letter-spacing: -.04em; }
.dialog-introduction { margin: 0; color: #a0a2a8; font-size: 12.5px; line-height: 1.78; }
.dialog-keywords { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.dialog-keywords span { padding: 5px 9px; border: 1px solid rgba(221, 160, 111, .25); border-radius: 999px; color: #c39779; font-size: 9.5px; }
.emotion-section { margin-top: 28px; }
.emotion-section h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; color: #c6bfb7; font: 500 15.5px "Songti SC", STSong, Georgia, serif; }
.emotion-section h3::before { content: ""; width: 17px; height: 1px; background: var(--amber); }
.emotion-copy { color: #b0b2b7; font-size: 13.5px; line-height: 1.85; white-space: pre-line; }
.emotion-reference-marker { color: var(--amber-bright); font-size: .86em; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.emotion-reference-marker:hover { color: #fff0dc; }
.user-subtext-section { padding: 21px 22px 23px; border: 1px solid rgba(221, 160, 111, .14); background: rgba(221, 160, 111, .045); }
.reference-list { margin: 0; padding: 0; color: #989aa1; font-size: 10.5px; line-height: 1.65; list-style: none; }
.reference-list li + li { margin-top: 8px; }
.reference-link { display: flex; align-items: flex-start; gap: 8px; color: #a87b5f; text-decoration: none; overflow-wrap: anywhere; }
.reference-link:hover { color: var(--amber-bright); }
.reference-number { flex: 0 0 22px; color: #d99a6a; }
.reference-title { min-width: 0; }
.dialog-status { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: #989aa1; font-size: 10.5px; line-height: 1.65; }

@keyframes drawer-enter { from { opacity: .35; transform: translateX(34px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sheet-enter { from { opacity: .45; transform: translateY(34px); } to { opacity: 1; transform: translateY(0); } }
@keyframes loading-shimmer { 0%, 100% { background-position: 200% 0; } 50% { background-position: -100% 0; } }

@media (max-width: 1100px) and (min-width: 701px) {
    .festival-weeks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .nav-shell, .festival-main, .footer-shell { width: min(100% - 28px, 1320px); }
    .nightbar-nav { height: 58px; }
    .brand-name { font-size: 10px; }
    .nav-links a:not([aria-current="page"]) { display: none; }
    .festival-main { padding: 18px 0 42px; }
    .festival-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 2px 0 15px; }
    .festival-hero h1 { font-size: clamp(31px, 9vw, 40px); }
    .hero-deck { max-width: 220px; margin-top: 7px; font-size: 10px; }
    .month-overview { min-width: 80px; padding-bottom: 1px; }
    .month-overview strong { font-size: 13px; }
    .festival-controls { min-height: 54px; }
    .period-switcher { gap: 8px; }
    .period-title { min-width: 92px; }
    .round-button { width: 38px; height: 38px; }
    .current-month-button { min-height: 36px; padding-inline: 11px; }
    .month-rail { padding-top: 11px; }
    .category-strip { padding-bottom: 11px; }
    .result-heading { align-items: flex-start; padding: 18px 0 10px; }
    .result-heading > p { padding-top: 20px; white-space: nowrap; }
    .week-rail { position: sticky; top: 58px; z-index: 18; margin: 0 -14px; padding: 8px 14px; border-top: 1px solid rgba(255, 255, 255, .055); border-bottom: 1px solid rgba(255, 255, 255, .08); background: rgba(7, 8, 11, .89); backdrop-filter: blur(16px); }
    .week-jump { min-height: 32px; }
    .festival-weeks { grid-template-columns: 1fr; gap: 18px; min-height: 1160px; padding-top: 12px; }
    .festival-loading-shell { min-height: 1160px; }
    .week-section { scroll-margin-top: 110px; }
    .week-header { position: static; top: auto; z-index: auto; min-height: 58px; background: rgba(18, 19, 24, .96); backdrop-filter: none; }
    .festival-item { min-height: 65px; grid-template-columns: 42px minmax(0, 1fr) 18px; padding: 9px 12px; }
    .festival-item-title { font-size: 14.5px; }
    .festival-day { font-size: 19px; }
    .footer-shell { min-height: 0; flex-wrap: wrap; padding: 18px 0; gap: 9px 13px; }
    .footer-data { flex-basis: calc(50% - 20px); }
    .footer-shell a { flex-basis: 100%; margin-left: 39px; }

    .festival-dialog { inset: auto 0 0; width: 100%; height: 92dvh; margin: 0; border: 0; border-top: 1px solid rgba(221, 160, 111, .38); border-radius: 18px 18px 0 0; animation-name: sheet-enter; }
    .festival-dialog::backdrop { background: rgba(0, 0, 0, .72); }
    .dialog-layout { grid-template-columns: 1fr; min-height: 92dvh; }
    .dialog-rail { display: none; }
    .dialog-reader, .dialog-content { height: 92dvh; }
    .dialog-content { padding: 31px 22px 42px; }
    .dialog-header { padding-right: 42px; }
    .dialog-close { top: 15px; right: 16px; width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
/* Links preserve native new-tab navigation while ordinary clicks open the drawer. */
.festival-item{text-decoration:none;color:inherit}.dialog-share{display:flex;gap:18px;align-items:center;margin-top:14px;font-size:12px}.dialog-share button{color:inherit;background:transparent;border:1px solid #ffffff30;padding:6px 12px;border-radius:4px;cursor:pointer}
