/* ============================================================
   Typical! — Premium Stylesheet
   Covers: premium.html, premium-chat.html, and all future
   premium surfaces. Self-contained — no dependency on style.css.
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ── */
:root {
  /* Light surface (chat area) */
  --cream:      #f7f4ef;
  --ink:        #1a1a1a;
  --ink-mid:    #4a4a4a;
  --ink-light:  #8a8a8a;
  --border:     #e0dbd2;
  --ai-bg:      #ffffff;
  --ai-text:    #1a1a1a;
  --user-bg:    #2a2a2a;
  --user-text:  #f7f4ef;
  --radius:     10px;

  /* Dark gold surface (header, premium.html) */
  --hero-bg:    #1a1208;
  --hero-text:  #f5e8c8;
  --hero-mid:   #a08858;
  --hero-dim:   #6a5838;
  --accent:     #c8902a;

  /* Premium character grid */
  --bg:         #0e0c08;
  --surface:    #1a1208;
  --card:       #201810;
  --card-hover: #2a1f10;
  --gold:       #c8902a;
  --gold-light: #e8b050;
  --gold-dim:   #6a5838;
  --text:       #f5e8c8;
  --text-mid:   #a08858;
  --text-dim:   #5a4828;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}


/* ============================================================
   PREMIUM CHARACTER GRID — premium.html
   ============================================================ */

body.premium-grid-page {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background texture */
body.premium-grid-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(200,144,42,0.12) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.top-bar {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 56px;
  animation: fadeDown 0.6s ease both;
}

.header-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  opacity: 0.9;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.15;
  margin-bottom: 12px;
}

.header h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--gold-light);
}

.header-sub {
  font-size: 0.9rem;
  color: var(--text-mid);
  font-weight: 300;
  letter-spacing: 0.03em;
}

/* ── Character grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ── Character card ── */
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  aspect-ratio: 1 / 1.1;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.5s ease both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.20s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.30s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.40s; }
.card:nth-child(9) { animation-delay: 0.45s; }

.card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(200,144,42,0.18), 0 0 0 1px rgba(200,144,42,0.15);
  background: var(--card-hover);
}

.card:hover .card-overlay { opacity: 1; }
.card:hover .card-name    { opacity: 0; }
.card:hover .card-img     { filter: brightness(0.45) saturate(0.8); }

/* Portrait */
.card-img {
  width: 100%;
  flex: 1;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: filter 0.25s ease;
  filter: brightness(0.85) saturate(0.9);
}

/* Name strip at bottom */
.card-name {
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(10,8,4,0.95) 0%, rgba(10,8,4,0.6) 100%);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transition: opacity 0.2s ease;
}

.card-name-text {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cream);
  display: block;
  line-height: 1.2;
}

.card-name-sub {
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

/* Hover overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(20,14,4,0.97) 0%, rgba(30,20,8,0.95) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
  text-align: center;
}

.overlay-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 8px;
  line-height: 1.2;
}

.overlay-desc {
  font-size: 0.75rem;
  color: var(--cream-dim, #a08858);
  line-height: 1.5;
  font-weight: 300;
}

.overlay-cta {
  margin-top: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 5px 12px;
  transition: background 0.2s, color 0.2s;
}

.card:hover .overlay-cta {
  background: var(--gold);
  color: var(--bg);
}

/* ── Coming soon card ── */
.card-coming {
  background: #141008;
  border: 1.5px dashed #2a2010;
  cursor: default;
  opacity: 0.5;
  animation: fadeUp 0.5s ease both;
}

.card-coming:nth-child(10) { animation-delay: 0.50s; }
.card-coming:nth-child(11) { animation-delay: 0.55s; }
.card-coming:nth-child(12) { animation-delay: 0.60s; }

.card-coming:hover {
  transform: none;
  box-shadow: none;
  border-color: #2a2010;
  background: #141008;
}

.card-coming-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  gap: 8px;
}

.coming-icon {
  font-size: 1.8rem;
  opacity: 0.3;
}

.coming-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #3a2e18;
}

/* Seasonal card */
.card-seasonal {
  border-style: dashed;
  border-color: #3a2810;
  opacity: 0.6;
}

.card-seasonal .coming-label {
  color: var(--gold-dim);
  opacity: 0.6;
}

.card-seasonal .coming-icon {
  opacity: 0.4;
}

/* ── Footer note ── */
.footer-note {
  text-align: center;
  margin-top: 48px;
  animation: fadeUp 0.5s 0.7s ease both;
}

.footer-note p {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 300;
  letter-spacing: 0.04em;
}

.footer-note p + p { margin-top: 6px; }

.footer-divider {
  width: 40px;
  height: 1px;
  background: var(--gold-dim);
  margin: 24px auto;
  opacity: 0.4;
}

/* ── Grid animations ── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   PREMIUM CHAT PAGE — premium-chat.html
   ============================================================ */

body.premium-chat-page {
  background: #0e0c08;
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
}

.premium-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Premium header — dark gold ── */
.premium-header {
  background: var(--hero-bg);
  border-bottom: 1px solid #3a2e18;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  flex-shrink: 0;
}

.premium-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.premium-back-btn:hover { opacity: 1; }

.premium-header-divider {
  width: 1px;
  height: 26px;
  background: #3a2e18;
  flex-shrink: 0;
}

.premium-persona {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.premium-avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  object-position: top center;
  border: 1.5px solid #6a5838;
  flex-shrink: 0;
}

.premium-persona-text { min-width: 0; }

.premium-persona-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--hero-text);
  display: block;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.premium-persona-sub {
  font-size: 0.68rem;
  color: var(--accent);
  font-style: italic;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reset-btn {
  background: none;
  border: 1px solid #3a2e18;
  color: var(--hero-dim);
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.reset-btn:hover {
  color: var(--hero-text);
  border-color: var(--hero-mid);
}

/* ── Chat card — fills remaining height ── */
.premium-chat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ── Messages — scrollable ── */
.chat-messages {
  flex: 1;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #ffffff;
}

/* Message rows */
.message-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.assistant-row { align-items: flex-start; }
.user-row      { justify-content: flex-end; }

.bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  margin-top: 2px;
}

.message {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.55;
  user-select: text;
  -webkit-user-select: text;
}

.message.assistant {
  background: #ffffff;
  color: var(--ai-text);
  border: 1px solid var(--border);
  border-radius: 4px 10px 10px 10px;
  font-style: italic;
}

.message.user {
  background: var(--user-bg);
  color: var(--user-text);
  border-radius: 10px 4px 10px 10px;
  font-style: normal;
}

.message.system-notice {
  background: none;
  border: none;
  color: var(--ink-light);
  font-size: 0.8rem;
  text-align: center;
  align-self: center;
  padding: 2px 0;
  max-width: 100%;
  font-style: normal;
}

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 13px 15px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px 10px 10px 10px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-light);
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ── Input area ── */
.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: #f7f4ef;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.15s;
  max-height: 120px;
  overflow-y: auto;
}
.chat-input:focus { border-color: var(--ink-mid); }
.chat-input::placeholder { color: #a09070; font-style: italic; }

.send-btn {
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.send-btn:hover    { opacity: 0.85; }
.send-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Session end strip ── */
.session-end-strip {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--cream);
  flex-shrink: 0;
}
.session-end-strip.visible { display: flex; }

.session-end-label {
  font-size: 0.78rem;
  color: var(--ink-light);
  letter-spacing: 0.04em;
}

.session-end-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.end-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-mid);
  transition: border-color 0.15s, color 0.15s;
}
.end-btn:hover { border-color: var(--ink-mid); color: var(--ink); }

.end-btn-primary {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  font-weight: 600;
}
.end-btn-primary:hover { opacity: 0.85; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .premium-page {
    height: 100dvh;
    max-width: 100%;
  }

  .chat-input-area {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
  }

  .send-btn {
    width: 100%;
    padding: 12px;
    text-align: center;
  }

  .message { max-width: 88%; }

  .bubble-avatar { width: 26px; height: 26px; }
}
