﻿* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #16191f;
  --side: #12151a;
  --panel: #1d2129;
  --panel2: #262b35;
  --line: #2c323d;
  --text: #e9edf4;
  --muted: #98a1b2;
  --accent: #a78bfa;
  --accent2: #22d3ee;
  --danger: #f87171;
  --ok: #34d399;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --side: #eef1f7;
  --panel: #ffffff;
  --panel2: #e9edf5;
  --line: #dbe1ec;
  --text: #1b2130;
  --muted: #667085;
  --accent: #7c5cf5;
  --accent2: #0891b2;
  --shadow: 0 18px 50px rgba(23, 32, 54, 0.12);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Krow Sans", "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.auth-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(167, 139, 250, 0.18), transparent 70%),
    radial-gradient(500px 400px at 85% 90%, rgba(34, 211, 238, 0.14), transparent 70%),
    var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

.auth-glow {
  position: absolute;
  width: min(520px, 100vw);
  height: min(520px, 100vw);
  border-radius: 50%;
  filter: blur(120px);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.35), rgba(34, 211, 238, 0.25));
  opacity: 0.5;
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 28px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise 0.35s ease;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(124, 92, 245, 0.35);
}

.brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--panel2);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  padding: 9px 0;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  transition: 0.18s;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.16);
}

select,
.field select {
  width: 100%;
  padding: 11px 34px 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background-color: var(--panel2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a1b2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.16);
}

select option {
  background: var(--panel);
  color: var(--text);
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  cursor: pointer;
}

.check input {
  margin: 3px 0 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex: none;
}

.btn-primary {
  margin-top: 4px;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 10px 24px rgba(124, 92, 245, 0.32);
  transition: transform 0.12s, filter 0.18s;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.form-error {
  min-height: 18px;
  font-size: 13px;
  color: var(--danger);
}

.auth-note {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.auth-legal {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  font-size: 12px;
}

.auth-legal a {
  color: var(--muted);
}

.auth-legal a:hover {
  color: var(--accent);
}

.app {
  display: grid;
  grid-template-columns: 276px 1fr;
  height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 12px 12px;
  background: var(--side);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 6px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.logo-sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.btn-new {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
  overflow: hidden;
  isolation: isolate;
  transition: 0.18s;
}

.btn-new-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.9),
    0 0 14px rgba(139, 92, 246, 0.55),
    0 0 30px rgba(34, 211, 238, 0.28);
  transition: opacity 0.25s ease;
}

.btn-new:hover .btn-new-glow {
  opacity: 1;
}

.bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.btn-new:hover .bubbles {
  opacity: 1;
}

.bubbles i {
  position: absolute;
  bottom: -12px;
  left: var(--x, 20%);
  width: var(--s, 5px);
  height: var(--s, 5px);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff, rgba(139, 92, 246, 0.55) 72%);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
  opacity: 0;
  animation: bubble-rise var(--d, 3.8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  animation-play-state: paused;
}

.btn-new:hover .bubbles i {
  animation-play-state: running;
}

.bubbles i:nth-child(1) { --x: 8%; --s: 6px; --d: 3.4s; --delay: 0s; --sway: 6px; }
.bubbles i:nth-child(2) { --x: 22%; --s: 4px; --d: 4.2s; --delay: 0.8s; --sway: -5px; }
.bubbles i:nth-child(3) { --x: 37%; --s: 5px; --d: 3.8s; --delay: 1.6s; --sway: 4px; }
.bubbles i:nth-child(4) { --x: 52%; --s: 7px; --d: 4.6s; --delay: 0.3s; --sway: -6px; }
.bubbles i:nth-child(5) { --x: 66%; --s: 4px; --d: 3.6s; --delay: 2.1s; --sway: 5px; }
.bubbles i:nth-child(6) { --x: 81%; --s: 5px; --d: 4s; --delay: 1.1s; --sway: -4px; }
.bubbles i:nth-child(7) { --x: 92%; --s: 3px; --d: 3.2s; --delay: 2.6s; --sway: 3px; }
.bubbles i:nth-child(8) { --x: 15%; --s: 7px; --d: 4.4s; --delay: 0.5s; --sway: -5px; }
.bubbles i:nth-child(9) { --x: 45%; --s: 6px; --d: 3.9s; --delay: 1.3s; --sway: 6px; }
.bubbles i:nth-child(10) { --x: 74%; --s: 8px; --d: 4.8s; --delay: 1.9s; --sway: -3px; }

@keyframes bubble-rise {
  0% { transform: translate3d(0, 0, 0) scale(0.45); opacity: 0; }
  10% { opacity: 0.95; }
  72% { opacity: 0.7; }
  100% { transform: translate3d(var(--sway, 0px), -42px, 0) scale(1); opacity: 0; }
}

.btn-new > svg,
.btn-new-label {
  position: relative;
  z-index: 1;
}

.btn-new:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-new svg {
  width: 17px;
  height: 17px;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -4px;
  padding: 0 4px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chat-item:hover {
  background: var(--panel);
  color: var(--text);
}

.chat-item.active {
  background: var(--panel2);
  color: var(--text);
}

[data-theme="light"] .chat-item.active {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.chat-item .title {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.chat-item .del {
  opacity: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.chat-item:hover .del,
.chat-item.active .del {
  opacity: 1;
}

.chat-item .del:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}

.chat-item .del svg {
  width: 14px;
  height: 14px;
}

.chat-empty {
  padding: 10px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.sidebar-bottom {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coins {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13.5px;
  font-weight: 600;
  justify-content: center;
}

.coins:hover {
  border-color: var(--accent);
}

.coins svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  flex: none;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: 0.15s;
  flex: none;
}

.icon-btn:hover {
  background: var(--panel2);
  color: var(--text);
}

.menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 78px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 20;
  animation: rise 0.15s ease;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
}

.menu button:hover {
  background: var(--panel2);
}

.menu button.danger {
  color: var(--danger);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}

.chat-title {
  font-size: 15px;
  font-weight: 600;
  max-width: 52vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-sub {
  font-size: 12px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--panel);
  white-space: nowrap;
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  animation: pulse 1.4s infinite;
}

.status.ready .dot {
  background: var(--ok);
  animation: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 8px;
  scroll-behavior: smooth;
}

.empty {
  max-width: 660px;
  margin: 6vh auto 0;
  text-align: center;
  animation: rise 0.4s ease;
}

.empty-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(124, 92, 245, 0.3);
  margin-bottom: 18px;
}

.empty h1 {
  margin: 0 0 8px;
  font-size: 27px;
  letter-spacing: -0.2px;
}

.empty p {
  margin: 0 auto 26px;
  max-width: 460px;
  color: var(--muted);
  font-size: 14.5px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}

.card {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 600;
  transition: 0.18s;
}

.card span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(124, 92, 245, 0.14);
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto 22px;
  animation: rise 0.22s ease;
}

.msg .avatar {
  margin-top: 2px;
}

.avatar-img {
  width: 32px;
  height: 32px;
  flex: none;
  margin-top: 2px;
}

.avatar-img img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: block;
}

.msg.user {
  flex-direction: row-reverse;
}

.msg.user .bubble {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  max-width: 78%;
}

.msg.assistant .body {
  flex: 1;
  min-width: 0;
}

.content {
  overflow-wrap: anywhere;
}

.bubble-text,
.content,
.content * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.content img,
.content video,
.content canvas,
.content svg {
  max-width: 100%;
  height: auto;
}

.content pre {
  max-width: 100%;
  overflow-x: auto;
}

.content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.content p {
  margin: 0 0 10px;
}

.content p:last-child {
  margin-bottom: 0;
}

.content h2,
.content h3,
.content h4 {
  margin: 16px 0 8px;
  line-height: 1.3;
}

.content h2 {
  font-size: 18px;
}

.content h3 {
  font-size: 16px;
}

.content h4 {
  font-size: 15px;
}

.content ul,
.content ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.content li {
  margin: 3px 0;
}

.content code {
  background: var(--panel2);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.meta {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: blink 0.9s steps(2) infinite;
}

.dots {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.1s infinite;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.msg-error {
  color: var(--danger);
  font-size: 13.5px;
}

.composer-wrap {
  padding: 10px 24px 16px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14), 0 8px 30px rgba(0, 0, 0, 0.18);
}

.composer textarea {
  flex: 1;
  min-height: 36px;
  max-height: 180px;
  padding: 8px 8px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--muted);
}

.composer textarea:disabled {
  cursor: not-allowed;
}

.send {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  transition: 0.15s;
  flex: none;
}

.send svg {
  width: 19px;
  height: 19px;
}

.send:hover {
  filter: brightness(1.1);
}

.send:disabled {
  opacity: 0.45;
  cursor: default;
}

.composer-under {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.modes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
}

.mode {
  padding: 4px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.mode.active {
  background: var(--panel2);
  color: var(--text);
}


.mode-switch {
  display: none;
  position: relative;
  flex: none;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 34px;
  padding: 0 8px 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mode-pill .pill-caret {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--muted);
}

.mode-pill[aria-expanded="true"] {
  border-color: var(--accent);
}

.mode-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 236px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 30;
}

.mode-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
}

.mode-opt b {
  font-size: 13px;
  font-weight: 600;
}

.mode-opt .price {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.mode-opt.active {
  background: var(--panel2);
}

.mode-opt.active b {
  color: var(--accent);
}

.side-back {
  display: none;
}

.side-close {
  display: none;
}

.hint a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
}

.hint a:hover {
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 12, 0.6);
  backdrop-filter: blur(5px);
  z-index: 50;
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: rise 0.22s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 20px;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--panel2);
  color: var(--text);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 18px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 22px;
}

.profile-name {
  font-size: 17px;
  font-weight: 600;
}

.profile-login {
  font-size: 13px;
  color: var(--muted);
}

.profile-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row span {
  color: var(--muted);
}

.profile-note {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 12px;
}

.profile-note.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.profile-hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 8px 0 12px;
}

.profile-vk {
  width: 100%;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.ghost-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel2);
  font-size: 13.5px;
  font-weight: 600;
}

.ghost-btn.danger {
  color: var(--danger);
}

.modal-body h2 {
  margin: 0 0 14px;
  font-size: 21px;
}

.modal-body h3 {
  margin: 18px 0 6px;
  font-size: 15px;
}

.modal-body p,
.modal-body li {
  color: var(--muted);
  font-size: 14px;
}

.modal-body ul {
  padding-left: 20px;
}

.modal-body .big-balance {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.package {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.package .coins-n {
  font-size: 19px;
  font-weight: 700;
}

.package .price {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.package .save {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.package .rate {
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 11px;
  opacity: 0.85;
}

.package button {
  width: 100%;
  padding: 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  cursor: not-allowed;
}

.ledger {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.ledger .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg);
  font-size: 13px;
}

.ledger .row span:first-child {
  color: var(--muted);
}

.ledger .plus {
  color: var(--ok);
}

.ledger .minus {
  color: var(--danger);
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 22px;
}

.rule {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.rule .n {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.2));
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

.rule b {
  display: block;
  font-size: 14px;
}

.rule p {
  margin: 2px 0 0;
  font-size: 13px;
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 14px;
}

.model-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2, rgba(255, 255, 255, 0.03));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.model-option:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.model-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.model-main {
  flex: 1;
  min-width: 0;
}

.model-main b {
  font-size: 14.5px;
}

.model-main p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.model-check {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-price {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.invite-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0 18px;
}

.invite-box code {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  font-size: 17px;
  letter-spacing: 0.06em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invite-box .btn-primary {
  width: auto;
  padding: 12px 16px;
  flex: none;
}

.streak-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  margin: 0 auto 20px;
  padding: 12px 18px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.07));
  text-align: left;
}

.streak-flame {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(34, 211, 238, 0.22));
}

.streak-copy b {
  display: block;
  font-size: 14px;
}

.streak-copy span {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.streak-box {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.streak-num {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.2));
}

.streak-info b {
  display: block;
  font-size: 14px;
}

.streak-info p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.daily-card {
  width: 100%;
  max-width: 720px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2, rgba(255, 255, 255, 0.03));
  text-align: left;
}

.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.daily-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.daily-reward {
  font-size: 12px;
  color: var(--muted);
}

.daily-subject {
  margin: 10px 0 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.daily-question {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.daily-options {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.daily-option {
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color 0.16s ease;
}

.daily-option:hover:not(:disabled) {
  border-color: var(--accent);
}

.daily-option:disabled {
  cursor: default;
}

.daily-option.correct {
  border-color: #3ddc97;
  color: #3ddc97;
}

.daily-option.wrong {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.daily-result {
  margin: 12px 0 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily-result b {
  font-size: 14px;
}

.daily-bonus {
  color: #3ddc97;
  font-weight: 600;
}

.daily-explain {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .daily-options {
    grid-template-columns: 1fr;
  }
}

.exam-setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
  max-height: 52vh;
  overflow-y: auto;
}

.exam-task {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.exam-task:last-child {
  border-bottom: none;
}

.exam-q {
  font-size: 13.5px;
  margin: 0 0 8px;
  line-height: 1.45;
}

.exam-answer {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-size: 14px;
}

.exam-answer:focus {
  outline: none;
  border-color: var(--accent);
}

.exam-score {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.exam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.exam-top h2 {
  margin: 0;
}

.exam-timer {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.exam-timer.urgent {
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.exam-weak {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.08);
}

.exam-weak b {
  font-size: 13px;
}

.exam-weak ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.exam-auto {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #ffb454;
}

.oral-progress {
  margin: 6px 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.oral-question {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.5;
  font-weight: 600;
}

.oral-answer {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
}

.oral-answer:focus {
  outline: none;
  border-color: var(--accent);
}

.oral-score {
  margin: 14px 0 6px;
  font-size: 20px;
  font-weight: 800;
}

.oral-score.good {
  color: #3ddc97;
}

.oral-score.mid {
  color: #ffb454;
}

.oral-score.low {
  color: #ff6b6b;
}

.oral-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.oral-final {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.similar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
  max-height: 56vh;
  overflow-y: auto;
}

.similar-task {
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 0 8px 8px 0;
  background: rgba(124, 77, 255, 0.06);
}

.similar-q {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.45;
}

.similar-answer {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.similar-answer p {
  margin: 0 0 4px;
}

.exam-forecast {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.exam-row {
  border-left: 3px solid var(--line);
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 0 8px 8px 0;
}

.exam-row.ok {
  border-left-color: #3ddc97;
}

.exam-row.bad {
  border-left-color: #ff6b6b;
}

.exam-row b {
  font-size: 13px;
  display: block;
}

.exam-row span {
  font-size: 12.5px;
  color: var(--muted);
}

.exam-row p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .exam-setup {
    grid-template-columns: 1fr;
  }
}

.hint-bug {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.72;
  line-height: 1.35;
}

.hint-bug a {
  color: var(--accent);
  text-decoration: none;
}

.hint-bug a:hover {
  text-decoration: underline;
}

.duel-join {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.duel-join input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-size: 14px;
  text-transform: uppercase;
}

.duel-join input:focus {
  outline: none;
  border-color: var(--accent);
}

.duel-join .btn-primary {
  width: auto;
  padding: 11px 16px;
  flex: none;
}

.duel-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  margin: 12px 0;
  border-radius: 14px;
  border: 1px dashed var(--accent);
}

.duel-code-box span {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
}

.duel-code-box code {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.duel-code-box .btn-primary {
  width: auto;
  padding: 10px 14px;
}

.duel-verdict {
  margin: 6px 0;
  font-size: 14px;
  font-weight: 600;
}

.duel-scores {
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.btn-buy {
  display: block;
  width: 100%;
  padding: 8px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease;
}

.btn-buy:hover {
  background: rgba(139, 92, 246, 0.14);
}

.packages-note {
  margin: -4px 0 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.packages-note a {
  color: var(--accent);
  text-decoration: none;
}

.buy-custom {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 4px 0 12px;
}

.buy-custom .field {
  flex: 1;
}

.buy-custom button {
  height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .buy-custom {
    flex-direction: column;
    align-items: stretch;
  }

  .buy-custom button {
    width: 100%;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel2);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  z-index: 60;
  animation: rise 0.2s ease;
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

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

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

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .messages {
    padding: 18px 14px 6px;
  }
  .composer-wrap {
    padding: 8px 12px 12px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .composer-under {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn-vk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  font-weight: 600;
  transition: 0.16s;
}

.btn-vk svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.btn-vk:hover {
  border-color: #2b7fff;
  color: #2b7fff;
}

.vk-note {
  margin-top: 9px;
  text-align: center;
  font-size: 11.5px;
}

.photo-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  animation: rise 0.2s ease;
}

.photo-chip img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
  cursor: zoom-in;
}

.photo-thumbs {
  display: flex;
  gap: 6px;
  flex: none;
  max-width: 60%;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.photo-thumbs::-webkit-scrollbar {
  height: 4px;
}

.photo-thumbs::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.photo-view {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 10, 0.94);
}

.photo-view img {
  max-width: min(94vw, 900px);
  max-height: 84vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}

.photo-view video {
  max-width: min(94vw, 900px);
  max-height: 84vh;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.photo-view-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  background: rgba(20, 26, 36, 0.8);
}

.photo-view-close:hover {
  background: rgba(32, 40, 54, 0.95);
}

.photo-chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}

.photo-chip-text b {
  color: var(--text);
  font-size: 13px;
}

.photo-chip-close {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.photo-chip-close:hover {
  background: var(--panel);
  color: var(--text);
}

.msg-image {
  display: block;
  max-width: 260px;
  max-height: 200px;
  border-radius: 10px;
  margin-bottom: 8px;
  object-fit: cover;
}

.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-images .msg-image {
  margin-bottom: 0;
}

.msg-images.many .msg-image {
  width: 112px;
  height: 112px;
}

@media (max-width: 520px) {
  .msg-images.many .msg-image {
    width: 88px;
    height: 88px;
  }

  .photo-thumbs {
    max-width: 52%;
  }
}

.msg-video {
  display: block;
  width: 300px;
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #000;
}

.admin-table-wrap {
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.admin-balance {
  font-weight: 700;
  font-size: 15px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 260px;
}

.admin-actions button {
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--panel2);
  font-size: 11.5px;
  font-weight: 600;
  transition: 0.15s;
}

.admin-actions button:hover {
  background: var(--accent);
  color: #fff;
}

.admin-actions .warn {
  color: #f87171;
}

.admin-actions .ok {
  color: #34d399;
}

.admin-actions .danger {
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.admin-actions .danger:hover {
  background: #dc2626;
  color: #fff;
}

.admin-vk {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.admin-vk h3 {
  margin: 0;
  font-size: 15px;
}

.admin-vk .admin-sub {
  margin: 0;
  max-width: 620px;
  line-height: 1.5;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.account-grid > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel2);
}

.account-grid span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-grid b {
  font-size: 14px;
}

.password-block,
.activity-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.password-block h3,
.activity-block h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.password-block .admin-sub {
  margin: 0 0 10px;
  max-width: 620px;
  line-height: 1.5;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.password-value {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px dashed rgba(167, 139, 250, 0.55);
  background: rgba(124, 92, 245, 0.12);
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: #ddd6fe;
  user-select: all;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-detail {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.activity-time {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.activity-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.admin-actions .info {
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.admin-vk .field {
  max-width: 420px;
}

.admin-vk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-vk-actions .btn-primary {
  width: auto;
  padding: 8px 18px;
  margin: 0;
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.tag.green {
  color: #34d399;
  background: rgba(52, 211, 153, 0.14);
}

.tag.red {
  color: #f87171;
  background: rgba(248, 113, 113, 0.14);
}

.tag.violet {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.16);
}

.badge {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(167, 139, 250, 0.18);
  color: #a78bfa;
  font-size: 10px;
  font-weight: 700;
  text-transform: lowercase;
}

/* Bubbles: always visible in buttons + ambient background */
.bubbles {
  opacity: 0.9;
}

.bubbles i {
  animation-play-state: running;
}

.btn-new:hover .bubbles,
.btn-primary:hover .bubbles,
.btn-primary:focus-visible .bubbles {
  opacity: 1;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary > .btn-label {
  position: relative;
  z-index: 1;
}

.btn-primary .bubbles i {
  background: radial-gradient(circle at 32% 30%, #ffffff, rgba(255, 255, 255, 0.45) 72%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55), 0 0 16px rgba(255, 255, 255, 0.25);
}

.bg-bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-bubbles i {
  position: absolute;
  bottom: -60px;
  left: var(--bx, 50%);
  width: var(--bs, 14px);
  height: var(--bs, 14px);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.95), rgba(139, 92, 246, 0.4) 72%);
  box-shadow: 0 0 22px rgba(139, 92, 246, 0.42);
  opacity: 0;
  animation: bg-rise var(--bd, 24s) linear infinite;
  animation-delay: var(--bdelay, 0s);
}

@keyframes bg-rise {
  0% { transform: translate3d(0, 0, 0) scale(0.55); opacity: 0; }
  10% { opacity: 0.75; }
  82% { opacity: 0.5; }
  100% { transform: translate3d(var(--bsway, 20px), -105vh, 0) scale(1); opacity: 0; }
}

.auth-card {
  z-index: 1;
}

.main {
  position: relative;
}

.main > .topbar,
.main > .messages,
.main > .composer-wrap {
  position: relative;
  z-index: 1;
}

@property --bubble-core {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(255, 255, 255, 0.95);
}

@property --bubble-edge {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(139, 92, 246, 0.45);
}

:root {
  --bubble-core: rgba(255, 255, 255, 0.95);
  --bubble-edge: rgba(139, 92, 246, 0.45);
  --bubble-glow: rgba(139, 92, 246, 0.3);
}

.bubbles i {
  background: radial-gradient(circle at 32% 30%, #ffffff, rgba(255, 255, 255, 0.45) 72%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
}

.bg-bubbles i {
  background: radial-gradient(circle at 34% 30%, var(--bubble-core), var(--bubble-edge) 72%);
  box-shadow: 0 0 14px var(--bubble-glow);
  transition: --bubble-core 0.45s ease, --bubble-edge 0.45s ease, box-shadow 0.45s ease;
}

[data-theme="light"] {
  --bubble-core: rgba(255, 255, 255, 0.98);
  --bubble-edge: rgba(139, 92, 246, 0.32);
  --bubble-glow: rgba(139, 92, 246, 0.2);
}

.msg-image.generated {
  display: block;
  max-width: min(420px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
}

.side-toggle {
  display: none;
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .app {
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 380px);
    max-height: none;
    height: 100dvh;
    z-index: 46;
    transform: translateX(-104%);
    transition: transform 0.26s ease;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .side-back {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(6, 8, 12, 0.55);
    backdrop-filter: blur(2px);
  }

  .side-back[hidden] {
    display: none;
  }

  .side-close {
    display: grid;
    margin-left: auto;
  }

  .mode-switch {
    display: block;
  }

  .composer {
    position: relative;
  }

  .composer-under .modes {
    display: none;
  }

  .composer-under {
    justify-content: center;
    text-align: center;
  }

  .side-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: none;
  }

  .topbar {
    gap: 8px;
    padding: 10px 12px;
  }

  .topbar-title {
    min-width: 0;
    flex: 1;
  }

  .chat-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-sub {
    font-size: 11px;
  }

  .status {
    font-size: 11px;
    padding: 4px 8px;
  }

  .messages {
    padding: 12px 12px 4px;
    overflow-x: hidden;
  }

  .empty h1 {
    font-size: 22px;
  }

  .empty p {
    font-size: 13px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .msg {
    gap: 8px;
  }

  .msg .bubble {
    max-width: calc(100% - 42px);
  }

  .msg .body {
    max-width: calc(100% - 42px);
  }

  .composer-wrap {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  }

  .composer {
    border-radius: 16px;
    padding: 8px 8px 8px 12px;
    gap: 4px;
  }

  .mode-pill {
    height: 32px;
    padding: 0 6px 0 8px;
    font-size: 11.5px;
  }

  .mode-switch .mode-pop {
    right: 0;
    left: auto;
    width: min(236px, 74vw);
  }

  #input {
    font-size: 16px;
  }

  .modes {
    flex-wrap: wrap;
    gap: 6px;
  }

  .mode {
    padding: 6px 10px;
    font-size: 12px;
  }

  .composer-under {
    gap: 6px;
  }

  .auth-card {
    width: min(420px, calc(100vw - 24px));
    padding: 22px 18px 16px;
  }
}

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

.msg-action {
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  color: inherit;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.msg-action:hover {
  background: rgba(124, 92, 255, 0.22);
}

.paper-modal h3 {
  margin: 0 0 6px;
}

.paper-options {
  display: flex;
  gap: 16px;
  margin: 14px 0 10px;
}

.paper-radio,
.paper-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.paper-check {
  margin-bottom: 14px;
}

.paper-preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 16px;
  display: block;
}

.paper-download {
  display: inline-flex;
  margin-top: 12px;
  text-decoration: none;
}

.admin-stats {
  margin: 16px 0 22px;
  display: grid;
  gap: 18px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
}

.stat-label {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

.stat-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.stat-chart {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 150px;
}

.stat-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.stat-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.stat-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #7c5cff, #4d2fd0);
  border-radius: 6px 6px 0 0;
}

.stat-bar-label {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 6px;
}

.stat-bar-count {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}


@media (max-width: 520px) {
  .account-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .account-grid > div {
    padding: 8px 10px;
  }

  .account-grid b {
    font-size: 13px;
  }

  .activity-row {
    flex-direction: column;
    gap: 4px;
  }

  .activity-time {
    font-size: 11px;
  }
}

.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 14px;
  background: #3a2a12;
  color: #ffd9a0;
  font-size: 13px;
  line-height: 1.3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex: none;
}

.offline-text {
  text-align: center;
}

.offline-retry {
  flex: none;
  border: 1px solid #7a5a24;
  background: transparent;
  color: #ffd9a0;
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.offline-retry:hover {
  background: rgba(255, 217, 160, 0.12);
}

body.offline .composer {
  opacity: 0.55;
}

body.offline .composer textarea,
body.offline .composer .send,
body.offline .composer .photo,
body.offline .composer .mode-pill {
  pointer-events: none;
}

@media (max-width: 520px) {
  .offline-bar {
    font-size: 11.5px;
    gap: 6px;
    padding: 7px 10px;
  }

  .offline-retry {
    padding: 3px 9px;
    font-size: 11px;
  }
}

.gift-results,
.gift-templates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.gift-results:empty,
.gift-templates:empty {
  margin: 0;
}

.gift-user,
.gift-template {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.gift-user b,
.gift-template b {
  font-size: 14px;
}

.gift-user span,
.gift-template span {
  font-size: 12px;
  opacity: 0.7;
}

.gift-user.active,
.gift-template.active {
  border-color: #7c5cf5;
  background: rgba(124, 92, 245, 0.16);
}

.gift-balance {
  font-size: 12px;
  opacity: 0.75;
}

.gift-inbox {
  margin-top: 16px;
}

.gift-inbox h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.gift-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.gift-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gift-item-text span {
  font-size: 12px;
  opacity: 0.75;
}

.gift-art {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: none;
  color: #b79bff;
}

.gift-art svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(124, 92, 245, 0.55));
}

.gift-art--small {
  width: 26px;
  height: 26px;
}

.gift-art::before,
.gift-art::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.gift-art--thanks svg {
  animation: gift-tilt 2.8s ease-in-out infinite;
}

.gift-art--birthday svg {
  animation: gift-pulse 1.7s ease-in-out infinite;
}

.gift-art--birthday::before,
.gift-art--birthday::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 8px #ffd166;
  animation: gift-spark 1.6s ease-in-out infinite;
}

.gift-art--birthday::before {
  top: 0;
  left: 8px;
}

.gift-art--birthday::after {
  top: 2px;
  right: 6px;
  animation-delay: 0.8s;
}

.gift-art--just svg {
  animation: gift-float 3.4s ease-in-out infinite;
}

.gift-art--spark svg {
  animation: gift-pop 2.4s ease-in-out infinite;
}

.gift-art--spark::before,
.gift-art--spark::after {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b79bff;
  box-shadow: 0 0 10px #7c5cf5;
  animation: gift-spark 1.4s ease-in-out infinite;
}

.gift-art--spark::before {
  top: 1px;
  right: 3px;
}

.gift-art--spark::after {
  bottom: 3px;
  left: 1px;
  animation-delay: 0.7s;
}

.gift-art--party svg {
  animation: gift-tilt 2.2s ease-in-out infinite;
}

.gift-art--party::before {
  inset: -6px;
  opacity: 0.55;
  background-image:
    radial-gradient(#7c5cf5 1.4px, transparent 1.5px),
    radial-gradient(#b79bff 1.4px, transparent 1.5px);
  background-size: 12px 12px, 16px 16px;
  background-position: 0 0, 6px 8px;
  animation: gift-confetti 5s linear infinite;
}

@keyframes gift-tilt {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@keyframes gift-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes gift-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes gift-pop {
  0%, 100% { transform: scale(1) rotate(0); }
  40% { transform: scale(1.1) rotate(-3deg); }
  70% { transform: scale(1.02) rotate(2deg); }
}

@keyframes gift-spark {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes gift-confetti {
  from { background-position: 0 0, 6px 8px; }
  to { background-position: 0 24px, 6px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .gift-art svg,
  .gift-art::before,
  .gift-art::after {
    animation: none !important;
  }
}