html, body { background: var(--bg); color: var(--text); font-family: var(--brand-font-body); }
body { background-image: radial-gradient(ellipse 68% 40% at 78% 0%, rgba(230,106,66,.075), transparent); }
button, textarea, input { font-family: inherit; }
:is(button, a, input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; }
.hidden { display: none !important; }

/* The same wordmark and warm surfaces appear on every app page. */
.top { background: rgba(11,14,18,.86); border-color: var(--line); }
.logo { color: var(--text); font: 600 18px/1.2 var(--brand-font-heading); letter-spacing: -.055em; text-decoration: none; }
.logo span { color: var(--accent); }
.top-link:hover { color: var(--text); }
.top-login { background: var(--brand-accent-soft); }
.top-login:hover { background: rgba(230,106,66,.28); }
.home { max-width: 1400px; margin-inline: auto; }
.home-hero { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(290px,.95fr); gap: clamp(24px,5vw,80px); align-items: center; margin: 14px 0 22px; }
.hero h1, #explore-view h1, #plans-view h1 { max-width: 850px; margin: 10px 0 16px; font: 600 clamp(2.15rem,4.8vw,4.4rem)/1.12 var(--brand-font-heading); letter-spacing: -.055em; }
.hero h1 { font-size: clamp(2.15rem,4vw,3.5rem); }
.hero p { max-width: 56ch; color: var(--muted); }
.hero-art { position: relative; min-height: 290px; height: clamp(290px,32vw,430px); overflow: hidden; border: 1px solid var(--brand-accent-line); border-radius: 24px; background: #291e19; box-shadow: 0 28px 70px rgba(49,18,10,.32); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 38%; filter: saturate(.83) brightness(.73); }
.hero-art::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent,rgba(10,11,14,.82)); }
.hero-art span { position: absolute; z-index: 1; left: 24px; right: 20px; bottom: 22px; font: 500 clamp(1rem,1.6vw,1.35rem)/1.3 var(--brand-font-heading); letter-spacing: -.035em; text-wrap: balance; }
.section-head h2 { font: 600 clamp(1.25rem,2vw,1.65rem)/1.25 var(--brand-font-heading); }
.eyebrow { color: var(--accent); }

/* A story in progress is the first action on the home screen. */
#saved-section { margin: 4px 0 46px; }
#saved-section .section-head { margin-top: 12px; }
.saved-chats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.saved-chat { display: grid; grid-template-columns: 126px minmax(0,1fr); min-height: 168px; overflow: hidden; background: rgba(24,28,30,.94); border-color: var(--line); transition: border-color .2s, transform .2s; }
.saved-chat:hover { transform: translateY(-2px); border-color: var(--brand-accent-line); }
.saved-chat.active { background: rgba(33,29,27,.95); border-color: var(--brand-accent-line); }
.saved-chat-portrait { display: block; width: 100%; height: 100%; min-height: 168px; object-fit: cover; object-position: center 22%; }
.saved-chat-placeholder { display: grid; place-items: center; background: #33231e; color: var(--accent); font-size: 34px; }
.saved-chat-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 20px 54px 18px 20px; }
.saved-chat-top { display: block; max-width: 100%; }
.saved-chat strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; font: 600 1rem/1.3 var(--brand-font-heading); letter-spacing: -.03em; }
.saved-chat-count { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.saved-chat p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 10px 0 14px; color: #d9d4cf; font-size: 13px; line-height: 1.45; }
.saved-chat-open { width: auto; margin-top: auto; padding: 6px 11px; border: 1px solid var(--brand-accent-line); border-radius: 8px; background: var(--brand-accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.saved-chat-open:hover { color: var(--accent2); background: rgba(230,106,66,.24); }
.saved-chat-open span { padding-left: 4px; }
.saved-chat-menu { background: rgba(11,14,18,.58); }

.character { box-shadow: 0 12px 36px rgba(0,0,0,.18); }
.character:hover { outline: 1px solid var(--brand-accent-line); }
.char-copy strong { font-family: var(--brand-font-heading); font-weight: 600; font-size: clamp(.9rem,1.45vw,1.12rem); line-height: 1.3; }
.char-copy small { color: #e9e0d7; line-height: 1.35; }
.char-chip { background: rgba(13,15,17,.78); border-color: rgba(255,255,255,.25); }
.legal-links a { color: #ddc7bd; }

/* The portrait is a subdued layer; messages remain the foreground. */
.chat { position: relative; isolation: isolate; grid-template-rows: auto 1fr auto; background: var(--bg); }
.chat-backdrop { position: fixed; z-index: 0; inset: 0 0 0 var(--rail-w); overflow: hidden; pointer-events: none; background: radial-gradient(circle at 60% 12%,rgba(230,106,66,.16),transparent 50%); }
.chat-backdrop img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 27%; filter: blur(20px) saturate(.78) brightness(.75); opacity: .77; transform: scale(1.1); }
.chat-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,rgba(11,14,18,.42),rgba(11,14,18,.58) 48%,rgba(11,14,18,.9)); }
.chat-top, .messages, .composer-wrap { position: relative; z-index: 1; }
.chat-top { position: sticky; top: 0; background: rgba(11,14,18,.84); backdrop-filter: blur(20px); }
.chat-head { height: 78px; background: rgba(11,14,18,.7); }
.chat-person img { width: 54px; height: 54px; flex-basis: 54px; border: 1px solid rgba(255,255,255,.23); box-shadow: 0 0 0 3px rgba(230,106,66,.11); }
.chat-person strong { font-family: var(--brand-font-heading); font-size: clamp(.86rem,1.4vw,1rem); font-weight: 600; }
.chat-person small { color: #c0b6ae; }
.chat-actions .icon-btn { display: grid; place-items: center; }
.chat-actions .icon-btn:hover { background: rgba(255,255,255,.08); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-menu { background: #222527; border-color: var(--line); }
.chat-menu button:hover, .chat-menu button:focus-visible { background: #35312e; }
.messages { min-height: 0; }
.message.assistant.no-avatar { padding-left: 43px; }
.message-avatar { width: 28px; height: 28px; flex-basis: 28px; border: 1px solid var(--brand-accent-line); }
.assistant .bubble { max-width: min(84%,calc(100% - 37px)); background: rgba(32,37,39,.94); color: #f7f4ed; border: 1px solid rgba(255,255,255,.07); }
.assistant .bubble em { color: #e1cdc3; }
.bubble strong { color: inherit; font-weight: 700; }
.user .bubble { background: var(--accent); color: #1b100c; font-weight: 600; }
.composer-wrap { background: linear-gradient(transparent,rgba(11,14,18,.95) 24%); }
.composer { background: rgba(29,34,36,.96); border-color: rgba(255,255,255,.18); box-shadow: 0 14px 40px rgba(0,0,0,.22); }
.composer:focus-within { border-color: var(--brand-accent-line); }
.send, .settings-primary, .load-error button { color: #1b100c; }
.send:hover, .settings-primary:hover { background: var(--accent2); }
.continue { background: rgba(27,31,33,.92); color: var(--text); }
.notice { background: #2b1c17; border-color: var(--brand-accent-line); }
.notice.attention { z-index: 1000; padding: 16px 20px; border: 2px solid #ffb68d; border-radius: 16px; background: #e66a42; color: #1b100c; box-shadow: 0 18px 48px rgba(0,0,0,.55), 0 0 0 5px rgba(230,106,66,.2); font-size: 16px; font-weight: 700; line-height: 1.35; text-align: center; }
.notice.attention::before { content: '!'; display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 10px; border-radius: 50%; background: #1b100c; color: #ffb68d; font-size: 17px; vertical-align: middle; }

/* One icon language on desktop, one compact tab bar on phones. */
.rail { background: rgba(16,19,22,.96); border-color: var(--line); }
.rail-nav { gap: 4px; }
.rail-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 60px; height: 60px; color: #b7b5b1; font: 600 10px/1.1 var(--brand-font-body); }
.rail-nav button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-nav button.active, .rail-nav button:hover { background: var(--brand-accent-soft); color: var(--accent); }
.rail-chat.active { background: var(--brand-accent-soft); }
.rail-chat { width: 52px; height: 52px; flex-basis: 52px; }
.rail-home { background: var(--brand-accent-soft); }
.drawer-empty { writing-mode: initial; text-align: center; line-height: 1.35; }

.plan-grid { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); align-items: stretch; gap: 16px; max-width: 1100px; }
.plan-card { display: flex; flex-direction: column; position: relative; min-height: 365px; padding: 26px; background: rgba(21,25,29,.94); }
.plan-card.recommended { border-color: var(--accent); background: linear-gradient(160deg,rgba(64,35,25,.92),rgba(21,25,29,.97) 52%); box-shadow: 0 16px 44px rgba(72,27,14,.2); }
.plan-card.current { outline: 1px solid var(--brand-accent-line); }
.plan-card.current:not(.recommended) { border-color: var(--line); outline: none; }
.plan-card.current:not(.recommended) button { border-color: var(--line); }
.plan-badge { display: inline-block; align-self: flex-start; margin-bottom: 15px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.plan-card:not(.recommended)::before { content: ""; height: 30px; }
.plan-card h2 { font: 600 1.3rem/1.25 var(--brand-font-heading); }
.plan-pitch { min-height: 3em; margin: 6px 0 0; }
.plan-price { margin: 26px 0 14px; color: var(--text); font: 600 clamp(1.2rem,2vw,1.65rem)/1.2 var(--brand-font-heading); letter-spacing: -.04em; }
.plan-card ul { margin: 5px 0 28px; padding-left: 19px; }
.plan-card li { margin-bottom: 8px; }
.plan-card button { margin-top: auto; }
.plan-card.recommended button { background: var(--accent); border-color: var(--accent); color: #1b100c; font-weight: 700; }
.plan-card button:disabled { cursor: default; opacity: .8; }
.plan-card.recommended button:disabled { opacity: .92; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr .7fr; gap: 22px; }
  .hero-art { min-height: 250px; height: 300px; }
  .saved-chats { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); }
}

@media (max-width: 680px) {
  :root { --rail-w: 0px; --tab-h: calc(66px + env(safe-area-inset-bottom,0px)); }
  .app { width: 100%; margin-inline-start: 0; }
  .rail { inset: auto 0 0; width: 100%; height: var(--tab-h); flex-direction: row; align-items: stretch; padding: 5px 12px calc(5px + env(safe-area-inset-bottom,0px)); border-inline-end: 0; border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
  .rail-nav { display: flex; justify-content: space-around; align-items: stretch; gap: 4px; width: 100%; padding: 0; border: 0; }
  .rail-nav button { flex: 1 1 0; width: auto; height: 100%; border-radius: 12px; font-size: 10px; }
  .rail-nav button svg { width: 22px; height: 22px; }
  .rail-chats { display: none; }
  .home { padding: 26px 16px calc(110px + env(safe-area-inset-bottom,0px)); }
  .home-hero { display: block; margin-top: 8px; }
  .hero h1, #explore-view h1, #plans-view h1 { font-size: clamp(2rem,9vw,3.1rem); line-height: 1.13; }
  .hero-art { height: 210px; min-height: 0; margin-top: 26px; border-radius: 18px; }
  .hero-art span { font-size: 1rem; left: 16px; bottom: 16px; }
  #saved-section { margin-bottom: 35px; }
  .saved-chat { grid-template-columns: 100px minmax(0,1fr); min-height: 156px; }
  .saved-chat-portrait { min-height: 156px; }
  .saved-chat-body { padding: 16px 42px 14px 14px; }
  .saved-chat strong { font-size: .86rem; }
  .saved-chat p { margin: 8px 0 10px; }
  .character { aspect-ratio: 3/4.2; }
  .char-copy { left: 10px; right: 10px; bottom: 11px; }
  .char-chips { margin-bottom: 6px; }
  .char-chip:not(:first-child) { display: none; }
  .char-chip { max-width: 100%; font-size: 10px; }
  .char-copy strong { font-size: .86rem; white-space: normal; overflow-wrap: anywhere; }
  .char-copy small { display: -webkit-box; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; }
  .chat { min-height: 100dvh; }
  .chat-backdrop { inset: 0; }
  .chat-head { height: 72px; padding: 0 12px; }
  .chat-person img { width: 48px; height: 48px; flex-basis: 48px; }
  .chat-person strong { font-size: .85rem; }
  .chat-person small { font-size: 10px; }
  .composer-wrap { bottom: var(--tab-h); padding-bottom: 8px; }
  .messages { padding-bottom: 18px; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-card { min-height: 310px; }
}

@media (prefers-reduced-motion: reduce) {
  .saved-chat, .hero-art img { transition: none; }
}

/* ===== Navigation: Home · Chats · Plans, one catalogue with real filters ===== */
.rail-nav button { position: relative; }
.tab-count { position: absolute; top: 5px; right: 9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #1a0e0b; font: 800 10.5px/18px var(--brand-font-body); text-align: center; box-shadow: 0 0 0 2px rgba(16,19,22,.96); }

.see-all { border: 0; background: none; padding: 4px 0; color: var(--accent); font: 700 13px/1.2 var(--brand-font-body); cursor: pointer; }
.see-all:hover { color: var(--accent2); }
#continue-section .section-head { margin-top: 4px; max-width: 680px; }
.continue-card { grid-template-columns: minmax(0,1fr) !important; max-width: 680px; }
#continue-section { margin-bottom: 18px; }

.explore-tools { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 12px; margin: 6px 0 18px; min-width: 0; }
.explore-search { width: min(460px,100%); height: 46px; padding: 0 16px 0 42px; border-radius: 14px; background: rgba(24,28,30,.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23918b86' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") 14px center / 18px no-repeat; border: 1px solid var(--line); font-size: 15px; }
.explore-search:focus { border-color: var(--brand-accent-line); box-shadow: 0 0 0 4px var(--brand-accent-soft); }
.filter-row { min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 28px), transparent); }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row:empty { display: none; }
.filter-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(24,28,30,.9); color: #d9d4cf; font: 600 14px/1 var(--brand-font-body); white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.filter-chip span { color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-chip:hover { border-color: rgba(255,255,255,.28); }
.filter-chip:active { transform: scale(.96); }
.filter-chip.active { background: var(--brand-accent-soft); border-color: var(--brand-accent-line); color: #fff; }
.filter-chip.active span { color: var(--accent); }
.filter-sep { flex: none; width: 1px; height: 22px; background: var(--line); margin-inline: 4px; }
.filter-empty { padding: 34px 0 10px; color: var(--muted); }
.filter-empty p { margin: 0 0 12px; }
.filter-empty button, .chats-empty button { border: 1px solid var(--brand-accent-line); border-radius: 12px; background: var(--brand-accent-soft); color: var(--accent); font: 700 14px/1 var(--brand-font-body); padding: 12px 16px; cursor: pointer; }
.chats-empty { margin-top: 10px; padding: 28px 22px; border: 1px dashed var(--line); border-radius: 20px; background: rgba(20,24,27,.6); }
.chats-empty strong { display: block; font: 600 1.05rem/1.3 var(--brand-font-heading); margin-bottom: 6px; }
.chats-empty p { margin: 0 0 16px; color: var(--muted); }
#chats-view h1 { margin-bottom: 6px; }

@media (min-width: 720px) {
  .explore-tools { flex-direction: row; align-items: center; }
  .explore-search { flex: 0 0 300px; }
  .filter-row { flex: 1; margin-inline: 0; padding-inline: 2px; }
}
@media (max-width: 680px) {
  .tab-count { top: 3px; right: calc(50% - 26px); }
}

/* Guest plan chip (shown instead of "Sign in" when no sign-in method is configured) */
.plan-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(24,28,30,.9); color: var(--muted); font: 600 13px/1 var(--brand-font-body); cursor: pointer; }
.plan-chip span { padding: 5px 9px; border-radius: 999px; background: var(--brand-accent-soft); color: var(--accent); font-weight: 800; font-size: 12px; }
.plan-chip b { color: var(--text); font-weight: 800; }
.plan-chip:hover { border-color: var(--brand-accent-line); color: var(--text); }
.filter-chip:disabled { opacity: .38; cursor: default; }
#stories { scroll-margin-top: 76px; }

/* ===== Plans page ===== */
.plan-usage { max-width: 1100px; margin: 4px 0 22px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(21,25,29,.8); }
.plan-usage-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; color: var(--muted); font-size: 14px; }
.plan-usage-top strong { color: var(--text); }
.plan-usage small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.meter { height: 8px; margin-top: 12px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #f5b35c); box-shadow: 0 0 14px rgba(230,106,66,.6); }
.billing-toggle { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 999px; background: rgba(21,25,29,.9); }
.billing-toggle button { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 700 13px/1 var(--brand-font-body); cursor: pointer; }
.billing-toggle button span { padding: 3px 7px; border-radius: 99px; background: rgba(62,224,137,.14); color: #6fe3a4; font-size: 11px; }
.billing-toggle button.active { background: var(--raised); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
#plans-view .plan-grid { margin-top: 0; }
#plans-view .plan-price { display: flex; align-items: baseline; gap: 6px; margin: 22px 0 4px; font-size: clamp(1.8rem,3vw,2.3rem); }
#plans-view .plan-price small { color: var(--muted); font: 600 14px/1 var(--brand-font-body); letter-spacing: 0; }
.plan-billed { min-height: 1.3em; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
#plans-view .plan-card li { color: #d9d4cf; }
#plans-view .plan-card li strong { display: inline; margin: 0; font-size: inherit; color: var(--text); }
#plans-view .plan-card li span { color: var(--muted); font-size: 13px; }
#plans-view .plan-card.recommended .plan-badge { padding: 5px 10px; border-radius: 99px; background: var(--accent); color: #1a0e0b; letter-spacing: .06em; }
.plan-footnote { max-width: 760px; margin: 22px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* ===== Out-of-messages popup ===== */
.limit-dialog .mode-inner { position: relative; text-align: center; padding-top: 30px; }
.limit-dialog .mode-close { position: absolute; top: 14px; right: 14px; }
.limit-hero { position: relative; display: inline-flex; margin-bottom: 14px; }
.limit-avatar { display: block; width: 84px; height: 84px; padding: 3px; border-radius: 50%; background: conic-gradient(from 210deg, var(--accent), #f5b35c, var(--accent)); box-shadow: 0 0 34px rgba(230,106,66,.55); }
.limit-avatar img { width: 100%; height: 100%; border: 3px solid #14181c; border-radius: 50%; object-fit: cover; object-position: center 22%; }
.limit-dots { position: absolute; right: -30px; bottom: 6px; display: inline-flex; gap: 4px; padding: 8px 10px; border-radius: 14px 14px 14px 4px; background: #242a2e; border: 1px solid var(--line); }
.limit-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.1s infinite ease-in-out; }
.limit-dots i:nth-child(2) { animation-delay: .15s; } .limit-dots i:nth-child(3) { animation-delay: .3s; }
.limit-dialog h2 { margin: 0 0 8px; font: 600 1.35rem/1.25 var(--brand-font-heading); letter-spacing: -.03em; }
.limit-dialog #limit-text { margin: 0 auto 14px; max-width: 38ch; color: var(--muted); line-height: 1.5; }
.limit-refill { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 8px 14px; border-radius: 999px; background: rgba(62,224,137,.1); color: #bfeccf; font-size: 13px; }
.limit-refill strong { color: #fff; }
.refill-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ee089; box-shadow: 0 0 0 0 #3ee08999; animation: online 2.4s ease-out infinite; }
.limit-plans { display: grid; gap: 8px; margin-bottom: 16px; text-align: left; }
.limit-plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.03); }
.limit-plan.recommended { border-color: var(--brand-accent-line); background: var(--brand-accent-soft); }
.limit-plan strong { display: block; font-size: 15px; }
.limit-plan span { color: var(--muted); font-size: 13px; }
.limit-plan b { font: 700 18px/1 var(--brand-font-heading); white-space: nowrap; }
.limit-plan b small { color: var(--muted); font: 600 12px var(--brand-font-body); }
.limit-dialog .settings-primary { width: 100%; }
.limit-later { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; background: none; color: var(--muted); font: 600 14px var(--brand-font-body); cursor: pointer; }
.limit-later:hover { color: var(--text); }

/* Low-balance hint above the composer */
.usage-hint { display: flex; align-items: center; gap: 5px; width: fit-content; margin: 0 auto 10px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(20,17,22,.8); color: #d9d4cf; font: 600 13px/1 var(--brand-font-body); cursor: pointer; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.usage-hint b { color: var(--accent); }
.usage-hint span { color: var(--accent); }
.usage-hint.empty { border-color: var(--brand-accent-line); background: rgba(64,35,25,.85); color: #fff; }
@media (max-width: 680px) { #plans-view .plan-card.recommended { order: -1; } }

/* ===== Out-of-messages popup v2 ===== */
.limit-dialog { width: min(460px, calc(100% - 24px)); }
.limit-dialog .mode-inner { padding: 28px 24px 18px; }
.limit-step { display: flex; flex-direction: column; align-items: stretch; }
.limit-step > .limit-hero, .limit-step > .remind-icon { align-self: center; }
.limit-dialog #limit-text, .limit-dialog #remind-text { margin: 0 auto 18px; max-width: 36ch; color: var(--muted); line-height: 1.5; }
.limit-timer { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 0 18px; padding: 14px 16px 16px; border: 1px solid rgba(62,224,137,.22); border-radius: 18px; background: radial-gradient(120% 140% at 50% 0%, rgba(62,224,137,.14), rgba(62,224,137,.04) 60%, transparent); }
.limit-timer-label { color: #9fdcb9; font: 700 11px/1 var(--brand-font-body); letter-spacing: .14em; text-transform: uppercase; }
.limit-timer-value { color: #fff; font: 600 clamp(2rem, 9vw, 2.6rem)/1 var(--brand-font-heading); letter-spacing: .02em; font-variant-numeric: tabular-nums; text-shadow: 0 0 24px rgba(62,224,137,.35); }
.limit-plans { display: grid; gap: 8px; margin-bottom: 16px; }
.limit-plan { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.03); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; font: inherit; }
.limit-plan:hover { border-color: rgba(255,255,255,.26); }
.limit-plan:active { transform: scale(.99); }
.limit-plan.selected { border-color: var(--accent); background: var(--brand-accent-soft); box-shadow: 0 0 0 3px rgba(230,106,66,.14); }
.limit-radio { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.35); border-radius: 50%; }
.limit-plan.selected .limit-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px); }
.limit-plan-copy { min-width: 0; }
.limit-plan-copy strong { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.limit-plan-copy strong em { padding: 3px 7px; border-radius: 99px; background: var(--accent); color: #1a0e0b; font: 800 10px/1 var(--brand-font-body); font-style: normal; letter-spacing: .04em; text-transform: uppercase; }
.limit-plan-copy > span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.limit-plan b { font: 700 18px/1 var(--brand-font-heading); white-space: nowrap; }
.limit-plan b small { color: var(--muted); font: 600 12px var(--brand-font-body); }
.remind-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 6px 0 16px; border-radius: 50%; background: var(--brand-accent-soft); color: var(--accent); box-shadow: 0 0 0 8px rgba(230,106,66,.06), 0 0 34px rgba(230,106,66,.35); animation: ring 2.6s ease-in-out infinite; }
@keyframes ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(4deg); } }
.meter.unlimited i { background: linear-gradient(90deg, #3ee089, #7cf0b4); box-shadow: 0 0 14px rgba(62,224,137,.5); }

/* Composer while out of messages: typing works, send shows a lock */
#chat-view .composer.locked .send { color: #1a0e0b; background: linear-gradient(135deg, #f5b35c, var(--accent)); transform: none; box-shadow: 0 6px 18px -6px rgba(230,106,66,.8); }
#chat-view .composer.locked .send svg { display: none; }
#chat-view .composer.locked .send::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center/contain no-repeat; }
#chat-view .composer.locked ~ * , #chat-view .composer.locked { }
@media (prefers-reduced-motion: reduce) { .remind-icon { animation: none; } }
#chat-view .composer-wrap:has(.composer.locked) .continue { display: none !important; }

/* ===== Picker labels: filters by world / lead / intensity, richer cards, pre-chat profile ===== */
.explore-tools { flex-direction: row; flex-wrap: wrap; align-items: center; }
.explore-tools .explore-search { flex: 1 1 320px; }
.surprise { flex: none; height: 46px; padding: 0 18px; border: 1px solid var(--brand-accent-line); border-radius: 14px; background: var(--brand-accent-soft); color: var(--text); font: 650 14px/1 var(--brand-font-body); cursor: pointer; transition: transform .15s, background .15s; }
.surprise:hover { background: rgba(230,106,66,.26); }
.surprise:active { transform: scale(.96); }
.surprise span { color: var(--accent); }
.filter-groups { flex: 1 1 100%; display: grid; gap: 8px; min-width: 0; }
.filter-groups:empty { display: none; }
@media (min-width: 900px) {
  .filter-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
  .filter-group:first-child { grid-column: 1 / -1; }
  .filter-clear { grid-column: 1 / -1; }
}
.filter-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.filter-label { flex: none; width: 74px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.filter-group .filter-row { flex: 1; margin-inline: 0; padding-inline: 2px 24px; }
.filter-group .filter-chip { height: 34px; padding: 0 12px; font-size: 13px; }
.filter-chip:disabled { opacity: .35; cursor: default; }
.filter-clear { justify-self: start; border: 0; background: transparent; color: var(--accent); font: 650 13px/1 var(--brand-font-body); padding: 6px 2px; cursor: pointer; }
.shade { inset: 22% 0 0; background: linear-gradient(transparent, rgba(9,9,11,.9) 62%); }
.char-copy .char-vibe { display: block; margin-top: 2px; color: var(--accent2, #f0a48c); font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.char-copy .char-hook { display: -webkit-box; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 5px; color: #dcd4cc; font-size: 12px; line-height: 1.35; }
.char-chip.tone { display: inline-flex; align-items: center; gap: 5px; }
.char-chip.tone::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #7fd1b0; }
.char-chip.tone-sharp::before { background: #f2b756; }
.char-chip.tone-dangerous { border-color: rgba(240,96,96,.55); }
.char-chip.tone-dangerous::before { background: #f06060; }
.pick-profile { display: grid; grid-template-columns: 56px 1fr; gap: 4px 14px; margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); }
.pick-profile img { grid-row: span 2; width: 56px; height: 56px; border-radius: 16px; object-fit: cover; object-position: center 20%; }
.pick-head { align-self: center; min-width: 0; }
.pick-head strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.pick-head span { color: var(--accent2, #f0a48c); font-size: 13px; font-weight: 600; }
.pick-hook { grid-column: 1 / -1; margin: 10px 0 0; color: #d6cfc8; font-size: 14px; line-height: 1.45; }
.pick-profile dl { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 12px 0 0; }
.pick-profile dt { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.pick-profile dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
.pick-tone { grid-column: 1 / -1; margin: 12px 0 0; padding: 9px 11px; border-left: 3px solid #7fd1b0; border-radius: 4px 10px 10px 4px; background: rgba(127,209,176,.08); color: #cfc8c1; font-size: 12.5px; line-height: 1.4; }
.pick-tone b { color: #fff; margin-right: 4px; }
.pick-tone.tone-sharp { border-color: #f2b756; background: rgba(242,183,86,.08); }
.pick-tone.tone-dangerous { border-color: #f06060; background: rgba(240,96,96,.09); }
.pick-voice { grid-column: 1 / -1; margin: 12px 0 0; color: #e9e0d7; font-size: 14px; font-style: italic; line-height: 1.45; }
@media (max-width: 720px) {
  .char-chip.tone { display: inline-flex; }
  .char-copy .char-hook { font-size: 11px; }
  .filter-label { width: 62px; }
  .explore-tools .explore-search { flex-basis: 100%; }
}
@media (min-width: 720px) {
  .character { min-height: 0; }
}
@media (min-width: 720px) and (max-width: 1099px) {
  .characters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.filter-toggle { display: none; flex: none; height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(24,28,30,.9); color: var(--text); font: 650 14px/1 var(--brand-font-body); cursor: pointer; }
.filter-toggle.has-active { border-color: var(--brand-accent-line); color: var(--accent); }
@media (max-width: 720px) {
  .filter-toggle { display: block; flex: 1 1 0; }
  .surprise { flex: 1 1 0; }
  .filter-groups:not(.open) { display: none; }
}
