/* The Wonder Archive — all styles. Colour tokens live on .curio-root below. */
html, body, #root { margin: 0; padding: 0; min-height: 100%; background: #000; }
.noscript { color: #f3ecf8; font-family: system-ui, sans-serif; text-align: center; padding: 20vh 24px; }

.curio-root {
  --plum: #000000; --violet-deep: #000000; --card: #0d0d0d; --card-hover: #1a1a1a;
  --border-soft: rgba(216, 195, 232, 0.18); --amethyst: #b9a0d4; --amethyst-bright: #d4b8e8;
  --lilac: #e0cdf0; --mauve: #ab98bf; --gold: #e0c8ea; --cream: #f3ecf8; --danger: #e07a6b; --topbar-h: 72px;
  font-family: 'Inter', sans-serif;
  background: radial-gradient(1100px 520px at 50% -8%, rgba(139, 111, 201, 0.16), transparent 62%), #000000;
  color: var(--cream); min-height: 100vh; position: relative; display: flex; flex-direction: column;
}
.curio-root * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.curio-root { -webkit-text-size-adjust: 100%; }
.curio-root h1, .curio-root h2, .curio-root h3, .curio-root h4 { font-family: 'Fraunces', serif; font-weight: 500; color: var(--cream); }
:where(.curio-root) :where(h1, h2, h3, h4, p) { margin: 0; }
.curio-root :focus-visible { outline: 2px solid var(--amethyst-bright); outline-offset: 3px; border-radius: 8px; }
.curio-root main { flex: 1; }
.curio-root textarea:focus-visible, .curio-root input:focus-visible { outline: none; }
.curio-root button { font-family: 'Inter', sans-serif; cursor: pointer; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: var(--topbar-h); padding: 12px 24px; position: sticky; top: 0; z-index: 30; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft); }
.logo { display: flex; align-items: center; background: none; border: none; padding: 0; cursor: pointer; }
.logo-img { height: 40px; width: auto; display: block; max-width: 240px; object-fit: contain; }
.logo .lg-star { color: var(--gold); }
.nav-desktop { display: none; gap: 2px; flex-wrap: nowrap; justify-content: flex-end; }
.nav-btn { background: none; border: none; color: var(--mauve); font-size: 13px; padding: 7px 12px; border-radius: 999px; display: flex; align-items: center; gap: 6px; transition: all 0.2s ease; white-space: nowrap; }
.nav-btn:hover { color: var(--lilac); background: rgba(139, 111, 201, 0.12); }
.nav-btn.active { color: var(--cream); background: rgba(139, 111, 201, 0.24); }
.menu-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px; background: none; border: none; color: var(--lilac); border-radius: 10px; }
.mobile-menu { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.97); z-index: 40; display: flex; flex-direction: column; padding: 24px; gap: 4px; overflow-y: auto; }
.mobile-menu .nav-btn { justify-content: flex-start; font-size: 16px; padding: 12px 12px; }
.mobile-close { align-self: flex-end; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: none; border: none; color: var(--lilac); margin-bottom: 8px; border-radius: 10px; }
@media (min-width: 1320px) { .nav-desktop { display: flex; } .menu-btn { display: none; } }

.starfield { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
        .window-frame-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, transparent calc(50% - 1px), rgba(227, 189, 109, 0.14) calc(50% - 1px), rgba(227, 189, 109, 0.14) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(40% - 1px), rgba(227, 189, 109, 0.1) calc(40% - 1px), rgba(227, 189, 109, 0.1) calc(40% + 1px), transparent calc(40% + 1px));
  box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.55);
}
.star-dot { position: absolute; border-radius: 50%; background: var(--gold); opacity: 0.5; animation: twinkle ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; transform: scale(0.8); } 50% { opacity: 0.8; transform: scale(1.2); } }

.hero { position: relative; text-align: center; padding: 0; overflow: hidden; min-height: calc(100vh - var(--topbar-h)); min-height: calc(100svh - var(--topbar-h)); display: flex; flex-direction: column; }
.hero-glass { position: relative; z-index: 1; flex: 1; width: 100%; max-width: none; margin: 0; padding: 44px 32px 56px; border-radius: 0; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border: none; border-top: 1px solid rgba(224, 201, 234, 0.14); border-bottom: 1px solid rgba(224, 201, 234, 0.14); box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.hero-eyebrow { font-size: 13px; letter-spacing: 0.06em; color: var(--gold); margin-bottom: 14px; position: relative; z-index: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.hero-title { font-size: clamp(32px, 5vw, 54px); line-height: 1.12; margin: 0 auto 18px; max-width: 19ch; text-wrap: balance; position: relative; z-index: 1; text-shadow: 0 3px 16px rgba(0,0,0,0.75); }
.hero-sub { font-size: 16px; color: var(--lilac); line-height: 1.6; max-width: 460px; margin: 0 auto 28px; position: relative; z-index: 1; text-shadow: 0 2px 12px rgba(0,0,0,0.7); }

.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10px 0 6px; position: relative; z-index: 1; }
.wheel-pointer { width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 15px solid var(--gold); margin-bottom: -7px; z-index: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35)); }
.wheel { width: 156px; height: 156px; border-radius: 50%; border: 4px solid var(--gold); cursor: pointer; position: relative; padding: 0; box-shadow: 0 12px 40px rgba(0,0,0,0.4); transition: transform 2.5s cubic-bezier(0.17, 0.67, 0.14, 1);
  background: conic-gradient(var(--amethyst) 0deg 36deg, var(--violet-deep) 36deg 72deg, var(--amethyst) 72deg 108deg, var(--violet-deep) 108deg 144deg, var(--amethyst) 144deg 180deg, var(--violet-deep) 180deg 216deg, var(--amethyst) 216deg 252deg, var(--violet-deep) 252deg 288deg, var(--amethyst) 288deg 324deg, var(--violet-deep) 324deg 360deg); }
.wheel:disabled { cursor: default; }
.wheel-hub { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; background: var(--card); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; color: var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.wheel-caption { font-size: 13px; color: var(--mauve); }

.draw-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10px 0 6px; position: relative; z-index: 1; perspective: 1000px; }
.draw-card { width: 120px; height: 160px; border: none; padding: 0; background: none; cursor: pointer; }
.draw-card:disabled { cursor: default; }
.draw-card-inner { position: relative; width: 100%; height: 100%; display: block; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); transform-style: preserve-3d; }
.draw-card.is-flipped .draw-card-inner { transform: rotateY(180deg); }
.draw-card-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--gold); box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
.draw-card-back { background: linear-gradient(160deg, var(--amethyst) 0%, var(--violet-deep) 100%); color: var(--gold); }
.draw-card-front { background: var(--card); color: var(--gold); transform: rotateY(180deg); }

.deal-trigger { position: relative; width: 110px; height: 150px; border: none; background: none; padding: 0; cursor: pointer; }
.deal-trigger:disabled { cursor: default; }

.flashcard-pop { margin-top: 18px; perspective: 1000px; animation: cardPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes cardPop { 0% { transform: scale(0.4) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(0deg); opacity: 1; } }
.flashcard { width: 220px; height: 150px; border: none; background: none; padding: 0; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; display: block; transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1); transform-style: preserve-3d; }
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px; border: 3px solid var(--gold); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 16px 36px rgba(0,0,0,0.4); padding: 16px; text-align: center; }
.flashcard-front { background: linear-gradient(160deg, var(--amethyst) 0%, var(--violet-deep) 100%); color: var(--gold); }
.flashcard-hint { font-size: 12px; color: var(--lilac); }
.flashcard-back { background: var(--card); transform: rotateY(180deg); }
.flashcard-word { font-style: italic; font-size: 24px; color: var(--cream); }
.flashcard-meaning { font-size: 13px; color: var(--lilac); line-height: 1.5; }

.research-panel { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border-soft); }
.research-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.timer-box { display: flex; align-items: center; gap: 16px; background: rgba(139, 111, 201, 0.1); border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px 18px; flex-wrap: wrap; }
.timer-display { font-family: 'Fraunces', serif; font-size: 28px; color: var(--gold); min-width: 78px; }
.timer-display.timer-done { color: var(--danger); }
.timer-controls { display: flex; gap: 8px; }
.timer-done-label { font-size: 13px; color: var(--danger); margin-left: auto; }
.next-step { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }

.old-paper { background: linear-gradient(180deg, #f4ecd8 0%, #ece0c4 100%); border-radius: 3px; padding: 26px 26px 20px; box-shadow: 0 20px 45px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(0,0,0,0.08); position: relative; }
.old-paper::before { content: ''; position: absolute; inset: 0; background-image: repeating-linear-gradient(180deg, transparent 0px, transparent 27px, rgba(120,90,60,0.14) 28px); border-radius: 3px; pointer-events: none; }
.old-paper-header { font-family: 'Fraunces', serif; font-style: italic; font-size: 17px; line-height: 1.5; color: #3a2a1a; padding-bottom: 14px; margin: 0 0 16px; border-bottom: 1px dashed rgba(58,42,26,0.35); position: relative; z-index: 1; }
.old-paper-textarea { width: 100%; min-height: 220px; background: transparent; border: none; resize: vertical; font-family: 'Fraunces', serif; font-size: 16px; line-height: 28px; color: #2a1d10; outline: none; position: relative; z-index: 1; }
.old-paper-textarea::placeholder { color: #6f5a3e; }
.old-paper-readback { font-family: 'Fraunces', serif; font-size: 16px; line-height: 28px; color: #2a1d10; white-space: pre-wrap; position: relative; z-index: 1; }
.old-paper-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.flashcard { width: 260px; height: 190px; }
@media (prefers-reduced-motion: reduce) { .flashcard-pop { animation: none; } .flashcard-inner { transition: none; } }
.deal-card { position: absolute; inset: 0; border-radius: 10px; border: 3px solid var(--gold); background: var(--card); box-shadow: 0 10px 26px rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; color: var(--gold); transition: transform 0.3s ease; }
.deal-card.c1 { transform: rotate(-6deg) translateX(-6px); }
.deal-card.c2 { transform: rotate(3deg) translateX(4px); }
.deal-card.c3 { transform: rotate(0deg); }
.deal-card.is-shuffling.c1 { animation: shuffle1 1.1s ease; }
.deal-card.is-shuffling.c2 { animation: shuffle2 1.1s ease; }
.deal-card.is-shuffling.c3 { animation: shuffle3 1.1s ease; }

.slot-machine { display: flex; gap: 8px; background: var(--card); border: 3px solid var(--gold); border-radius: 14px; padding: 10px; box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
.slot-reel { width: 46px; height: 60px; overflow: hidden; border-radius: 6px; background: var(--violet-deep); }
.slot-reel-strip { display: flex; flex-direction: column; }
.slot-symbol { height: 60px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--gold); }
.slot-reel-strip.is-spinning { animation-name: slotSpin; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes slotSpin { from { transform: translateY(0); } to { transform: translateY(-50%); } }

.ink-card { width: 120px; height: 150px; border: none; background: none; padding: 0; cursor: pointer; perspective: 1000px; }
.ink-card:disabled { cursor: default; }
.ink-card-inner { position: relative; width: 100%; height: 100%; display: block; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); transform-style: preserve-3d; }
.ink-card.is-flipped .ink-card-inner { transform: rotateY(180deg); }
.ink-card-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--gold); box-shadow: 0 14px 34px rgba(0,0,0,0.4); }
.ink-card-front { background: linear-gradient(160deg, #efe7f5 0%, #d9cdea 100%); }
.ink-card-back { background: var(--card); color: var(--gold); transform: rotateY(180deg); }
.ink-blot { position: relative; width: 34px; height: 54px; background: #2a1d3d; border-radius: 60% 40% 55% 45% / 60% 55% 45% 40%; }
.ink-blot::after { content: ''; position: absolute; top: 0; left: 100%; width: 34px; height: 54px; background: inherit; border-radius: inherit; transform: scaleX(-1); }

.pendulum-rig { position: relative; width: 140px; height: 130px; display: flex; justify-content: center; margin-bottom: 4px; }
.pendulum-bar { position: absolute; top: 0; width: 70px; height: 6px; background: var(--gold); border-radius: 3px; }
.pendulum-arm { position: absolute; top: 3px; left: 50%; width: 2px; height: 100px; background: rgba(227, 189, 109, 0.6); transform-origin: top center; transform: rotate(0deg); }
.pendulum-arm.is-swinging { animation: pendulumSwing 1.9s cubic-bezier(0.45, 0.05, 0.55, 0.95); }
.pendulum-bob { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--lilac), var(--amethyst)); box-shadow: 0 6px 14px rgba(0,0,0,0.4); }
@keyframes pendulumSwing { 0% { transform: rotate(0deg); } 10% { transform: rotate(32deg); } 20% { transform: rotate(-26deg); } 30% { transform: rotate(20deg); } 40% { transform: rotate(-15deg); } 50% { transform: rotate(11deg); } 60% { transform: rotate(-8deg); } 70% { transform: rotate(5deg); } 80% { transform: rotate(-3deg); } 90% { transform: rotate(1.5deg); } 100% { transform: rotate(0deg); } }


.page-book { position: relative; width: 130px; height: 160px; perspective: 1200px; margin-bottom: 4px; }
.page-static { position: absolute; inset: 0; background: var(--card); border: 2px solid var(--gold); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--gold); }
.page-turning { position: absolute; top: 0; bottom: 0; right: 0; width: 50%; border: none; padding: 0; cursor: pointer; background: none; transform-style: preserve-3d; transform-origin: left center; transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1); }
.page-turning:disabled { cursor: default; }
.page-turning.is-turned { transform: rotateY(-160deg); }
.page-face { position: absolute; inset: 0; backface-visibility: hidden; background: linear-gradient(160deg, #f4ecd8 0%, #ece0c4 100%); border: 1px solid rgba(0,0,0,0.15); border-radius: 0 4px 4px 0; }
.page-back { transform: rotateY(180deg); background: linear-gradient(160deg, #ece0c4 0%, #dcd0b0 100%); }
@keyframes shuffle1 { 0% { transform: rotate(-6deg) translateX(-6px); } 20% { transform: rotate(-20deg) translateX(-40px) translateY(-10px); } 45% { transform: rotate(10deg) translateX(30px) translateY(8px); } 70% { transform: rotate(-14deg) translateX(-20px); } 100% { transform: rotate(-6deg) translateX(-6px); } }
@keyframes shuffle2 { 0% { transform: rotate(3deg) translateX(4px); } 25% { transform: rotate(18deg) translateX(36px) translateY(-6px); } 50% { transform: rotate(-8deg) translateX(-30px) translateY(10px); } 75% { transform: rotate(12deg) translateX(18px); } 100% { transform: rotate(3deg) translateX(4px); } }
@keyframes shuffle3 { 0% { transform: rotate(0deg); } 30% { transform: rotate(-16deg) translateX(-24px) translateY(6px); } 60% { transform: rotate(16deg) translateX(28px) translateY(-8px); } 100% { transform: rotate(0deg); } }

.bookshelf-wrap { margin: 48px auto 0; max-width: 920px; padding: 0 20px; position: relative; z-index: 1; }
.bookshelf-label { text-align: center; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mauve); margin-bottom: 22px; }
.bookshelf { display: flex; align-items: flex-end; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; padding: 4px 6px 8px; justify-content: flex-start; }
.book-spine { background-image: url("../assets/images/paper-texture.png"); background-blend-mode: multiply; background-size: 120px 120px; background-repeat: repeat; }
.bookshelf::-webkit-scrollbar { display: none; }
.book-spine { scroll-snap-align: start; }
@media (min-width: 760px) { .bookshelf { justify-content: center; } }
.book-spine { flex: 0 0 auto; width: 52px; border: none; border-radius: 3px 6px 6px 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 14px 4px; box-shadow: inset -6px 0 10px rgba(0,0,0,0.3), inset 2px 0 0 rgba(255,255,255,0.06), 0 8px 16px rgba(0,0,0,0.45); transition: transform 0.25s ease; position: relative; }
.book-spine:hover { transform: translateY(-12px) rotate(-1.5deg); box-shadow: inset -7px 0 12px rgba(0,0,0,0.32), inset 3px 0 0 rgba(255,255,255,0.07), 0 20px 30px rgba(0,0,0,0.5); }
.spine-title { writing-mode: vertical-rl; text-orientation: mixed; font-family: 'Fraunces', serif; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(245,235,215,0.92); white-space: nowrap; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.shelf-plank { height: 18px; margin-top: -2px; border-radius: 2px; background: linear-gradient(180deg, #4a2f1f 0%, #2c1810 100%); box-shadow: 0 14px 28px rgba(0,0,0,0.55), inset 0 3px 4px rgba(255,255,255,0.08); }

.bubble { position: absolute; top: 46%; right: max(28px, 6vw); width: 148px; height: 148px; border-radius: 50%; border: 2px solid rgba(227, 189, 109, 0.55); background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.28) 0%, rgba(139,111,201,0.4) 42%, rgba(42,26,68,0.6) 100%); box-shadow: 0 14px 40px rgba(0,0,0,0.4), inset 0 0 26px rgba(255,255,255,0.15); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 2; transition: opacity 0.2s ease; }
.bubble.is-hidden { opacity: 0; pointer-events: none; }
@media (max-width: 1080px) { .bubble { position: relative; top: auto; right: auto; margin: 44px auto 0; width: 132px; height: 132px; } }
.bubble-floating { animation: bubbleFloat 4.5s ease-in-out infinite; }
.bubble.is-popping { animation: bubblePop 0.42s ease forwards; transition: none; }
.bubble-label { font-family: 'Fraunces', serif; font-size: 13px; color: var(--cream); line-height: 1.4; }
.bubble-hint { font-family: 'Inter', sans-serif; font-size: 11px; color: var(--lilac); }
.bubble-particles { position: absolute; inset: 0; pointer-events: none; }
.bubble-particle { position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: 0; }
.is-popping .bubble-particle { animation: particleBurst 0.5s ease forwards; }
@keyframes bubbleFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bubblePop { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.3); opacity: 0.5; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes particleBurst { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3); } }
@media (prefers-reduced-motion: reduce) { .bubble-floating { animation: none; transition: none; } .bubble.is-popping { animation: none; opacity: 0.3; } }

.bubble-modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(13, 7, 21, 0.6); backdrop-filter: blur(3px); }
.bubble-modal-card { max-width: 460px; width: 100%; margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -8px 0 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; color: var(--lilac); }
.icon-btn:hover { background: rgba(139, 111, 201, 0.16); color: var(--cream); }

.book-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; perspective: 1800px; pointer-events: none; }
.book-cover { width: 88vw; max-width: 440px; height: 62vh; max-height: 560px; border-radius: 4px 14px 14px 4px; box-shadow: 0 40px 90px rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; transform-origin: left center; animation: bookOpen 0.75s cubic-bezier(0.45, 0, 0.2, 1) forwards; border: 2px solid rgba(227, 189, 109, 0.5); }
.book-cover-title { font-family: 'Fraunces', serif; color: var(--gold); font-size: 22px; line-height: 1.3; }
@keyframes bookOpen { 0% { transform: rotateY(0deg) scale(0.4); opacity: 0; } 18% { opacity: 1; transform: rotateY(0deg) scale(1); } 100% { transform: rotateY(-110deg) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .book-cover { animation: none; opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .wheel { transition: none; } }

.surprise-btn { position: relative; z-index: 1; background: linear-gradient(135deg, #7a5cb8 0%, #5b3f93 100%); color: #fff; border: none; padding: 16px 34px; border-radius: 999px; font-size: 16px; font-weight: 500; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 8px 30px rgba(139, 111, 201, 0.35); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.surprise-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(139, 111, 201, 0.5); }
.surprise-btn.small { padding: 12px 24px; font-size: 14px; }
.surprise-btn:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }
.surprise-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.surprise-reveal { scroll-margin-top: calc(var(--topbar-h) + 20px); max-width: 560px; margin: 28px auto 0; text-align: left; animation: cardOpen 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); position: relative; z-index: 1; }
@keyframes cardOpen { 0% { opacity: 0; transform: translateY(14px) rotate(-1.5deg) scale(0.97); } 100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
.ghost-btn { background: transparent; border: 1px solid var(--border-soft); color: var(--lilac); padding: 9px 16px; border-radius: 999px; font-size: 13px; display: flex; align-items: center; gap: 6px; transition: all 0.2s ease; }
.ghost-btn:hover { background: rgba(139, 111, 201, 0.14); border-color: var(--amethyst); }
.ghost-btn.danger { color: var(--danger); }
.ghost-btn.danger:hover, .ghost-btn.danger.is-armed { border-color: var(--danger); background: rgba(224, 122, 107, 0.14); }
.ghost-btn:disabled { opacity: 0.45; cursor: default; }

.result-card { background: linear-gradient(160deg, var(--card) 0%, var(--violet-deep) 100%); border: 1px solid var(--border-soft); border-radius: 18px; padding: 26px 26px 20px; box-shadow: 0 20px 50px rgba(0,0,0,0.35); }
.kind-tag { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.result-title { font-size: 24px; margin-bottom: 4px; }
.result-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mauve); margin: 14px 0 5px; }
.result-body { font-size: 15px; line-height: 1.65; color: #ece4f7; }
.result-body.italic { font-style: italic; color: var(--lilac); }
.prompt-text { font-size: 17px; font-family: 'Fraunces', serif; line-height: 1.6; color: var(--cream); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag { font-size: 12px; background: rgba(139, 111, 201, 0.18); color: var(--lilac); padding: 5px 12px; border-radius: 999px; }
.card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.save-btn { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; margin-left: -10px; border-radius: 999px; background: none; border: none; color: var(--mauve); font-size: 13.5px; }
.save-btn:hover { color: var(--gold); background: rgba(139, 111, 201, 0.12); }
.save-btn.is-saved { color: var(--gold); }
.deeper-btn { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; margin-right: -10px; border-radius: 999px; background: none; border: none; color: var(--amethyst-bright); font-size: 13.5px; }
.deeper-btn:hover { background: rgba(139, 111, 201, 0.12); }

.content-block { max-width: 700px; margin: 28px auto; padding: 32px 28px 48px; position: relative; z-index: 0; border-radius: 20px; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(12px) saturate(1.1); -webkit-backdrop-filter: blur(12px) saturate(1.1); border: 1px solid rgba(224, 201, 234, 0.16); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.hero-bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.section-bg-wrap { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.section-bg-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.section-bg-scrim { position: absolute; inset: 0; background: none; }
.section-header { margin-bottom: 22px; }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; position: relative; z-index: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.section-title { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.18; margin-bottom: 10px; text-wrap: balance; position: relative; z-index: 1; text-shadow: 0 3px 14px rgba(0,0,0,0.75); }
.section-sub { color: var(--lilac); font-size: 15px; line-height: 1.6; max-width: 620px; position: relative; z-index: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.how-to-note { background: rgba(26, 20, 37, 0.55); border: 1px dashed var(--border-soft); border-radius: 12px; padding: 12px 16px; font-size: 14px; color: var(--lilac); line-height: 1.55; max-width: 620px; margin: 0 0 22px; position: relative; z-index: 1; backdrop-filter: blur(2px); }

.stroop-game { max-width: 420px; }
.stroop-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.stroop-play { background: var(--card); border: 1px solid var(--border-soft); border-radius: 18px; padding: 22px; transition: background 0.15s ease; }
.stroop-play.is-correct { background: rgba(79, 174, 130, 0.18); }
.stroop-play.is-wrong { background: rgba(226, 87, 76, 0.18); }
.stroop-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--mauve); margin-bottom: 18px; }
.stroop-timer { font-family: 'Fraunces', serif; color: var(--gold); font-size: 16px; }
.stroop-word { font-family: 'Fraunces', serif; font-size: 42px; text-align: center; margin: 10px 0 26px; letter-spacing: 0.02em; }
.stroop-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); gap: 8px; }
.stroop-option { height: 44px; border: 2px solid rgba(244, 237, 224, 0.25); border-radius: 10px; cursor: pointer; transition: transform 0.12s ease; }
.stroop-option:hover { transform: translateY(-2px); }
.game-block { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--border-soft); }

.papers-panel { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-soft); }
.papers-heading { font-family: 'Fraunces', serif; font-style: italic; color: var(--gold); font-size: 14px; margin-bottom: 12px; }
.papers-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.papers-list li { font-size: 13.5px; line-height: 1.5; }
.papers-link { color: var(--lilac); text-decoration: underline; text-decoration-color: rgba(203,184,232,0.35); text-underline-offset: 2px; }
.papers-link:hover { color: var(--cream); }
.papers-note { font-size: 12px; color: var(--mauve); line-height: 1.5; }




.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: transparent; border: 1px solid var(--border-soft); color: var(--mauve); font-size: 13px; padding: 7px 14px; border-radius: 999px; transition: all 0.2s ease; }
.chip:hover { border-color: var(--amethyst); color: var(--lilac); }
.chip-active { background: var(--amethyst); border-color: var(--amethyst); color: #1a1024; font-weight: 500; }
.chip { flex: 0 0 auto; }

.grid-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 28px; }
.mini-card { text-align: left; background: var(--card); border: 1px solid var(--border-soft); border-radius: 14px; padding: 16px 18px; transition: all 0.2s ease; color: var(--cream); display: flex; flex-direction: column; gap: 4px; }
.mini-card:hover { background: var(--card-hover); border-color: var(--amethyst); }
.mini-card.is-active { border-color: var(--amethyst); background: var(--card-hover); box-shadow: inset 3px 0 0 var(--amethyst); }
.mini-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold); }
.mini-title { font-family: 'Fraunces', serif; font-size: 16px; margin-bottom: 2px; }
.mini-sub { font-size: 13px; color: var(--mauve); line-height: 1.4; }
.collection-card, .challenge-card { align-items: flex-start; }

.wonders-summary { display: flex; gap: 28px; flex-wrap: wrap; margin: 4px 0 28px; }
.wonders-stat { display: flex; flex-direction: column; }
.wonders-stat-num { font-family: 'Fraunces', serif; font-size: 30px; color: var(--gold); line-height: 1.1; }
.wonders-stat-label { font-size: 12.5px; color: var(--mauve); margin-top: 2px; }
.wonders-group { margin-top: 30px; }
.wonders-group:first-of-type { margin-top: 8px; }
.wonders-group-title { display: flex; align-items: center; gap: 7px; font-family: 'Fraunces', serif; font-style: italic; font-size: 16px; color: var(--lilac); padding-bottom: 10px; border-bottom: 1px dashed var(--border-soft); }
.wonders-group-count { font-family: 'Inter', sans-serif; font-style: normal; font-size: 13px; color: var(--mauve); }
.text-link { background: none; border: none; color: var(--amethyst-bright); font-size: 13.5px; padding: 8px 0; margin-top: 2px; align-self: flex-start; }
.text-link:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 50px 20px; color: var(--mauve); text-align: center; max-width: 340px; margin: 0 auto; }

.draft-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.draft-title-input { width: 100%; background: var(--card); border: 1px solid var(--border-soft); color: var(--cream); font-family: 'Fraunces', serif; font-size: 20px; padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; outline: none; }
.draft-title-input:focus { border-color: var(--amethyst); }
.draft-textarea { width: 100%; background: var(--card); border: 1px solid var(--border-soft); color: var(--cream); font-family: 'Inter', sans-serif; font-size: 16px; line-height: 1.7; padding: 16px; border-radius: 12px; resize: vertical; outline: none; }
.draft-textarea:focus { border-color: var(--amethyst); }
.draft-tags-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--mauve); }
.draft-tags-input { flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--border-soft); color: var(--cream); font-size: 16px; padding: 6px 4px; outline: none; }
.draft-tags-input:focus { border-color: var(--amethyst); }
.word-count { font-size: 12px; color: var(--mauve); white-space: nowrap; }
.draft-status { font-size: 12.5px; color: var(--mauve); display: inline-flex; align-items: center; gap: 5px; }
.draft-status.is-saved { color: var(--gold); }
.autosave-note { font-size: 12px; color: var(--mauve); margin-top: 6px; }

.footer { text-align: center; padding: 40px 20px; color: var(--mauve); font-size: 13px; border-top: 1px solid var(--border-soft); }

@media (prefers-reduced-motion: reduce) {
  .star-dot, .surprise-reveal, .deal-card, .slot-reel-strip, .pendulum-arm { animation: none !important; }
  .draw-card-inner, .ink-card-inner, .page-turning, .book-spine, .surprise-btn { transition: none !important; }
}
@media (max-width: 640px) {
  .chip-row.chip-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -18px; margin-right: -18px; padding: 2px 18px 6px; scroll-padding-left: 18px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 32px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 32px), transparent 100%); }
  .chip-row.chip-scroll::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  .topbar { padding: 14px 16px; }
  .curio-root { --topbar-h: 64px; }
  .hero-glass { padding: 36px 16px 44px; }
  .hero-title { font-size: 34px; max-width: 12ch; }
  .hero-sub { font-size: 15px; }
  .bookshelf-wrap { padding: 0; margin-top: 40px; }
  .bookshelf { gap: 5px; justify-content: center; overflow: visible; padding: 4px 0 8px; }
  .book-spine { flex: 1 1 0; min-width: 0; max-width: 44px; padding: 12px 2px; }
  .content-block { padding: 26px 18px 50px; border-radius: 18px; margin-top: 14px; }
  .result-card { padding: 20px 20px 16px; }
  .old-paper { padding: 20px 18px 16px; }
  .chip { padding: 9px 14px; font-size: 13.5px; min-height: 44px; display: inline-flex; align-items: center; }
  .mini-card { padding: 14px 16px; }
  .surprise-btn { padding: 15px 28px; }
  .flashcard { width: min(240px, 78vw); height: 170px; }
  .ink-card { width: min(120px, 32vw); }
  .draw-card { width: min(120px, 32vw); }
  .pendulum-rig { width: min(140px, 40vw); }
  .page-book { width: min(130px, 36vw); }
  .spine-title { font-size: 10px; }
  .stroop-word { font-size: 34px; }
  .timer-display { font-size: 24px; }
  .bubble { width: 124px; height: 124px; }
}

@supports (padding: max(0px)) {
  .topbar { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .footer { padding-bottom: max(40px, env(safe-area-inset-bottom)); }
}
