:root {
  color-scheme: light;
  --bg: #eef7ff;
  --bg-deep: #dcecff;
  --surface: rgba(255, 255, 255, .74);
  --surface-strong: rgba(255, 255, 255, .92);
  --surface-blue: rgba(219, 239, 255, .68);
  --text: #071b32;
  --muted: #607086;
  --primary: #0067d8;
  --primary-2: #00a7ff;
  --primary-3: #103a78;
  --accent: #ffe760;
  --cyan: #7de7ff;
  --on-primary: #fff;
  --outline: rgba(11, 74, 138, .14);
  --outline-strong: rgba(0, 103, 216, .24);
  --shadow: 0 28px 90px rgba(0, 73, 150, .18);
  --soft-shadow: 0 16px 44px rgba(1, 55, 110, .11);
  --radius-xxl: 42px;
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --blur: blur(24px) saturate(1.16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: ui-rounded, "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(125, 231, 255, .54), transparent 29%),
    radial-gradient(circle at 86% 10%, rgba(0, 103, 216, .22), transparent 31%),
    radial-gradient(circle at 72% 86%, rgba(255, 231, 96, .20), transparent 26%),
    linear-gradient(135deg, #f7fbff 0%, #e9f6ff 36%, #dfeeff 100%);
  color: var(--text);
  overflow: auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(4px);
}
body::before {
  width: 48vw;
  height: 48vw;
  left: -18vw;
  bottom: -24vw;
  background: rgba(0, 167, 255, .22);
}
body::after {
  width: 36vw;
  height: 36vw;
  right: -12vw;
  top: -14vw;
  background: rgba(16, 58, 120, .12);
}

body.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

a { color: inherit; }
code {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  background: rgba(0, 103, 216, .10);
  border: 1px solid rgba(0, 103, 216, .12);
  border-radius: 10px;
  padding: 2px 7px;
  color: #003f91;
}

h1, h2, h3 { margin: 0; letter-spacing: -.05em; }
h1 { font-size: clamp(42px, 7.5vw, 82px); line-height: .92; }
h2 { font-size: clamp(22px, 3vw, 32px); }
h3 { font-size: clamp(24px, 4vw, 34px); }

button, .btn, textarea, input { font: inherit; }
button, .btn { -webkit-tap-highlight-color: transparent; }
button:focus-visible, .btn:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 4px solid rgba(0, 167, 255, .22);
  outline-offset: 3px;
}

.blue-stage,
.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 36px);
  overflow: auto;
}

.glass-card,
.expressive-card,
.auth-card,
.dragon-card {
  border: 1px solid var(--outline);
  background:
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(235,247,255,.68));
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.dragon-card {
  position: relative;
  overflow: hidden;
  width: min(1180px, 100%);
  min-height: min(740px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, .86fr);
  gap: clamp(20px, 4vw, 54px);
  align-items: center;
  border-radius: 52px;
  padding: clamp(26px, 5vw, 70px);
}

.hero-content,
.mascot-panel,
.admin-hero-content,
.admin-quick { position: relative; z-index: 2; }

.brand-row { display: flex; align-items: center; gap: 16px; }
.brand-row.compact { gap: 12px; }
.brand-row.compact strong { display: block; font-size: 15px; }
.brand-row.compact span { display: block; color: rgba(226, 243, 255, .76); font-size: 12px; margin-top: 2px; }
.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 22px 18px 24px 18px;
  color: white;
  font-weight: 950;
  letter-spacing: -1px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 24%),
    linear-gradient(135deg, var(--primary), var(--primary-2) 58%, #0d3a82);
  box-shadow: 0 18px 42px rgba(0, 103, 216, .28);
}
.brand-mark-ai { width: 64px; height: 64px; border-radius: 24px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero-text {
  max-width: 760px;
  margin: 28px 0;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.8;
  color: #243f61;
}

.hero-actions-row,
.auth-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
  font-weight: 850;
}
.btn:hover, button:hover { transform: translateY(-1px); }
.btn:active, button:active { transform: translateY(0) scale(.985); }
.btn.primary {
  color: white;
  background:
    radial-gradient(circle at 22% 10%, rgba(255,255,255,.35), transparent 28%),
    linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 42px rgba(0, 103, 216, .30);
}
.btn.tonal,
.btn.ghost {
  color: #053765;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--outline);
  box-shadow: 0 10px 28px rgba(0, 73, 150, .08);
}
.btn.danger { color: #8a1d2f; background: rgba(255, 219, 224, .74); border: 1px solid rgba(138, 29, 47, .12); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn:disabled, button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0;
}
.hero-grid > div,
.check-list > div {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--outline);
  box-shadow: 0 12px 32px rgba(0, 73, 150, .08);
}
.blue-features > div::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  right: -32px;
  top: -32px;
  border-radius: 999px;
  background: rgba(0, 167, 255, .12);
}
.feature-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 14px;
  color: white;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-3), var(--primary-2));
}
.hero-grid b,
.check-list b { display: block; margin-bottom: 8px; }
.hero-grid span,
.check-list span,
.muted { color: var(--muted); }
.small { font-size: 13px; }
.callback-note { line-height: 1.7; }

.mascot-panel {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: center;
}
.mascot-frame {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border-radius: 42px;
  background:
    linear-gradient(180deg, rgba(245,251,255,.72), rgba(217,240,255,.58)),
    radial-gradient(circle at 70% 20%, rgba(255,231,96,.22), transparent 24%);
  border: 1px solid rgba(0, 103, 216, .16);
  box-shadow: 0 24px 72px rgba(0, 78, 150, .18);
}
.mascot-frame::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(0, 167, 255, .56);
  border-radius: 34px;
  z-index: 2;
  pointer-events: none;
}
.mascot-frame img {
  position: absolute;
  inset: 0;
  width: 118%;
  height: 118%;
  object-fit: cover;
  object-position: 42% 30%;
  transform: translate(-10%, -5%);
}
.preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 26px;
}
.preview-card b,
.preview-card span { display: block; }
.preview-card span { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.preview-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary-2));
  box-shadow: 0 0 0 8px rgba(0, 167, 255, .10);
}

.ambient,
.orb {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(2px);
  opacity: .72;
}
.ambient-a,
.orb-a { right: 8%; top: 8%; width: 140px; height: 140px; background: rgba(0, 167, 255, .22); animation: float 7s ease-in-out infinite; }
.ambient-b,
.orb-b { right: 38%; bottom: 10%; width: 110px; height: 110px; background: rgba(255, 231, 96, .22); animation: float 9s ease-in-out infinite reverse; }
.ambient-c { left: 8%; bottom: 8%; width: 170px; height: 170px; background: rgba(16, 58, 120, .10); animation: float 11s ease-in-out infinite; }
@keyframes float { 50% { transform: translate3d(0, 18px, 0) scale(1.04); } }

/* Auth fallback pages */
.auth-card {
  position: relative;
  overflow: hidden;
  width: min(540px, 100%);
  border-radius: 38px;
  padding: 38px;
  text-align: center;
}
.auth-card.wide { width: min(760px, 100%); text-align: left; }
.auth-card .brand-mark { margin: 0 auto 18px; }
.alert, .success {
  padding: 14px 16px;
  border-radius: 18px;
  margin: 18px 0;
}
.alert { background: rgba(255, 219, 224, .76); color: #8b1630; }
.success { background: rgba(205, 244, 226, .76); color: #006d43; }
.check-list { display: grid; gap: 10px; margin: 18px 0; }
.check-list > div { display: flex; justify-content: space-between; gap: 16px; }

/* Main chat */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 326px 1fr;
  gap: 16px;
  padding: 16px;
}
.dragon-chat {
  background:
    radial-gradient(circle at 18% 5%, rgba(0, 167, 255, .20), transparent 24%),
    radial-gradient(circle at 90% 18%, rgba(255, 231, 96, .15), transparent 20%),
    transparent;
}
.sidebar {
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 34px;
  color: white;
  background:
    radial-gradient(circle at 20% 8%, rgba(125,231,255,.30), transparent 22%),
    linear-gradient(165deg, #082855 0%, #063d83 48%, #03162f 100%);
  box-shadow: 0 24px 70px rgba(0, 39, 88, .28);
  border: 1px solid rgba(255,255,255,.16);
}
.sidebar-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: 24px;
  border-radius: 999px;
  background: rgba(0, 167, 255, .22);
  filter: blur(2px);
  pointer-events: none;
}
.sidebar-top,
.sidebar-bottom { position: relative; z-index: 1; padding: 18px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }

.mini-mascot-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px 14px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
}
.mini-mascot-card img {
  width: 56px;
  height: 56px;
  border-radius: 19px;
  object-fit: cover;
  object-position: 50% 30%;
  box-shadow: 0 12px 28px rgba(0,0,0,.20);
}
.mini-mascot-card b,
.mini-mascot-card span { display: block; }
.mini-mascot-card span { color: rgba(226, 243, 255, .74); font-size: 12px; margin-top: 3px; }

.new-chat {
  position: relative;
  z-index: 1;
  margin: 0 18px 14px;
  min-height: 52px;
  border: 0;
  border-radius: 22px;
  color: #042449;
  background:
    radial-gradient(circle at 20% 8%, rgba(255,255,255,.66), transparent 28%),
    linear-gradient(135deg, var(--cyan), var(--accent));
  box-shadow: 0 16px 34px rgba(0, 167, 255, .22);
  cursor: pointer;
  font-weight: 950;
}
.new-chat span { font-weight: 950; }
.conversation-list {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px 10px;
}
.conversation-list::-webkit-scrollbar,
.messages::-webkit-scrollbar { width: 10px; height: 10px; }
.conversation-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb { background: rgba(0, 103, 216, .18); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.conversation-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 13px 12px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.86);
  cursor: pointer;
}
.conversation-item:hover { background: rgba(255,255,255,.10); }
.conversation-item.active {
  background: rgba(255,255,255,.16);
  border-color: rgba(125,231,255,.28);
  color: white;
}
.conversation-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary-2));
  flex: 0 0 auto;
  box-shadow: 0 0 0 5px rgba(125,231,255,.08);
}
.conversation-item .meta { min-width: 0; }
.conversation-item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.conversation-item span { color: rgba(226,243,255,.68); font-size: 12px; }
.sidebar-bottom { border-top: 1px solid rgba(255,255,255,.12); }
.user-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.12);
}
.user-card img,
.user-fallback {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  flex: 0 0 auto;
}
.user-card img { object-fit: cover; background: rgba(255,255,255,.12); }
.user-fallback {
  display: grid;
  place-items: center;
  color: #05224a;
  font-weight: 950;
  background: linear-gradient(135deg, var(--cyan), var(--accent));
}
.user-fallback.small { width: 36px; height: 36px; font-size: 14px; }
.user-card b,
.user-card span { display: block; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card span { margin-top: 2px; font-size: 12px; color: rgba(226,243,255,.70); }
.logout-link {
  display: block;
  margin: 12px 12px 0;
  color: rgba(226,243,255,.72);
  text-decoration: none;
  font-size: 13px;
}
.logout-link:hover { color: white; }
.admin-entry {
  border: 1px solid rgba(125, 231, 255, .28);
  background: rgba(125, 231, 255, .12);
  color: white;
  border-radius: 18px;
  padding: 10px 12px;
  text-align: center;
  text-decoration: none;
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border-radius: 34px;
  overflow: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 30px;
  box-shadow: var(--soft-shadow);
}
.title-stack { min-width: 0; }
#chatTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.status-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: #003f91;
  background: rgba(125, 231, 255, .20);
  border: 1px solid rgba(0, 103, 216, .12);
  font-size: 13px;
  font-weight: 850;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--outline);
  color: #063d83;
  cursor: pointer;
}
.mobile-only { display: none; }
.notice-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 6px 0;
  padding: 12px 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(0,103,216,.10), rgba(125,231,255,.16));
  color: #254764;
  font-size: 13px;
  border: 1px solid rgba(0,103,216,.10);
}
.notice-strip span { color: var(--primary); font-weight: 950; }
.notice-strip p { margin: 0; line-height: 1.6; }
.messages {
  min-height: 0;
  overflow: auto;
  padding: 24px 8px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.empty-state {
  position: relative;
  overflow: hidden;
  margin: auto;
  max-width: 720px;
  text-align: center;
  padding: 34px;
  border-radius: 40px;
  background: rgba(255,255,255,.60);
  border: 1px solid var(--outline);
  box-shadow: var(--soft-shadow);
}
.empty-state::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -86px;
  bottom: -110px;
  border-radius: 999px;
  background: rgba(0, 167, 255, .12);
  pointer-events: none;
}
.empty-mascot {
  width: 118px;
  height: 118px;
  margin: 0 auto 14px;
  overflow: hidden;
  border-radius: 36px;
  background: #e9f6ff;
  border: 1px solid rgba(0,103,216,.16);
  box-shadow: 0 18px 42px rgba(0, 73, 150, .14);
}
.empty-mascot img { width: 142%; height: 142%; object-fit: cover; object-position: 48% 22%; transform: translate(-15%, -10%); }
.empty-glow {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: none;
  place-items: center;
  border-radius: 28px;
  color: white;
  font-size: 34px;
  background: conic-gradient(from 130deg, var(--primary), var(--primary-2), var(--accent), var(--primary));
  box-shadow: 0 22px 52px rgba(0, 103, 216, .22);
}
.empty-state p { color: var(--muted); line-height: 1.7; }
.prompt-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.prompt-chips button {
  padding: 10px 13px;
  border-radius: 999px;
  color: #053765;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--outline);
  cursor: pointer;
}
.prompt-chips button:hover { background: #fff; }
.message-row { display: flex; gap: 12px; align-items: flex-start; }
.message-row.user { justify-content: flex-end; }
.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 950;
  background: linear-gradient(135deg, var(--primary-3), var(--primary-2));
  box-shadow: 0 10px 22px rgba(0, 73, 150, .16);
}
.message-row.user .avatar {
  order: 2;
  color: #05224a;
  background: linear-gradient(135deg, var(--cyan), var(--accent));
}
.bubble {
  max-width: min(820px, 80%);
  padding: 16px 18px;
  border-radius: 26px;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--outline);
  box-shadow: 0 8px 24px rgba(0, 52, 110, .06);
  line-height: 1.78;
  overflow-wrap: anywhere;
}
.message-row.assistant .bubble { border-top-left-radius: 10px; }
.message-row.user .bubble {
  color: white;
  background:
    radial-gradient(circle at 14% 8%, rgba(255,255,255,.22), transparent 24%),
    linear-gradient(135deg, var(--primary), var(--primary-3));
  border-color: transparent;
  border-top-right-radius: 10px;
}
.bubble pre {
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #071b32;
  color: #eaf7ff;
  line-height: 1.6;
}
.bubble pre code { background: transparent; border: 0; padding: 0; color: inherit; }
.bubble a { color: #005fc9; font-weight: 800; }
.message-row.user .bubble a { color: #fff; }
.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: pulse 1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 50% { transform: translateY(-4px); opacity: .55; } }

.composer { padding: 0 0 4px; }
.composer-box {
  border-radius: 30px;
  border: 1px solid var(--outline);
  box-shadow: 0 18px 48px rgba(0, 73, 150, .11);
  padding: 12px;
}
textarea {
  width: 100%;
  max-height: 190px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.65;
  padding: 8px 10px;
}
textarea::placeholder { color: #7f90a5; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hint { color: var(--muted); font-size: 12px; padding-left: 10px; }
.send-btn {
  min-width: 94px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  color: white;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.36), transparent 26%),
    linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
  font-weight: 950;
  box-shadow: 0 14px 32px rgba(0, 103, 216, .24);
}

/* Admin console */
.admin-shell {
  min-height: 100vh;
  padding: 28px;
  overflow: auto;
  background:
    radial-gradient(circle at 12% 10%, rgba(125, 231, 255, .38), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(0, 103, 216, .20), transparent 25%),
    linear-gradient(135deg, #f8fcff 0%, #e9f6ff 45%, #dfeeff 100%);
}
.admin-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin: 0 auto 22px;
  max-width: 1320px;
  border-radius: 38px;
}
.admin-hero .hero-text { max-width: 840px; margin-bottom: 0; }
.admin-quick { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.admin-grid {
  max-width: 1320px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 18px;
}
.admin-card {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
  border: 1px solid var(--outline);
  border-radius: 28px;
  box-shadow: 0 22px 70px rgba(0, 73, 150, .10);
  padding: 22px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-title h2 { margin: 2px 0 0; font-size: 22px; }
.admin-form { display: grid; gap: 14px; }
.admin-form label,
.quota-inputs label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.admin-form input,
.search-form input,
.admin-table input,
.admin-table textarea {
  width: 100%;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, .86);
  border-radius: 16px;
  padding: 11px 13px;
  outline: none;
  color: var(--text);
  font: inherit;
}
.admin-form input:focus,
.search-form input:focus,
.admin-table input:focus,
.admin-table textarea:focus {
  border-color: rgba(0, 103, 216, .62);
  box-shadow: 0 0 0 4px rgba(0, 167, 255, .13);
}
.form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.config-box {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(219, 239, 255, .74);
  border: 1px solid var(--outline);
  margin-bottom: 12px;
}
.config-box b { font-size: 18px; color: #003f91; word-break: break-all; }
.config-box span { color: var(--muted); line-height: 1.55; }
.config-box.soft { background: rgba(255, 255, 255, .72); }
.user-manager { max-width: 1320px; margin: 0 auto; }
.sticky-title {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  padding: 4px 0 12px;
  border-radius: 20px;
}
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form input { min-width: min(320px, 55vw); }
.admin-message {
  margin: 0 0 14px;
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(219, 239, 255, .76);
  color: #003f91;
}
.admin-message.success { background: rgba(205, 244, 226, .76); color: #1b5e20; }
.admin-message.error { background: rgba(255, 218, 214, .82); color: #8c1d18; }
.admin-table-wrap { overflow-x: auto; border-radius: 22px; border: 1px solid var(--outline); }
.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, .66);
}
.admin-table th,
.admin-table td {
  text-align: left;
  vertical-align: top;
  padding: 14px;
  border-bottom: 1px solid rgba(0, 103, 216, .10);
}
.admin-table th {
  color: #33546e;
  font-size: 12px;
  background: rgba(219, 239, 255, .56);
}
.admin-user-cell { display: flex; gap: 10px; align-items: flex-start; min-width: 260px; }
.admin-user-cell img { width: 38px; height: 38px; border-radius: 15px; object-fit: cover; }
.admin-user-cell b,
.admin-user-cell span,
.admin-user-cell small,
.admin-user-cell em { display: block; }
.admin-user-cell span,
.admin-user-cell small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.admin-user-cell em {
  width: fit-content;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-style: normal;
  color: #042449;
  background: rgba(255, 231, 96, .45);
}
.switch-line { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px; white-space: nowrap; }
.switch-line input { width: auto; }
.quota-inputs { display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; }
.quota-inputs input { padding: 8px; }
.usage-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.usage-pills span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 103, 216, .10);
  color: #003f91;
  font-size: 12px;
  font-weight: 800;
}
.admin-table textarea { min-height: 72px; resize: vertical; }
.alert-cell { color: #8c1d18; background: rgba(255, 218, 214, .6); }

@media (max-width: 980px) {
  body { overflow: auto; }
  .dragon-card { grid-template-columns: 1fr; min-height: auto; }
  .mascot-frame { min-height: 360px; }
  .hero-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-hero { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 860px) {
  .app-shell { display: block; padding: 0; height: 100vh; }
  .sidebar {
    position: fixed;
    inset: 10px auto 10px 10px;
    width: min(340px, calc(100vw - 20px));
    z-index: 20;
    transform: translateX(-110%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .chat-panel { height: 100vh; border-radius: 0; border: 0; padding: 10px; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 14px; border-radius: 24px; }
  .topbar-actions { display: none; }
  .notice-strip { margin: 10px 0 0; }
  .messages { padding: 14px 0; }
  .composer { padding-bottom: 0; }
  .bubble { max-width: 86%; }
  #chatTitle { max-width: 70vw; }
  .empty-state { padding: 24px 16px; }
}

@media (max-width: 560px) {
  .blue-stage, .landing-shell { padding: 10px; }
  .dragon-card { border-radius: 34px; padding: 24px; }
  .hero-brand { align-items: flex-start; }
  .brand-mark-ai { width: 54px; height: 54px; }
  .mascot-frame { min-height: 300px; border-radius: 30px; }
  .mascot-frame::before { inset: 10px; border-radius: 24px; }
  .hero-actions-row .btn { width: 100%; }
  .composer-actions { align-items: stretch; flex-direction: column; }
  .send-btn { width: 100%; }
  .hint { padding-left: 8px; }
  .admin-shell { padding: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .section-title { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
  .search-form input { min-width: 0; flex: 1; }
}

/* 2026-04-27 UI polish: compressed visual asset + more natural blue Material 3 Expressive motion */
body {
  background-size: 130% 130%;
  animation: pageAurora 24s ease-in-out infinite alternate;
}

body::before { animation: slowBubble 18s ease-in-out infinite alternate; }
body::after { animation: slowBubble 22s ease-in-out infinite alternate-reverse; }

.dragon-card {
  isolation: isolate;
  background:
    linear-gradient(150deg, rgba(255,255,255,.94), rgba(236,248,255,.72) 44%, rgba(222,240,255,.64)),
    radial-gradient(circle at 74% 18%, rgba(0,167,255,.12), transparent 28%);
}

.dragon-card::before,
.dragon-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.dragon-card::before {
  width: 520px;
  height: 520px;
  right: -220px;
  top: -220px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(125,231,255,.34), transparent 58%),
    conic-gradient(from 80deg, transparent, rgba(0,103,216,.18), transparent 34%);
  animation: haloRotate 28s linear infinite;
}

.dragon-card::after {
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(115deg, transparent 0 30%, rgba(255,255,255,.38) 44%, transparent 58% 100%);
  transform: translateX(-80%);
  animation: glassSheen 9s cubic-bezier(.2,.7,.2,1) infinite;
  opacity: .52;
  mix-blend-mode: screen;
}

.drift-line {
  position: absolute;
  z-index: 1;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(0,167,255,.48), rgba(255,231,96,.38), transparent);
  pointer-events: none;
  filter: blur(.2px);
}
.line-a { width: 34%; left: 8%; top: 17%; animation: driftLine 10s ease-in-out infinite; }
.line-b { width: 28%; right: 8%; bottom: 18%; animation: driftLine 12s ease-in-out infinite reverse; }

.sparkle {
  position: absolute;
  z-index: 3;
  color: rgba(0, 126, 232, .72);
  text-shadow: 0 0 24px rgba(125,231,255,.65);
  pointer-events: none;
  animation: sparkleFloat 5.5s ease-in-out infinite;
}
.sparkle-a { left: 47%; top: 18%; font-size: 20px; }
.sparkle-b { right: 11%; bottom: 27%; font-size: 26px; animation-delay: -2s; }

.brand-mark {
  position: relative;
  animation: markBreathe 6s ease-in-out infinite;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  background: rgba(125,231,255,.18);
  z-index: -1;
  transform: scale(.82);
  animation: softPulse 3.6s ease-in-out infinite;
}

.hero-grid > div {
  transform: translateZ(0);
  animation: cardFloat 7s ease-in-out infinite;
}
.hero-grid > div:nth-child(2) { animation-delay: -1.4s; }
.hero-grid > div:nth-child(3) { animation-delay: -2.8s; }

.hero-grid > div:hover,
.prompt-chips button:hover,
.conversation-item:hover,
.admin-card:hover {
  box-shadow: 0 18px 46px rgba(0, 73, 150, .13);
}

.mascot-frame {
  background:
    radial-gradient(circle at 68% 14%, rgba(125,231,255,.36), transparent 24%),
    radial-gradient(circle at 32% 82%, rgba(255,231,96,.20), transparent 22%),
    linear-gradient(180deg, rgba(245,251,255,.76), rgba(214,239,255,.60));
}
.mascot-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 58% 26%, rgba(255,255,255,.34), transparent 12%),
    linear-gradient(115deg, transparent 0 54%, rgba(255,255,255,.30) 63%, transparent 72% 100%);
  transform: translateX(-48%);
  animation: mascotLight 8.5s ease-in-out infinite;
}
.mascot-frame img {
  will-change: transform;
  animation: mascotDrift 12s ease-in-out infinite;
}
.preview-card { animation: panelBreath 8s ease-in-out infinite; }
.preview-dot { animation: dotOrbit 4.8s ease-in-out infinite; }

.app-shell { position: relative; isolation: isolate; overflow: hidden; }
.chat-orb {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(1px);
  opacity: .55;
}
.chat-orb-a {
  width: 260px;
  height: 260px;
  right: 18px;
  top: 92px;
  background: rgba(0,167,255,.16);
  animation: slowBubble 16s ease-in-out infinite alternate;
}
.chat-orb-b {
  width: 220px;
  height: 220px;
  left: 286px;
  bottom: -72px;
  background: rgba(255,231,96,.14);
  animation: slowBubble 20s ease-in-out infinite alternate-reverse;
}
.sidebar,
.chat-panel { position: relative; z-index: 1; }
.sidebar::after {
  content: "";
  position: absolute;
  left: -60px;
  bottom: 20%;
  width: 170px;
  height: 170px;
  border-radius: 999px;
  background: rgba(125,231,255,.10);
  animation: slowBubble 12s ease-in-out infinite alternate;
}

.mini-mascot-card,
.user-card,
.conversation-item,
.topbar,
.composer-box,
.empty-state,
.message-row .bubble {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.empty-state {
  animation: panelBreath 9s ease-in-out infinite;
}
.empty-mascot img { animation: mascotMini 11s ease-in-out infinite; }
.prompt-chips button {
  animation: chipBreathe 7s ease-in-out infinite;
}
.prompt-chips button:nth-child(2) { animation-delay: -1.8s; }
.prompt-chips button:nth-child(3) { animation-delay: -3.4s; }

.notice-strip {
  background:
    linear-gradient(135deg, rgba(0,103,216,.10), rgba(125,231,255,.17)),
    linear-gradient(90deg, transparent, rgba(255,255,255,.32), transparent);
  background-size: auto, 220% 100%;
  animation: noticeFlow 8s ease-in-out infinite;
}

.send-btn,
.new-chat,
.btn.primary {
  background-size: 160% 160%;
  animation: blueButtonFlow 7s ease-in-out infinite alternate;
}

.message-row.assistant .avatar { animation: avatarWake 5s ease-in-out infinite; }
.typing span { box-shadow: 0 0 12px rgba(0,167,255,.35); }

.admin-shell { background-size: 130% 130%; animation: pageAurora 24s ease-in-out infinite alternate; }
.admin-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 36%, rgba(255,255,255,.38) 48%, transparent 61% 100%);
  transform: translateX(-78%);
  animation: glassSheen 10s ease-in-out infinite;
  pointer-events: none;
}
.admin-card { transition: transform .2s ease, box-shadow .2s ease; }
.admin-card:hover { transform: translateY(-2px); }

@keyframes pageAurora {
  0% { background-position: 0% 35%; }
  100% { background-position: 100% 65%; }
}
@keyframes slowBubble {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(24px,-18px,0) scale(1.06); }
}
@keyframes haloRotate {
  to { transform: rotate(360deg); }
}
@keyframes glassSheen {
  0%, 32% { transform: translateX(-84%); opacity: 0; }
  46% { opacity: .62; }
  68%, 100% { transform: translateX(84%); opacity: 0; }
}
@keyframes driftLine {
  0%, 100% { transform: translateX(-14px) scaleX(.86); opacity: .26; }
  50% { transform: translateX(18px) scaleX(1.08); opacity: .64; }
}
@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(.96); opacity: .45; }
  50% { transform: translateY(-16px) rotate(12deg) scale(1.12); opacity: .92; }
}
@keyframes markBreathe {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-3px) rotate(1deg); }
}
@keyframes softPulse {
  0%, 100% { opacity: .22; transform: scale(.82); }
  50% { opacity: .56; transform: scale(1.06); }
}
@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes mascotLight {
  0%, 24% { transform: translateX(-72%); opacity: 0; }
  44% { opacity: .72; }
  72%, 100% { transform: translateX(72%); opacity: 0; }
}
@keyframes mascotDrift {
  0%, 100% { transform: translate(-10%, -5%) scale(1.005); }
  50% { transform: translate(-8%, -6.8%) scale(1.035); }
}
@keyframes mascotMini {
  0%, 100% { transform: translate(-15%, -10%) scale(1); }
  50% { transform: translate(-12%, -12%) scale(1.05); }
}
@keyframes panelBreath {
  0%, 100% { transform: translateY(0); box-shadow: var(--soft-shadow); }
  50% { transform: translateY(-3px); box-shadow: 0 20px 52px rgba(0,73,150,.13); }
}
@keyframes dotOrbit {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.08); }
}
@keyframes chipBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes noticeFlow {
  0%, 100% { background-position: 0 0, 0% 0; }
  50% { background-position: 0 0, 100% 0; }
}
@keyframes blueButtonFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@keyframes avatarWake {
  0%, 100% { box-shadow: 0 10px 22px rgba(0,73,150,.16); }
  50% { box-shadow: 0 10px 30px rgba(0,167,255,.28); }
}

@media (max-width: 980px) {
  .dragon-card { gap: 24px; padding: clamp(22px, 5vw, 44px); }
  .mascot-panel { order: -1; }
  .mascot-frame img { width: 110%; height: 110%; transform: translate(-5%, -4%); }
  @keyframes mascotDrift {
    0%, 100% { transform: translate(-5%, -4%) scale(1.005); }
    50% { transform: translate(-3%, -6%) scale(1.03); }
  }
}

@media (max-width: 860px) {
  .app-shell { overflow: hidden; }
  .chat-orb-a { right: -90px; top: 80px; width: 220px; height: 220px; }
  .chat-orb-b { left: -90px; bottom: -90px; width: 210px; height: 210px; }
  .topbar { position: sticky; top: 0; z-index: 5; }
  .notice-strip { font-size: 12px; }
  .notice-strip code { display: inline-block; margin-top: 2px; }
}

@media (max-width: 560px) {
  body.auth-page { padding: 12px; }
  .dragon-card { min-height: calc(100vh - 20px); border-radius: 30px; }
  h1 { font-size: clamp(38px, 13vw, 58px); }
  .hero-text { font-size: 16px; line-height: 1.75; }
  .hero-grid > div { padding: 16px; }
  .mascot-panel { gap: 12px; }
  .preview-card { align-items: flex-start; }
  .notice-strip { display: none; }
  .messages { gap: 12px; }
  .bubble { max-width: 90%; padding: 14px 15px; border-radius: 22px; }
  .message-row { gap: 9px; }
  .avatar { width: 32px; height: 32px; border-radius: 13px; font-size: 12px; }
  .empty-mascot { width: 92px; height: 92px; border-radius: 30px; }
  .prompt-chips { justify-content: stretch; }
  .prompt-chips button { width: 100%; }
  textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
