/* =========================================================
   ALIV AI — design tokens
   ========================================================= */
:root {
  --bg: #070707;
  --bg-card: #0f0f12;
  --bg-elevated: #15151a;
  --bg-input: #1b1b21;
  --border: #26262d;
  --border-soft: #1d1d23;

  --gold: #c79a4b;
  --gold-bright: #e6c17a;
  --gold-dim: rgba(199, 154, 75, 0.18);

  --text: #f4f1ec;
  --text-muted: #91919b;
  --text-faint: #5c5c66;

  --danger: #e0735c;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: var(--text); }
a { color: var(--gold-bright); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden { display: none !important; }

/* =========================================================
   View layout — header/content/footer column for both views
   ========================================================= */
.view {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   Brand
   ========================================================= */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 6px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: block;
  animation: brand-breathe 4.5s ease-in-out infinite;
}

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 0.42em;
  color: var(--text);
  padding-left: 0.42em;
}

@keyframes brand-breathe {
  0%, 100% { filter: drop-shadow(0 0 0px rgba(199, 154, 75, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 14px rgba(199, 154, 75, 0.55)); transform: scale(1.035); }
}

.brand-mark.thinking { animation: brand-thinking 1.1s ease-in-out infinite; }

@keyframes brand-thinking {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(199, 154, 75, 0.3)); transform: scale(1) rotate(0deg); }
  50% { filter: drop-shadow(0 0 18px rgba(199, 154, 75, 0.85)); transform: scale(1.08) rotate(8deg); }
}

/* =========================================================
   Auth view
   ========================================================= */
#auth-view {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(199, 154, 75, 0.12), transparent 55%),
    radial-gradient(ellipse at 85% 105%, rgba(199, 154, 75, 0.07), transparent 50%),
    var(--bg);
}

.auth-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-top: 1px solid rgba(199, 154, 75, 0.3);
  border-radius: var(--radius-lg);
  padding: 38px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: card-rise 0.5s ease;
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 30px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 26px;
  gap: 4px;
}

.auth-tabs .tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  transition: background 0.25s ease, color 0.25s ease;
}

.auth-tabs .tab.active {
  background: var(--gold);
  color: #1a1306;
}

.auth-form { display: none; flex-direction: column; gap: 18px; }

.auth-form.active {
  display: flex;
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.field { display: flex; flex-direction: column; gap: 7px; }

.field label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.field input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  outline: none;
}

.field .hint { font-size: 12px; color: var(--text-faint); text-align: center; }

/* =========================================================
   Buttons
   ========================================================= */
.primary-btn {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1a1306;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(199, 154, 75, 0.18);
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.primary-btn:hover { filter: brightness(1.08); box-shadow: 0 10px 26px rgba(199, 154, 75, 0.26); }
.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.secondary-btn:hover { color: var(--gold-bright); border-color: var(--gold); }
.secondary-btn:active { transform: scale(0.98); }

/* =========================================================
   OTP login experience
   ========================================================= */
.otp-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  gap: 18px;
  transition: grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.4s ease 0.05s;
}

.otp-wrap > * { min-height: 0; }

.otp-wrap.open {
  grid-template-rows: 1fr;
  opacity: 1;
  padding-top: 4px;
}

.otp-wrap > .field,
.otp-wrap > .secondary-btn { display: flex; flex-direction: column; }
.otp-wrap.open > .secondary-btn { display: block; text-align: center; }

.otp-group {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.otp-box {
  width: 44px;
  height: 54px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.otp-box:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim), 0 0 16px rgba(199, 154, 75, 0.22);
  outline: none;
}

.otp-box.filled {
  border-color: rgba(199, 154, 75, 0.5);
  background: rgba(199, 154, 75, 0.07);
  animation: otp-pop 0.22s ease;
}

@keyframes otp-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* progressive "scanning" pulse while verification is pending */
.otp-group.verifying .otp-box {
  animation: otp-scan 1s ease-in-out infinite;
  pointer-events: none;
}
.otp-group.verifying .otp-box:nth-child(1) { animation-delay: 0s; }
.otp-group.verifying .otp-box:nth-child(2) { animation-delay: 0.07s; }
.otp-group.verifying .otp-box:nth-child(3) { animation-delay: 0.14s; }
.otp-group.verifying .otp-box:nth-child(4) { animation-delay: 0.21s; }
.otp-group.verifying .otp-box:nth-child(5) { animation-delay: 0.28s; }
.otp-group.verifying .otp-box:nth-child(6) { animation-delay: 0.35s; }

@keyframes otp-scan {
  0%, 100% { box-shadow: 0 0 0 rgba(199, 154, 75, 0); border-color: rgba(199, 154, 75, 0.5); }
  50% { box-shadow: 0 0 16px rgba(199, 154, 75, 0.45); border-color: var(--gold); }
}

/* wrong code */
.otp-group.shake .otp-box {
  border-color: var(--danger);
  box-shadow: 0 0 14px rgba(224, 115, 92, 0.35);
  animation: otp-shake 0.5s ease;
}

@keyframes otp-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* correct code */
.otp-group.success .otp-box {
  border-color: var(--gold);
  background: rgba(199, 154, 75, 0.16);
  box-shadow: 0 0 20px rgba(199, 154, 75, 0.5);
  transform: scale(1.04);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

/* --- register steps --- */
.reg-step { display: none; flex-direction: column; gap: 18px; }

.reg-step.active {
  display: flex;
  animation: fade-in 0.35s ease;
}

.step-title {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.qr-box {
  display: flex;
  justify-content: center;
  background: var(--text);
  border-radius: var(--radius-md);
  padding: 12px;
}

.qr-box img {
  width: 180px;
  height: 180px;
  display: block;
  border-radius: var(--radius-sm);
}

.manual-key {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.manual-key summary { cursor: pointer; }

.manual-key code {
  display: block;
  margin-top: 8px;
  word-break: break-all;
  font-family: var(--font-mono);
  color: var(--gold-bright);
  font-size: 12px;
}

.form-msg {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--danger);
  transition: color 0.2s ease;
}

.form-msg.success { color: var(--gold-bright); }

/* =========================================================
   Footer (persistent, both views)
   ========================================================= */
.app-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 16px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: rgba(15, 15, 18, 0.85);
  backdrop-filter: blur(12px);
}

.app-footer p {
  margin: 0;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.02em;
}

.app-footer .copyright {
  color: var(--text-muted);
  font-weight: 500;
}

.app-footer .info-link {
  font-size: 11px;
}

.info-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.info-link:hover { color: var(--gold-bright); }

/* =========================================================
   Chat view
   ========================================================= */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(15, 15, 18, 0.85);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 20;
  flex-shrink: 0;
}

.brand-sm { margin: 0; gap: 8px; }
.brand-sm .brand-mark { width: 32px; height: 32px; }
.brand-sm .brand-word { font-size: 16px; letter-spacing: 0.32em; }

.header-actions { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover { color: var(--gold-bright); border-color: var(--gold); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* =========================================================
   Model selector
   ========================================================= */
.model-selector { position: relative; min-width: 0; }

.auto-badge {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--gold-bright);
  background: var(--gold-dim);
  border: 1px solid rgba(199, 154, 75, 0.35);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 5;
  animation: fade-in 0.3s ease;
}

.model-selector.open .auto-badge { display: none; }

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.model-selector-btn:hover { border-color: var(--gold); }

.msel-icon { display: flex; color: var(--gold-bright); flex-shrink: 0; }
.msel-icon svg { width: 16px; height: 16px; }

.msel-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msel-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.model-selector.open .msel-chevron { transform: rotate(180deg); }
.model-selector.open .model-selector-btn { border-color: var(--gold); }

.model-selector-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-top: 1px solid rgba(199, 154, 75, 0.3);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 50;
  animation: fade-in 0.2s ease;
}

.model-selector-panel.hidden { display: none; }

.msel-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.msel-option:hover { background: var(--bg-elevated); }
.msel-option.active { background: var(--gold-dim); }

.msel-opt-icon { color: var(--gold-bright); flex-shrink: 0; margin-top: 2px; }
.msel-opt-icon svg { width: 16px; height: 16px; }

.msel-option-title { font-size: 13px; font-weight: 600; }
.msel-option-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }

/* =========================================================
   Messages
   ========================================================= */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 32px 20px 40px;
  animation: fade-in 0.4s ease;
}

.empty-mark { width: 72px; height: 72px; margin-bottom: 8px; opacity: 0.9; }

.empty-state h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.empty-state p { font-size: 14px; margin: 0; max-width: 340px; }

.onboarding-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  margin-top: 22px;
}

@media (min-width: 600px) {
  .onboarding-grid { grid-template-columns: repeat(3, 1fr); }
}

.onboarding-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.onboarding-card:hover { border-color: rgba(199, 154, 75, 0.35); transform: translateY(-2px); }

.onboarding-icon { font-size: 20px; }

.onboarding-card h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  margin: 8px 0 4px;
  color: var(--text);
}

.onboarding-card p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.55; }

.msg {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: msg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg.user {
  align-self: flex-end;
  background: var(--gold);
  color: #1a1306;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(199, 154, 75, 0.18);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

.msg.error {
  align-self: flex-start;
  background: rgba(224, 115, 92, 0.12);
  border: 1px solid rgba(224, 115, 92, 0.35);
  color: var(--danger);
}

.msg.assistant .model-tag,
.msg.image-result .model-tag {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px 9px 3px 7px;
}

.msg.assistant .model-tag .dot,
.msg.image-result .model-tag .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

.reveal-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: -2px;
  animation: caret-blink 0.9s steps(1) infinite;
}

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

.typing-dots { display: inline-flex; gap: 4px; align-items: center; }

.typing-label {
  margin-left: 10px;
  font-size: 13px;
  color: var(--text-muted);
  vertical-align: middle;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* =========================================================
   Message action toolbar
   ========================================================= */
.msg-toolbar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.msg-action-btn:hover { color: var(--gold-bright); border-color: var(--gold); }
.msg-action-btn:active { transform: scale(0.92); }
.msg-action-btn svg { width: 14px; height: 14px; }
.msg-action-btn.copied { color: var(--gold-bright); border-color: var(--gold); }

/* =========================================================
   Chat input bar
   ========================================================= */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px 12px;
  border-top: 1px solid var(--border-soft);
  background: rgba(15, 15, 18, 0.85);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.chat-input-bar textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  font-size: 15px;
  line-height: 1.45;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-bar textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim), 0 0 18px rgba(199, 154, 75, 0.12);
  outline: none;
}

.send-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1a1306;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(199, 154, 75, 0.18);
  transition: filter 0.2s ease, transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.send-btn svg { width: 19px; height: 19px; }
.send-btn:hover { filter: brightness(1.08); box-shadow: 0 8px 22px rgba(199, 154, 75, 0.28); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.send-btn.pop { animation: send-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes send-pop {
  0% { transform: scale(1); }
  35% { transform: scale(0.88) rotate(-8deg); }
  70% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (min-width: 720px) {
  .messages, .chat-input-bar { padding-left: max(16px, calc(50% - 380px)); padding-right: max(16px, calc(50% - 380px)); }
  .msg { max-width: 70%; }
}

@media (max-width: 420px) {
  .msel-label { display: none; }
  .model-selector-btn { padding: 8px; gap: 4px; }
}

@media (max-width: 360px) {
  .brand-sm .brand-word { display: none; }
}

/* =========================================================
   Attachments
   ========================================================= */
.attach-btn.active { color: var(--gold-bright); border-color: var(--gold); }

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  animation: fade-in 0.25s ease;
}

.image-tier-toggle {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin: 0 16px 10px;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  animation: fade-in 0.25s ease;
}

.tier-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tier-btn:hover { color: var(--text); }

.tier-btn.active {
  background: var(--gold);
  color: #1a1306;
}

.attachment-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.attachment-icon { font-size: 18px; }
.attachment-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attachment-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.attachment-remove:hover { color: var(--danger); }

.msg .attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  margin-bottom: 8px;
}

.msg .attachment-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }

/* =========================================================
   Generated images
   ========================================================= */
.msg.image-result {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
  padding: 10px;
}

.msg.image-result img {
  display: block;
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.msg.image-result p { margin: 0 0 6px; font-size: 14px; }

.image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: #1a1306;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.download-link:hover { filter: brightness(1.08); }

.download-link.open-link {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.download-link.open-link:hover {
  filter: none;
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* =========================================================
   Intro animation
   ========================================================= */
.logo-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
  transition: opacity 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-intro.done { opacity: 0; pointer-events: none; }

.intro-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(199, 154, 75, 0.16), transparent 60%);
  opacity: 0;
  transform: scale(0.85);
  animation: intro-bg-in 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes intro-bg-in {
  to { opacity: 1; transform: scale(1); }
}

.intro-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.intro-tiles { position: relative; }

.intro-tile {
  position: absolute;
  background-image: url('assets/icon.png');
  background-repeat: no-repeat;
  opacity: 0;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.5);
  transition: transform 1.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro-tiles.assembled .intro-tile { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
.intro-tiles.assembled { animation: intro-glow 1.3s cubic-bezier(0.4, 0, 0.2, 1) 1s; }

@keyframes intro-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(199, 154, 75, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 32px rgba(199, 154, 75, 0.6)); transform: scale(1.02); }
}

.intro-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5em;
  color: var(--text-muted);
  opacity: 0;
  filter: blur(4px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), letter-spacing 1s cubic-bezier(0.16, 1, 0.3, 1), color 1s ease, filter 1s ease;
}

.intro-stage.reveal-word .intro-word {
  opacity: 1;
  letter-spacing: 0.7em;
  color: var(--text);
  filter: blur(0);
}

/* =========================================================
   Info modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-top: 1px solid rgba(199, 154, 75, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 24px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: card-rise 0.35s ease;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.modal-close:hover { color: var(--gold-bright); border-color: var(--gold); }

.about-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  text-align: center;
  margin: 4px 0 22px;
}

.modal-subtitle {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 12px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.modal-note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  margin: 14px 0 0;
  line-height: 1.55;
}

/* =========================================================
   Model badges
   ========================================================= */
.model-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  max-width: 440px;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.model-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.model-badge.image-badge { border-color: rgba(199, 154, 75, 0.35); color: var(--gold-bright); }
