: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;
    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;
    width: min(85vw, 340px);
    aspect-ratio: 1 / 1;
    margin: 4rem auto 3.5rem;
    border-radius: 50%;
    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 {
    animation: star-chart-enter 0.9s ease forwards;
}

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

.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;
}

.star-chart-frame::before,
.star-chart-frame::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    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;
}

@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: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 45px;
    max-height: 45px;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #222;
}

.topbar-message {
    grid-column: 2;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    color: var(--wheat);
    font-size: 0.85rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--wheat);
    cursor: pointer;
    text-decoration: none;
}

.icon-btn svg {
    width: 100%;
    height: 100%;
}

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

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

.topbar-coin-count {
    color: var(--wheat);
    font-size: 0.9rem;
    line-height: 1;
    min-width: 1.1em;
    text-align: center;
}


.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.8rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

a.brand {
    text-decoration: none;
}

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

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

.reading-form input[type="text"] {
    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: 2rem;
    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-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.modal-actions {
    margin-top: 1.25rem;
}

.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);
}

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: center;
    line-height: 1.6;
}

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


.vibration-result {
    position: relative;
    padding: 1.5rem 0;
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 1.2s ease;
}

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

.vibration-intro {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--wheat);
    font-size: 0.9rem;
    margin: 1.75rem 0 0;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.6s ease;
}

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

.vibration-wave-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100px;
    margin-top: 0.75rem;
    margin-bottom: 2.5rem;
    gap: 1rem;
    overflow: hidden;
}

.vibration-wave {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
}

.vibration-wave-score {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    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-wave-value {
    font-size: 2.75rem;
    color: var(--wheat);
    line-height: 1;
}

.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 {
    font-style: italic;
    color: var(--accent-soft);
}

.expanded-reading {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

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

