.atmosphere.dim::after { opacity: 0.12; }

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.auth-screen {
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bot));
}
.auth-card {
  width: min(420px, 100%);
  border-radius: 28px;
  padding: 22px 20px 18px;
  animation: floatIn 0.55s ease-out;
}
.auth-char {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
  margin: 0 auto 8px;
  border: 1px solid var(--glass-border);
  animation: drift 4.5s ease-in-out infinite;
}
.brand { text-align: center; margin-bottom: 12px; }
.brand-mark.lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin: 0 auto 8px;
}
.brand h1 { margin: 0; font-size: 1.4rem; letter-spacing: -0.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.auth-form label { display: block; margin-bottom: 12px; }
.auth-form span { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.auth-form input {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
.auth-form input:focus { border-color: rgba(77,184,255,0.55); }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0; color: var(--muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--glass-border);
}
.google-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 48px;
  overflow: visible;
}
#google-btn {
  width: 100%;
  max-width: 320px;
  min-height: 44px;
  display: flex;
  justify-content: center;
}
#google-btn > div,
#google-btn iframe {
  max-width: 100% !important;
}
#google-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}
.auth-hint { text-align: center; font-size: 0.8rem; margin: 14px 0 0; }
.auth-hint a { color: var(--accent); }

@media (max-width: 560px) {
  .auth-char { width: 64px; height: 64px; margin-bottom: 6px; }
  .auth-card { padding: 16px 14px 14px; }
}

.chat-screen { height: 100dvh; max-height: 100dvh; }
.chat-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  border-radius: 0 0 20px 20px;
  position: sticky; top: 0; z-index: 5;
}
.top-left { display: flex; gap: 10px; align-items: center; }
.title-row { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 0.68rem; padding: 2px 8px; border-radius: 999px;
  background: rgba(110,240,208,0.15); color: var(--accent2);
  border: 1px solid rgba(110,240,208,0.25);
}
.status { font-size: 0.75rem; color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: min(86%, 560px);
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  animation: floatIn 0.28s ease-out;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, #2f7dff, #4db8ff);
  border-bottom-right-radius: 6px;
}
.msg.ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 6px;
}
.msg img { display: block; max-width: 100%; border-radius: 12px; margin-top: 8px; }
.msg .meta { font-size: 0.7rem; opacity: 0.65; margin-top: 6px; }

.typing {
  align-self: flex-start;
  margin: 0 14px 8px;
  padding: 10px 14px;
  border-radius: 16px;
  width: fit-content;
  display: flex; gap: 5px;
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent2);
  animation: bounce 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.composer-wrap { padding: 0 12px calc(10px + var(--safe-bot)); }
.mode-bar {
  display: flex; gap: 6px; padding: 6px;
  border-radius: 16px; margin-bottom: 8px;
}
.mode {
  flex: 1; border: 0; border-radius: 12px;
  padding: 10px 8px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.mode.active {
  background: rgba(77,184,255,0.22);
  color: var(--text);
}
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px; border-radius: 20px;
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px;
  border: 0; background: transparent; color: var(--text);
  font: inherit; padding: 10px 4px; outline: none;
}
.send {
  width: 44px; height: 44px; border-radius: 14px; border: 0;
  background: linear-gradient(135deg, #3aa0ff, #6ef0d0);
  color: #041018; font-size: 1.1rem; cursor: pointer;
}
.cost-hint {
  text-align: center; color: var(--muted);
  font-size: 0.72rem; margin: 6px 0 0;
}

.sheet {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
}
.sheet-panel {
  position: relative;
  width: min(480px, 100%);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(18px + var(--safe-bot));
  animation: floatIn 0.28s ease-out;
}
.sheet-handle {
  width: 42px; height: 4px; border-radius: 4px;
  background: rgba(255,255,255,0.25);
  margin: 4px auto 14px;
}
.sheet-panel > button, .sheet-link {
  display: block; width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 8px;
  font-size: 1rem;
  cursor: pointer;
}
.sheet-panel > button.danger { color: var(--danger); }
.sheet-panel > button.muted, .sheet-close {
  text-align: center; color: var(--muted); background: transparent;
}
.need-char {
  width: 72px; height: 72px; border-radius: 18px;
  object-fit: cover; margin: 0 auto 10px;
  border: 1px solid var(--glass-border);
}
.sheet-panel h2 { text-align: center; margin: 0 0 8px; }

.empty {
  margin: auto; text-align: center; color: var(--muted);
  padding: 40px 20px; max-width: 280px;
}
.empty img {
  width: 96px; height: 96px; border-radius: 24px;
  margin: 0 auto 12px; object-fit: cover;
  border: 1px solid var(--glass-border);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 1.1rem; }
