:root {
    --bg: #0b1130;
    --panel: #161e45;
    --accent: #ffd166;
    --accent-soft: #5ee6d6;
    --accent-glow: #ff6ec7;
    --text: #f5f3ff;
    --muted: #9aa9d6;
    --wheat: rgb(214, 196, 168);
}

* {
    box-sizing: border-box;
    font-family: "Farro", sans-serif;
    font-weight: 300;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 300;
}


body {
    margin: 0;
    background: #333333;
    color: #F5F0E8;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar,
.container,
.footer {
    position: relative;
    z-index: 1;
}

#starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
}

/*
 * The star chart sits directly on the page's starfield background with no
 * frame — it reads as a gravitational-lens "portal" into the same star
 * field (event-horizon style: glowing rim + warped halo).
 * - The canvas stays sharp through most of its radius, then a warped
 *   "lens" ring (SVG turbulence + displacement, see #portal-lens) refracts
 *   its outer ~30% just inside the rim, like looking through curved glass.
 * - A second, stronger-warped ring (#portal-lens-outer) bleeds past the
 *   circle's edge, swirling the starfield around the rim.
 * - A glowing tan rim (box-shadow) traces the photon-ring edge, and a
 *   raking drop shadow grounds the disc against the background.
 */
@keyframes star-chart-float {
    0% {
        transform: translate(0px, 0px);
    }

    15% {
        transform: translate(10px, -14px);
    }

    30% {
        transform: translate(-8px, -8px);
    }

    45% {
        transform: translate(14px, 6px);
    }

    60% {
        transform: translate(-4px, 12px);
    }

    75% {
        transform: translate(-12px, -4px);
    }

    90% {
        transform: translate(6px, -10px);
    }

    100% {
        transform: translate(0px, 0px);
    }
}

/* Counter-animation keeps the canvas content fixed in space while the
   frame (shadow, blur rings) drifts — like a porthole moving across
   a stationary star field. */
@keyframes star-chart-counter-float {
    0% {
        transform: translate(0px, 0px);
    }

    15% {
        transform: translate(-10px, 14px);
    }

    30% {
        transform: translate(8px, 8px);
    }

    45% {
        transform: translate(-14px, -6px);
    }

    60% {
        transform: translate(4px, -12px);
    }

    75% {
        transform: translate(12px, 4px);
    }

    90% {
        transform: translate(-6px, 10px);
    }

    100% {
        transform: translate(0px, 0px);
    }
}

@keyframes star-chart-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.star-chart-frame {
    position: relative;
    flex: none;
    /* --reading-chrome is everything else on the page, so the chart takes the
       height that's left and the whole reading fits without scrolling. */
    width: max(140px, min(85vw, 340px, calc(100vh - var(--reading-chrome, 350px))));
    width: max(140px, min(85vw, 340px, calc(100dvh - var(--reading-chrome, 350px))));
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    /* Same starting shape as the star-chart-blob keyframe's 0% state (not a
       perfect circle) - so there's no visible snap when is-floating's blob
       animation picks up from here; it just continues seamlessly. */
    border-radius: 35% 65% 68% 33% / 55% 38% 63% 45%;
    box-shadow:
        0 0 55px 35px rgba(0, 0, 0, 0.22),
        0 0 110px 70px rgba(0, 0, 0, 0.10);
}

.star-chart-frame.is-entering {
    /* both: stays invisible (the "from" keyframe) through the delay too,
       instead of flashing the default opacity before the fade-in starts. */
    animation: star-chart-enter 0.9s ease 0.6s both;
}

.star-chart-frame.is-floating {
    opacity: 1;
    animation: star-chart-float 22s ease-in-out infinite, star-chart-blob 28s ease-in-out infinite;
}

/* Same organic, irregular border-radius morph the vibration-number blob
   used - the frame is never a perfect circle once floating, just softly
   suggesting one. Box-shadow/blur rings automatically follow whatever
   border-radius is current, no separate shape logic needed for those. */
@keyframes star-chart-blob {
    0%   { border-radius: 35% 65% 68% 33% / 55% 38% 63% 45%; }
    16%  { border-radius: 68% 33% 40% 60% / 35% 65% 45% 55%; }
    33%  { border-radius: 33% 68% 55% 45% / 65% 40% 60% 35%; }
    50%  { border-radius: 64% 36% 48% 53% / 38% 63% 35% 65%; }
    66%  { border-radius: 40% 60% 66% 34% / 58% 35% 68% 43%; }
    83%  { border-radius: 58% 43% 35% 65% / 45% 68% 38% 60%; }
    100% { border-radius: 35% 65% 68% 33% / 55% 38% 63% 45%; }
}

.star-chart {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-mask-image: radial-gradient(circle, #000 36%, transparent 62%);
    mask-image: radial-gradient(circle, #000 36%, transparent 62%);
}

.star-chart-frame.is-floating .star-chart {
    animation: star-chart-counter-float 22s ease-in-out infinite;
}

/* Faint cloudy glass tint drifting over the star field, same gradient
   recipe the vibration-number blob used, following the frame's own
   (animated) shape via border-radius: inherit. */
.star-chart-glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(200, 168, 118, 0.08) 40%, rgba(120, 90, 50, 0.05) 70%, rgba(255, 255, 255, 0.1));
    background-size: 220% 220%;
    mix-blend-mode: overlay;
    pointer-events: none;
    animation: star-chart-glow-shift 20s ease-in-out infinite;
}

@keyframes star-chart-glow-shift {
    0%, 100% { background-position: 0% 0%; }
    50%      { background-position: 100% 100%; }
}

.star-chart-frame::before,
.star-chart-frame::after {
    content: '';
    position: absolute;
    border-radius: 35% 65% 68% 33% / 55% 38% 63% 45%;
    pointer-events: none;
}

/* Inner ring: aggressive blur + warp over the canvas fade zone */
.star-chart-frame::before {
    inset: 0;
    -webkit-mask-image: radial-gradient(circle, transparent 34%, rgba(0, 0, 0, 0.30) 50%, rgba(0, 0, 0, 0.30) 82%, transparent 100%);
    mask-image: radial-gradient(circle, transparent 34%, rgba(0, 0, 0, 0.30) 50%, rgba(0, 0, 0, 0.30) 82%, transparent 100%);
    backdrop-filter: blur(18px) url(#portal-lens);
    -webkit-backdrop-filter: blur(18px) url(#portal-lens);
}

/* Outer ring: flush with frame, tight band of distortion */
.star-chart-frame::after {
    inset: -5%;
    -webkit-mask-image: radial-gradient(circle, transparent 72%, rgba(0, 0, 0, 0.22) 82%, rgba(0, 0, 0, 0.22) 94%, transparent 100%);
    mask-image: radial-gradient(circle, transparent 72%, rgba(0, 0, 0, 0.22) 82%, rgba(0, 0, 0, 0.22) 94%, transparent 100%);
    backdrop-filter: blur(14px) url(#portal-lens-outer);
    -webkit-backdrop-filter: blur(14px) url(#portal-lens-outer);
    animation: portal-ripple 9s ease-in-out infinite;
}

.star-chart-frame.is-floating::before {
    animation: star-chart-blob 28s ease-in-out infinite;
}

.star-chart-frame.is-floating::after {
    animation: portal-ripple 9s ease-in-out infinite, star-chart-blob 28s ease-in-out infinite;
}

@keyframes portal-ripple {
    0%, 100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Scan shimmer overlay — visible while expanded reading is loading */
.star-chart-scan {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.star-chart-frame.is-scanning .star-chart-scan {
    opacity: 1;
}

/* Sweeping shimmer beam */
.star-chart-scan::before {
    content: '';
    position: absolute;
    top: -5%;
    left: 0;
    width: 55%;
    height: 110%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(214, 196, 168, 0.04) 25%,
            rgba(214, 196, 168, 0.11) 50%,
            rgba(214, 196, 168, 0.04) 75%,
            transparent 100%);
    animation: scan-sweep 2.2s linear infinite;
    will-change: transform;
}

/* Horizontal scan line moving top → bottom */
.star-chart-scan::after {
    content: '';
    position: absolute;
    left: -5%;
    right: -5%;
    height: 1px;
    top: 0%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(214, 196, 168, 0.10) 20%,
            rgba(214, 196, 168, 0.22) 50%,
            rgba(214, 196, 168, 0.10) 80%,
            transparent 100%);
    animation: scan-line 3.4s linear infinite;
}

@keyframes scan-sweep {
    from {
        transform: translateX(-120%);
    }

    to {
        transform: translateX(220%);
    }
}

@keyframes scan-line {
    0% {
        top: -1%;
    }

    100% {
        top: 101%;
    }
}

.scroll-btn {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 2rem;
    height: 2rem;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--wheat);
    z-index: 5;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.scroll-btn span {
    display: inline-block;
    transition: transform 0.25s ease;
}

.scroll-btn.is-up span {
    transform: rotate(180deg);
}

.scroll-btn.is-hidden {
    opacity: 0;
    transform: scale(0.7);
    pointer-events: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 0.25rem 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #222;
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo {
    display: block;
    height: 2rem;
    width: auto;
}

/* Hamburger: three bars that morph into an X. */
.nav-toggle {
    position: relative;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 8px;
    background: none;
    color: var(--wheat);
}

.nav-toggle span {
    position: absolute;
    top: 21px;
    left: 11px;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle span:first-child { transform: translateY(-7px); }
.nav-toggle span:last-child { transform: translateY(7px); }
.nav-open .nav-toggle span:first-child { transform: rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:last-child { transform: rotate(-45deg); }

.nav-toggle:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Both sit below the header, so the toggle stays visible and doubles as the close button. */
.nav-backdrop {
    position: fixed;
    inset: 48px 0 0;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.nav-panel {
    position: fixed;
    top: 48px;
    right: 0;
    bottom: 0;
    width: min(300px, 85vw);
    padding: 0.5rem 0;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    background: #222;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.nav-open .nav-panel {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
}

body.nav-open {
    overflow: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: 48px;
    padding: 0 1.25rem;
    border-radius: 0;
    background: none;
    color: var(--wheat);
    font-size: 1rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.nav-link:hover {
    background: rgba(214, 196, 168, 0.1);
}

.nav-link.is-copied {
    color: var(--accent);
}

.nav-link svg {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
}

.nav-count {
    margin-left: auto;
    color: var(--wheat);
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    .nav-toggle span,
    .nav-backdrop,
    .nav-panel {
        transition: none;
    }
}


.container {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero h1 {
    font-size: 2.4rem;
    margin-bottom: 0.5rem;
}

.hero-logo {
    display: block;
    width: 140px;
    max-width: 60%;
    margin: 0 auto 1rem;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer p {
    margin: 0;
}

.legal-links a {
    display: inline-block;
    padding: 0.25rem;
    color: inherit;
}

.reading-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.reading-main {
    --reading-chrome: calc(374px + var(--near-miss, 0px));
}

.reading-main:has(.near-miss) {
    --near-miss: 28px;
}

a.brand {
    text-decoration: none;
}

.reading-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 320px;
    margin: 0 auto;
}

.reading-form label {
    color: var(--wheat);
    font-size: 0.9rem;
}

.reading-form label.perception-label {
    font-size: 1rem;
    line-height: 1.35;
}

.reading-form label.perception-label .perception-label-lead {
    font-size: 1.15em;
}

.reading-form input[type="text"] {
    padding: 0.15rem 0;
    border: none;
    border-bottom: 1px solid var(--wheat);
    border-radius: 0;
    background: transparent;
    color: var(--wheat);
    font-family: inherit;
    font-size: 1.25rem;
    text-align: center;
    outline: none;
    width: 100%;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-panel {
    position: relative;
    background: #1c1c1c;
    border: 1px solid rgba(214, 196, 168, 0.2);
    border-radius: 12px;
    padding: 2.25rem 2rem 1.75rem;
    max-width: 300px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.modal-dismiss {
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-dismiss:hover {
    color: var(--wheat);
}

.modal-msg {
    margin: 0;
    color: var(--wheat);
    font-size: 1rem;
}

.modal-explain {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.modal-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

a.modal-sub {
    text-decoration: underline;
    margin-top: 0.5rem;
}

.modal-actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

#reading-refreshed-modal .modal-actions {
    flex-direction: column;
    width: 100%;
}

#reading-refreshed-modal .modal-actions button {
    width: 100%;
}

.modal-dismiss-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-dismiss-btn:hover {
    color: var(--wheat);
}

.modal-confirm-btn {
    background: transparent;
    border: 1px solid var(--wheat);
    color: var(--wheat);
    padding: 0.6rem 1.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: background 0.2s, color 0.2s;
}

.modal-confirm-btn:hover {
    background: rgba(214, 196, 168, 0.1);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.login-form input {
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid var(--wheat);
    border-radius: 0;
    background: transparent;
    color: var(--wheat);
    font-family: inherit;
    font-size: 1rem;
    text-align: left;
    outline: none;
    width: 100%;
}

button {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    color: #0b1130;
    cursor: pointer;
    font-family: inherit;
}

.go-btn {
    align-self: center;
    padding: 0.9rem 2.75rem;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: go-pulse 2.4s ease-in-out infinite;
}

.expand-btn {
    background: none;
    border: 1px solid var(--wheat);
    color: var(--wheat);
}

.expand-btn.is-loading {
    opacity: 0.7;
    cursor: wait;
    animation: expand-loading 1.4s ease-in-out infinite;
}

@keyframes expand-loading {
    0%, 100% {
        border-color: rgba(214, 196, 168, 0.3);
        color: rgba(214, 196, 168, 0.5);
    }

    50% {
        border-color: var(--wheat);
        color: var(--wheat);
    }
}

@keyframes go-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.55);
    }

    50% {
        box-shadow: 0 0 0 14px rgba(255, 209, 102, 0);
    }
}

.reading-text {
    text-align: left;
    line-height: 1.6;
    font-weight: 300;
    font-size: 1.08rem;
    white-space: pre-wrap;
}

.typewriter.is-typing::after {
    content: '|';
    display: inline-block;
    margin-left: 2px;
    animation: typewriter-blink 0.8s step-end infinite;
}

@keyframes typewriter-blink {
    50% { opacity: 0; }
}

.error {
    text-align: center;
    color: #ff8a8a;
}


.vibration-result {
    position: relative;
    width: 100%;
    text-align: center;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.vibration-result.is-visible {
    opacity: 1;
}

.vibration-intro {
    position: relative;
    z-index: 1;
    padding: 0 1rem;
    text-align: center;
    color: var(--wheat);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.vibration-intro.is-visible {
    opacity: 1;
}

.vibration-short-reading {
    margin: 0 auto;
    text-align: center;
    font-size: clamp(0.9rem, 2.2vw, 1.05rem);
    line-height: 1.35;
}

/* Date, label and number on a single row. The waves measure behind it, then fade out. */
.vibration-wave-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.25rem;
    padding: 0.5rem 0.5rem 0.25rem;
    overflow: hidden;
}

.vibration-wave {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    transition: opacity 0.6s ease;
}

#vibration-wave-left { left: 0; }
#vibration-wave-right { right: 0; }

.vibration-wave-row.is-measured .vibration-wave {
    opacity: 0;
}

.vibration-wave-score {
    position: relative;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: clamp(0.4rem, 1.8vw, 1rem);
    white-space: nowrap;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.vibration-wave-score.is-visible {
    opacity: 1;
    transform: scale(1);
}

.vibration-date {
    color: var(--wheat);
    font-size: clamp(0.72rem, 3.1vw, 1.25rem);
    font-weight: 500;
}

.vibration-wave-value-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vibration-wave-value-wrap .vibration-wave-value {
    position: relative;
    z-index: 1;
}


.vibration-wave-label,
.vibration-wave-value {
    font-size: clamp(1.15rem, 5.4vw, 2.75rem);
    font-weight: 600;
    color: var(--wheat);
    line-height: 1;
}

.vibration-wave-value.is-glitching {
    animation: number-glitch 0.4s steps(2, end);
}

@keyframes number-glitch {
    0%   { transform: translate(0, 0); filter: blur(0); opacity: 1; }
    8%   { transform: translate(-3px, 1px); filter: blur(2px); opacity: 0.7; }
    16%  { transform: translate(2px, -2px); filter: blur(0); opacity: 1; text-shadow: -2px 0 rgba(255, 60, 90, 0.6), 2px 0 rgba(94, 230, 214, 0.6); }
    24%  { transform: translate(-2px, 0); filter: blur(1.5px); opacity: 0.8; text-shadow: none; }
    34%  { transform: translate(1px, 2px); filter: blur(0); opacity: 1; }
    45%  { transform: translate(-1px, -1px); filter: blur(2.5px); opacity: 0.6; text-shadow: 2px 0 rgba(255, 60, 90, 0.6), -2px 0 rgba(94, 230, 214, 0.6); }
    58%  { transform: translate(2px, 1px); filter: blur(0); opacity: 1; text-shadow: none; }
    70%  { transform: translate(0, -2px); filter: blur(1px); opacity: 0.85; }
    82%  { transform: translate(-2px, 1px); filter: blur(0); opacity: 1; }
    100% { transform: translate(0, 0); filter: blur(0); opacity: 1; text-shadow: none; }
}

.vibration-wave-score.rarity-rare .vibration-wave-value,
.vibration-wave-score.rarity-almost-never .vibration-wave-value {
    text-shadow: 0 0 18px rgba(94, 230, 214, 0.6);
}

.vibration-wave-score.rarity-mythological .vibration-wave-value {
    text-shadow: 0 0 22px rgba(255, 110, 199, 0.7);
}

/* ─── 3-step date wizard ─────────────────────────────────────────────────── */

.date-wizard {
    max-width: 340px;
    margin: 0 auto 2rem;
}

.dw-carousel {
    overflow: hidden;
    width: 100%;
}

.dw-track {
    display: flex;
    width: 400%;
    /* 4 slides, each 25% = 100% of carousel */
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    align-items: flex-start;
}

.dw-slide {
    flex: 0 0 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    box-sizing: border-box;
    min-width: 0;
}

.date-step-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Decade grid */
.decade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
    width: 100%;
}

.decade-btn {
    background: rgba(214, 196, 168, 0.06);
    border: 1px solid rgba(214, 196, 168, 0.18);
    color: var(--wheat);
    border-radius: 8px;
    padding: 0.7rem 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.decade-btn:hover {
    background: rgba(214, 196, 168, 0.15);
    border-color: rgba(214, 196, 168, 0.6);
    box-shadow: 0 0 10px rgba(214, 196, 168, 0.18);
}

/* Year-within-decade grid */
.decade-year-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    width: 100%;
}

.decade-year-btn {
    background: rgba(214, 196, 168, 0.06);
    border: 1px solid rgba(214, 196, 168, 0.18);
    color: var(--wheat);
    border-radius: 8px;
    padding: 0.65rem 0.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.decade-year-btn:hover {
    background: rgba(214, 196, 168, 0.2);
    border-color: rgba(214, 196, 168, 0.65);
    box-shadow: 0 0 10px rgba(214, 196, 168, 0.22);
}

/* Back link */
.dw-back {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    align-self: flex-start;
    transition: color 0.2s;
}

.dw-back:hover {
    color: var(--wheat);
}

/* Month grid */
.month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
    width: 100%;
}

.month-btn {
    background: rgba(214, 196, 168, 0.06);
    border: 1px solid rgba(214, 196, 168, 0.18);
    color: var(--wheat);
    border-radius: 8px;
    padding: 0.7rem 0.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.month-btn:hover {
    background: rgba(214, 196, 168, 0.15);
    border-color: rgba(214, 196, 168, 0.6);
    box-shadow: 0 0 10px rgba(214, 196, 168, 0.18);
}

/* Day grid */
.day-grid-header,
.day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.3rem;
    width: 100%;
}

.day-col-header {
    text-align: center;
    font-size: 0.65rem;
    color: var(--muted);
    padding: 0.2rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-btn {
    background: rgba(214, 196, 168, 0.06);
    border: 1px solid rgba(214, 196, 168, 0.14);
    color: var(--wheat);
    border-radius: 6px;
    padding: 0.45rem 0;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.day-btn:hover {
    background: rgba(214, 196, 168, 0.2);
    border-color: rgba(214, 196, 168, 0.65);
    box-shadow: 0 0 8px rgba(214, 196, 168, 0.22);
}

/* ─────────────────────────────────────────────────────────────────────────── */

.near-miss {
    margin: 0 0 0.25rem;
    font-style: italic;
    color: var(--accent-soft);
}

.expanded-reading {
    margin-top: 1rem;
    scroll-margin-top: 56px;
}

.expanded-reading h2 {
    color: var(--accent);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.reading-product-label {
    max-width: 350px;
    margin: 1.25rem auto 0;
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wheat);
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reading-product-label.is-visible {
    opacity: 0.8;
    transform: translateX(0);
}

.reading-product-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 350px;
    margin: 0.5rem auto 0;
    padding: 0.6rem 0.85rem;
    background: #252525;
    border: 1px solid rgba(214, 196, 168, 0.2);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.2s ease;
}

.reading-product-card.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.reading-product-card:hover {
    border-color: var(--accent);
}

.reading-product-card img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.reading-product-card span {
    font-size: 0.9rem;
    color: var(--accent-soft);
}

/* The message and footer wrap on small screens, so more height goes to them. */
@media (max-width: 600px) {
    .reading-main {
        --reading-chrome: calc(419px + var(--near-miss, 0px));
    }

    .hero {
        margin-bottom: 1.5rem;
    }

    .expanded-reading {
        margin-top: 0.75rem;
    }
}

/* Phones on their side: chart and form share a row. */
@media (max-height: 520px) and (min-width: 600px) {
    .reading-main {
        --reading-chrome: 221px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 2rem;
    }

    .star-chart-frame {
        margin: 0;
    }

    .vibration-result {
        flex: 0 1 360px;
        width: auto;
    }
}