:root {
  --bg: #000000;
  --surface: #171717;
  --surface-2: #212121;
  --line: rgba(255, 255, 255, 0.08);
  --ice: #00b0f9;
  --ice-2: #8fd8ff;
  --ice-dim: rgba(0, 176, 249, 0.15);
  --text: #ececec;
  --muted: #9b9b9b;
  --user: #2f2f2f;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html {
  margin: 0;
  background: var(--bg);
}
html, body {
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0 auto;
  max-width: 480px;
  position: relative;
  background: var(--bg);
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mode-chat {
  height: 100%;
  overflow: hidden;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.mode-chat .shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
  min-height: 0;
}

.hidden { display: none !important; }

html.native-shell #screen-install,
html.native-shell #screen-desktop {
  display: none !important;
}

.app-logo {
  display: block;
  margin: 0 auto;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(0, 176, 249, 0.45));
}
.app-logo.sm { width: 64px; height: 64px; }
.app-logo.xs { width: 28px; height: 28px; margin: 0; filter: drop-shadow(0 0 8px rgba(0, 176, 249, 0.35)); }

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

#screen-install, #screen-auth, .desktop-gate {
  justify-content: flex-start;
  text-align: center;
  gap: 12px;
  min-height: min(100%, 100dvh);
  overflow-y: visible;
  padding-bottom: 32px;
}
#screen-install .install-block { width: 100%; max-width: 340px; margin: 0 auto; }
.install-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-top: 8px;
}
.install-card h3 { margin: 0 0 8px; font-size: 15px; }
.install-card p { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.45; }
#screen-install h1, .desktop-gate h1 { margin: 16px 0 0; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 320px; margin: 0 auto; }
.hint { font-size: 13px; color: var(--muted); max-width: 300px; margin: 8px auto 0; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn.primary {
  background: linear-gradient(135deg, var(--ice), #0088cc);
  color: #001018;
}
.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.text { background: transparent; color: var(--muted); font-weight: 500; }
.btn.danger { background: #3a1515; color: #ffb4b4; }
.btn.full { width: 100%; }
.btn.cta-white { background: #fff; color: #000; padding: 16px; font-size: 16px; }
.btn:disabled { opacity: 0.45; }
.btn.pulse { animation: glow-pulse 2.4s ease-in-out infinite; }
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 176, 249, 0.35); }
  50% { box-shadow: 0 0 28px 4px rgba(0, 176, 249, 0.35); }
}

.auth-top { margin-bottom: 20px; }
.auth-top h2 { margin: 16px 0 6px; font-size: 24px; font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); text-align: left; }
.auth-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 14px 12px;
  font-size: 16px;
  outline: none;
}
.auth-form input:focus { border-color: var(--ice); }
.error { color: #ffb4b4; font-size: 13px; min-height: 18px; margin: 0; text-align: left; }
.foot { font-size: 13px; margin-top: 12px; }
.foot a { color: var(--ice-2); }

#screen-chat { padding: 0; padding-top: var(--safe-t); background: var(--bg); position: relative; }

.gpt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
  min-height: 52px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn.round { background: var(--surface); border-radius: 50%; }

.menu-lines {
  position: relative;
  width: 40px;
  height: 40px;
}
.menu-lines::before,
.menu-lines::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.menu-lines::before { top: 16px; width: 18px; }
.menu-lines::after { top: 22px; }

.pill-upgrade {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 176, 249, 0.35);
  background: linear-gradient(180deg, rgba(0, 176, 249, 0.12), rgba(0, 0, 0, 0.2));
  color: var(--ice-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin: 0 auto;
}
.pill-upgrade .spark { color: var(--ice); }

.messages {
  flex: 1;
  overflow: auto;
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.home-center {
  margin: auto 0;
  padding: 12px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 12px;
}
.quick-row:active { background: var(--surface); }
.quick-row svg { color: var(--muted); flex-shrink: 0; }

.promo-card {
  margin-top: 24px;
  padding: 20px 16px;
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}
.promo-card h3 { margin: 12px 0 6px; font-size: 17px; font-weight: 600; }
.promo-card p { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.promo-thumbs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}
.promo-thumbs span {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ice-dim), var(--surface-2));
  border: 1px solid var(--line);
}
.promo-card .btn { font-size: 14px; padding: 10px 20px; background: var(--surface-2); color: var(--text); }

.msg {
  max-width: 100%;
  font-size: 16px;
  line-height: 1.55;
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user {
  align-self: flex-end;
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(0, 80, 120, 0.55);
  border: 1px solid rgba(0, 176, 249, 0.2);
}

.img-gen {
  align-self: stretch;
  max-width: 100%;
  animation: fade 0.3s ease;
}
.img-gen-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}
.img-gen-canvas {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1;
  border-radius: 16px;
  background-color: #141414;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 10px 10px;
  overflow: hidden;
}
.img-gen-canvas::before,
.img-gen-canvas::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.55;
  animation: img-spark 2.4s ease-in-out infinite;
}
.img-gen-canvas::before {
  background: var(--ice);
  top: 18%;
  left: 12%;
}
.img-gen-canvas::after {
  background: #4aa8ff;
  bottom: 15%;
  right: 10%;
  animation-delay: 1.1s;
}
.img-gen-pct {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--ice-2);
  font-variant-numeric: tabular-nums;
}
@keyframes img-spark {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.45; }
  50% { transform: translate(8px, -6px) scale(1.15); opacity: 0.85; }
}

.msg.img-result {
  align-self: stretch;
  padding: 0;
  background: transparent;
  border: 0;
}
.msg.img-result .img-frame {
  width: min(100%, 320px);
  border-radius: 16px;
  overflow: hidden;
  background: #141414;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.msg.img-result img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  pointer-events: none;
}
.msg.img-result .img-tap-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.img-lightbox.hidden { display: none !important; }
.img-lightbox-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
#img-lightbox-img {
  max-width: 100%;
  max-height: min(72vh, 720px);
  border-radius: 12px;
  object-fit: contain;
}
.img-lightbox-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  width: min(100%, 360px);
}
.img-lightbox-actions .btn { flex: 1; }

.weather-card {
  margin-top: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1a1a1a 0%, #121212 100%);
  border: 1px solid var(--line);
  overflow: hidden;
  max-width: 100%;
}
.weather-card-head {
  padding: 16px 16px 8px;
}
.weather-place {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
}
.weather-now-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.weather-temp {
  font-size: 52px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.weather-temp small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
}
.weather-cond {
  font-size: 14px;
  color: var(--text);
  margin: 8px 0 0;
  max-width: 160px;
  text-align: right;
}
.weather-cond-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.weather-days {
  display: flex;
  gap: 6px;
  padding: 8px 12px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.weather-day {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 8px 6px;
  border-radius: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.weather-day.is-today {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.weather-day .d-icon { font-size: 18px; display: block; margin: 4px 0; }
.weather-day .d-hi { color: var(--text); font-weight: 600; }
.weather-day .d-lo { opacity: 0.65; }
.weather-chart-wrap {
  padding: 8px 12px 14px;
  border-top: 1px solid var(--line);
}
.weather-chart-title {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
}
.weather-chart svg {
  width: 100%;
  height: 88px;
  display: block;
}
.weather-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}
.msg.weather-result .weather-intro { margin-bottom: 4px; }
.msg.weather-result { padding: 4px 0 8px; }

.weather-loc-btn {
  margin-top: 10px;
  background: none;
  border: 0;
  color: var(--ice-2);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.msg.img-result .img-caption {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.55;
}
.msg.bot { align-self: stretch; padding: 4px 0; color: var(--text); }
.msg.bot.streaming { opacity: 0.95; }
.msg p { margin: 0 0 10px; }
.msg p:last-child { margin-bottom: 0; }
.msg pre {
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  overflow: auto;
  font-size: 13px;
  border: 1px solid var(--line);
}
.msg code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; background: var(--surface); padding: 2px 5px; border-radius: 4px; }

.typing {
  display: flex;
  gap: 5px;
  padding: 0 20px 6px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ice);
  animation: bounce 1s ease infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-5px); }
}

.gpt-composer {
  padding: 8px 12px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.composer-pill {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--surface);
  border-radius: 26px;
  padding: 6px 8px 6px 4px;
  min-height: 52px;
  border: 1px solid var(--line);
}
.composer-pill:focus-within { border-color: rgba(0, 176, 249, 0.35); }
.composer-form { flex: 1; min-width: 0; }
.icon-inline {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
#input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  max-height: 120px;
  resize: none;
  padding: 10px 4px;
  font-family: inherit;
}
#input::placeholder { color: var(--muted); }

.voice-btn {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--ice);
  color: #001018;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 176, 249, 0.4);
}
.voice-btn:disabled { opacity: 0.4; }
.voice-btn.has-text { background: var(--ice); }
.voice-btn svg path { fill: currentColor; }

#screen-chat.voice-active .gpt-composer { opacity: 0; pointer-events: none; height: 0; overflow: hidden; padding: 0; margin: 0; }
#screen-chat.voice-active .gpt-header { opacity: 0.35; }

.voice-mode {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  padding-bottom: calc(8px + var(--safe-b));
}
.voice-mode.hidden { display: none !important; }
.voice-mode:not(.hidden) { pointer-events: auto; }

.voice-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0 16px 12px;
  min-height: 0;
}
.voice-user-caption {
  align-self: flex-end;
  max-width: 88%;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(0, 80, 120, 0.55);
  border: 1px solid rgba(0, 176, 249, 0.25);
  font-size: 15px;
  line-height: 1.4;
}
.voice-ai-caption {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  min-height: 1.4em;
}
.voice-orb {
  align-self: center;
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  margin: 0 auto 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e8f7ff 0%, #7fd4ff 22%, #3aa8e8 45%, #1a6aa0 70%, #0a2a40 100%);
  box-shadow: 0 0 60px rgba(0, 176, 249, 0.45), inset 0 0 40px rgba(255, 255, 255, 0.15);
  filter: blur(0.2px);
  animation: voice-orb-idle 3.2s ease-in-out infinite;
}
.voice-orb[data-state="listening"] {
  animation: voice-orb-listen 1.1s ease-in-out infinite;
  box-shadow: 0 0 80px rgba(0, 176, 249, 0.65);
}
.voice-orb[data-state="thinking"] {
  animation: voice-orb-think 0.85s ease-in-out infinite;
  opacity: 0.92;
}
.voice-orb[data-state="speaking"] {
  animation: voice-orb-speak 0.65s ease-in-out infinite;
  box-shadow: 0 0 90px rgba(143, 216, 255, 0.75);
}
@keyframes voice-orb-idle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes voice-orb-listen {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.12); }
}
@keyframes voice-orb-think {
  0%, 100% { transform: scale(0.98); opacity: 0.85; }
  50% { transform: scale(1.02); opacity: 1; }
}
@keyframes voice-orb-speak {
  0%, 100% { transform: scale(1.02); }
  50% { transform: scale(1.08); }
}

.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 8px 10px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.voice-bar-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.voice-bar-type {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  text-align: left;
  padding: 10px 8px;
  cursor: pointer;
  font-family: inherit;
}
.voice-bar-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-weight: 500;
}
.voice-bar-btn.muted { opacity: 0.45; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 88vw);
  max-width: 480px;
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: calc(14px + var(--safe-t)) 16px calc(12px + var(--safe-b));
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  border-right: 1px solid var(--line);
}
.drawer[aria-hidden="true"] { transform: translateX(-102%); pointer-events: none; }

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.drawer-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
}
.nav-row:active { background: var(--surface); }

.drawer-section {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 6px;
  padding-left: 8px;
}

.chat-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.chat-item {
  border: 0;
  text-align: left;
  padding: 12px 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item.active { background: var(--surface); }

.drawer-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.fab-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ice);
  color: #001018;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  max-width: 480px;
  margin: 0 auto;
}
.backdrop.hidden { display: none !important; }

dialog.sheet-upgrade {
  border: 0;
  padding: 24px 20px calc(20px + var(--safe-b));
  margin: auto 0 0;
  max-width: 480px;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border-radius: 20px 20px 0 0;
  max-height: 92dvh;
  overflow: auto;
}

dialog.sheet-settings {
  border: 0;
  padding: 0;
  margin: 0 auto;
  max-width: 480px;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  border-radius: 0;
  overflow: hidden;
}
dialog.sheet-settings-full::backdrop { background: rgba(0, 0, 0, 0.85); }
dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.sheet-icon { text-align: center; margin: 8px 0 12px; }
.sheet-upgrade h2 { text-align: center; font-size: 22px; font-weight: 600; margin: 0 0 8px; }

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  text-align: left;
}
.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a9d8f, #1d6fd8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.profile-meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.profile-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-plan { font-size: 12px; color: var(--muted); }

.account-menu {
  position: fixed;
  left: 16px;
  bottom: calc(72px + var(--safe-b));
  z-index: 45;
  width: min(320px, calc(100vw - 32px));
  max-width: 480px;
  background: #2f2f2f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.account-menu.hidden { display: none !important; }
.account-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.account-menu-head:active { background: rgba(255, 255, 255, 0.06); }
.account-menu-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account-menu-id strong { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-chevron { color: var(--muted); font-size: 18px; margin-left: auto; }
.account-menu-divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 6px 4px; }
.account-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 11px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  text-align: left;
}
.account-menu-item:active { background: rgba(255, 255, 255, 0.06); }
.account-menu-danger { color: #ffb4b4; }
.ami-icon { width: 22px; text-align: center; opacity: 0.85; flex-shrink: 0; }

.settings-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + var(--safe-t)) 12px 10px;
  border-bottom: 1px solid var(--line);
}
.settings-back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.settings-search {
  flex: 1;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
.settings-layout {
  display: flex;
  height: calc(100dvh - 64px - var(--safe-t));
  min-height: 0;
}
.settings-nav {
  width: 38%;
  max-width: 140px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
}
.settings-nav-item.active { background: var(--surface); color: var(--text); }
.settings-nav-item.hidden-by-search { display: none !important; }
.settings-panels {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px calc(20px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}
.settings-panel h2 { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.settings-row select {
  border: 0;
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  max-width: 58%;
}
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.settings-toggle-row strong { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.muted.sm { font-size: 12px; line-height: 1.4; }
.settings-foot { margin-top: 20px; }
.settings-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
}
.settings-kv { font-size: 14px; margin: 0 0 10px; line-height: 1.5; }
.settings-link-row {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ice-2);
  text-decoration: none;
  font-size: 15px;
}
input.toggle {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #444;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
input.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
input.toggle:checked { background: var(--ice); }
input.toggle:checked::after { transform: translateX(20px); }

html.theme-light body { background: #f5f5f5; color: #111; }
html.theme-light .drawer, html.theme-light dialog.sheet-settings { background: #fff; color: #111; }
.composer-pill .icon-inline.hidden-by-pref { display: none !important; }
.sheet-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.plan-tabs {
  display: flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.plan-tab {
  flex: 1;
  border: 0;
  padding: 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.plan-tab[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
}

.compare-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.compare th, .compare td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.compare th { color: var(--muted); font-weight: 500; }
.compare th:last-child { color: var(--ice); }
.compare td:last-child { text-align: center; color: var(--ice); }
.compare td:nth-child(2) { text-align: center; color: var(--muted); }
.check { color: var(--ice); font-weight: 600; }
.dash { color: var(--muted); }

.sheet-foot { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.4; margin: 12px 0 0; }
.plan-line { font-size: 15px; color: var(--ice-2); margin: 8px 0 20px; }

.desktop-gate .qr-wrap {
  margin: 16px auto;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  width: fit-content;
}

.update-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + var(--safe-b));
  max-width: 456px;
  margin: 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid rgba(0, 176, 249, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.update-toast-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}
.update-toast-text strong { color: var(--text); font-size: 14px; }
.btn.sm { padding: 10px 14px; font-size: 13px; flex-shrink: 0; }
.icon-btn.sm { width: 32px; height: 32px; font-size: 18px; flex-shrink: 0; }

.offline-bar {
  background: #3a2a00;
  color: #ffd699;
  text-align: center;
  font-size: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 200, 100, 0.2);
}
.offline-bar.hidden { display: none !important; }
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.88);
  display: grid;
  place-items: center;
  padding: 24px;
}
.onboard-card {
  width: min(100%, 360px);
  background: var(--surface);
  border-radius: 20px;
  padding: 24px 20px;
  border: 1px solid var(--line);
}
.onboard-step { display: none; }
.onboard-step.active { display: block; }
.onboard-step h2 { margin: 0 0 10px; font-size: 22px; }
.onboard-step p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 15px; }
.onboard-actions { display: flex; gap: 10px; margin-top: 22px; }
.onboard-actions .btn { flex: 1; }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; opacity: 0.85; }
.msg-actions button {
  border: 0;
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
}
.msg-actions button.active { color: var(--ice-2); background: var(--ice-dim); }
.pre-wrap { position: relative; }
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.folder-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 4px 10px;
}
.folder-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.folder-chip.active { background: var(--ice-dim); color: var(--ice-2); }
.img-ctx-menu {
  position: fixed;
  z-index: 10002;
  background: #2f2f2f;
  border-radius: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  min-width: 160px;
}
.img-ctx-menu button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.referral-box { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

@media (min-width: 520px) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    left: 480px;
    background: #0a0a0a;
    z-index: 0;
  }
}
