:root {
  color-scheme: dark;
  --bg: #02050c;
  --panel: rgba(24, 27, 39, 0.86);
  --panel-strong: rgba(19, 21, 30, 0.96);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f8f6f4;
  --muted: rgba(248, 246, 244, 0.62);
  --accent: #64d8ff;
  --danger: #7a2928;
  --blue: #526c93;
  --green: #347c2d;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

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

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.46)),
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.08), transparent 23rem),
    linear-gradient(180deg, #8d302d 0%, #5b1f21 72%, #220b12 100%);
}

.app-shell.theme-blue {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.36)),
    linear-gradient(180deg, #607ba3 0%, #29364c 78%, #0b1018 100%);
}

.top-bar {
  position: fixed;
  z-index: 10;
  top: calc(env(safe-area-inset-top) + 30px);
  left: 50%;
  display: grid;
  grid-template-columns: 44px 54px 44px;
  align-items: center;
  width: 178px;
  height: 58px;
  padding: 0 8px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  background: rgba(20, 17, 25, 0.78);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
}

.icon-button,
.brand-button,
.bottom-nav button,
.back-button {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
}

.brand-button img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  padding: 124px max(18px, env(safe-area-inset-right)) 104px max(18px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: block;
}

.screen-home {
  display: none;
  align-items: flex-start;
  justify-content: center;
}

.screen-home.active {
  display: flex;
}

.subscription-card {
  width: min(504px, 100%);
  margin-top: 18px;
  padding: 20px;
  border-radius: 28px;
  background: rgba(35, 9, 17, 0.9);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.subscription-card.active {
  background: rgba(18, 29, 27, 0.9);
}

.eyebrow {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 8px 0 16px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 20px;
  font-size: 42px;
}

.wide-button,
.stat-row {
  width: 100%;
  min-height: 60px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.wide-button.primary {
  background: rgba(137, 46, 47, 0.52);
}

.wide-button.secondary {
  background: rgba(255, 255, 255, 0.06);
}

.wide-button.muted {
  cursor: default;
  opacity: 0.64;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.72);
}

.stat-row b {
  color: #fff;
  font-size: 22px;
}

.content-column {
  width: min(504px, 100%);
  margin: 0 auto;
}

.chat-tile {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 90px;
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 24px;
  background: rgba(22, 18, 29, 0.83);
  text-align: left;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.2);
}

.chat-tile small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #f7d1c8 0 20%, transparent 21%),
    radial-gradient(circle at 38% 30%, #55352d 0 18%, transparent 19%),
    linear-gradient(135deg, #f8dfd2, #7c2632);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.avatar-two {
  background:
    radial-gradient(circle at 51% 40%, #f1d0bf 0 17%, transparent 18%),
    linear-gradient(135deg, #6c1828, #1b1021 55%, #e1c0a4);
}

.screen-chat {
  padding-top: 100px;
  padding-bottom: 170px;
  overflow-anchor: none;
}

.chat-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  width: min(504px, 100%);
  margin: 0 auto 18px;
  gap: 12px;
}

.chat-header h2 {
  margin: 0;
  font-size: 22px;
}

.back-button {
  min-width: 40px;
  min-height: 40px;
  font-size: 36px;
  line-height: 1;
}

.messages {
  width: min(504px, 100%);
  margin: 0 auto;
  padding-bottom: 160px;
  overflow-anchor: none;
}

.message-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  margin: 12px 0;
  overflow-anchor: none;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  margin-top: auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #ffe1c7 0 16%, transparent 17%),
    linear-gradient(135deg, #4bb5ff, #172646 55%, #a4eb4d);
  box-shadow: 0 0 0 2px rgba(145, 255, 109, 0.45);
}

.message-card {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 14px 14px 34px;
  border-radius: 16px;
  background: rgba(12, 15, 25, 0.88);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  font-size: 15px;
}

.message-card.compact {
  min-height: 76px;
}

.sender {
  color: var(--accent);
}

.message-card h3 {
  margin: 2px 0 12px;
  font-size: 19px;
  line-height: 1.08;
}

.message-card p {
  margin: 2px 0;
  line-height: 1.28;
}

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

.time {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-weight: 600;
}

.listing-actions {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.listing-actions button,
.listing-actions a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 15px;
}

.listing-actions .take {
  grid-column: 1 / -1;
}

.listing-actions.occupied {
  grid-template-columns: 1fr;
}

.taken-notice {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(52, 124, 45, 0.24);
  color: #d8ffd3;
  text-align: center;
  font-size: 14px;
}

.listing-actions .release {
  background: rgba(122, 41, 40, 0.58);
}

.subscription-lock {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(25, 4, 7, 0.42);
}

.subscription-lock.visible {
  display: grid;
}

.channel-lock {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(25, 4, 7, 0.72);
  backdrop-filter: blur(8px);
}

.channel-lock__card {
  display: grid;
  gap: 16px;
}

.channel-lock__list {
  display: grid;
  gap: 10px;
}

.channel-link {
  min-height: 48px;
  border-radius: 999px;
  background: rgba(122, 41, 40, 0.78);
}

.lock-card {
  width: min(530px, 100%);
  padding: 28px;
  border-radius: 22px;
  background: rgba(24, 20, 30, 0.86);
  text-align: center;
  backdrop-filter: blur(8px);
}

.lock-card button {
  min-width: 240px;
  min-height: 46px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.plans {
  display: grid;
  gap: 10px;
}

.plan-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(26, 19, 29, 0.84);
}

.plan-card button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--green);
}

.access-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(26, 19, 29, 0.84);
}

.access-card b {
  color: var(--text);
  font-size: 20px;
}

.access-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.access-card button {
  min-height: 46px;
  border-radius: 12px;
  background: var(--green);
}

.settings-panel {
  display: grid;
  gap: 10px;
}

.pro-lock-note {
  display: none;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 214, 117, 0.24);
  border-radius: 16px;
  background: rgba(60, 42, 20, 0.72);
}

.pro-lock-note.visible {
  display: grid;
}

.pro-lock-note b {
  color: var(--text);
  font-size: 17px;
}

.pro-lock-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.settings-panel.pro-locked .setting-row,
.settings-panel.pro-locked .gift-filter-card {
  opacity: 0.58;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(26, 19, 29, 0.84);
}

.setting-row span {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.setting-row input {
  width: 52px;
  height: 30px;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.setting-row input:disabled {
  cursor: not-allowed;
}

.setting-row input::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.setting-row input:checked {
  border-color: rgba(97, 216, 131, 0.44);
  background: rgba(52, 124, 45, 0.9);
}

.setting-row input:checked::before {
  transform: translateX(22px);
}

.gift-filter-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(26, 19, 29, 0.84);
}

.gift-filter-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.gift-filter-head span {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.gift-filter-head button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.gift-filter-head button:disabled {
  opacity: 0.45;
}

.gift-filter-summary {
  color: var(--muted);
  font-size: 13px;
}

.gift-filter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.gift-filter-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.gift-filter-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.gift-filter-item input:disabled {
  cursor: not-allowed;
}

.gift-filter-item span {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.gift-filter-empty {
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  width: 100%;
  margin: 22px auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 15, 25, 0.62);
  color: var(--muted);
  text-align: center;
}

.copy-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.46);
}

.copy-sheet__panel {
  width: min(520px, 100%);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 17, 25, 0.96);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.38);
}

.copy-sheet__panel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.copy-sheet textarea {
  width: 100%;
  min-height: 170px;
  padding: 12px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: 600 14px/1.35 Inter, system-ui, sans-serif;
}

.copy-sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.copy-sheet__actions button {
  min-height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.copy-sheet__actions .open-seller {
  background: var(--green);
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: max(18px, calc(50% - 170px));
  bottom: calc(env(safe-area-inset-bottom) + 36px);
  left: max(18px, calc(50% - 170px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  height: 96px;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 48px;
  background: rgba(22, 16, 22, 0.62);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 62px;
  font-size: 34px;
}

.mascot-bg {
  position: fixed;
  z-index: 1;
  left: 50%;
  bottom: 50px;
  width: min(390px, 54vw);
  max-height: 74vh;
  transform: translateX(-50%);
  object-fit: contain;
  opacity: 0.38;
  filter: saturate(0.92);
  pointer-events: none;
}

@media (max-width: 720px) {
  .screen {
    padding: 98px 12px 140px;
  }

  .screen-chat {
    padding: 102px 10px 150px;
  }

  .top-bar {
    top: calc(env(safe-area-inset-top) + 28px);
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 32px;
  }

  .subscription-card {
    margin-top: 10px;
    border-radius: 22px;
  }

  .chat-header {
    width: min(100%, 430px);
    margin-bottom: 12px;
  }

  .chat-header h2 {
    font-size: 28px;
  }

  .bottom-nav {
    right: 52px;
    bottom: calc(env(safe-area-inset-bottom) + 18px);
    left: 52px;
    height: 68px;
    padding: 8px 18px;
  }

  .bottom-nav button {
    min-height: 46px;
    font-size: 26px;
  }

  .mascot-bg {
    width: min(300px, 72vw);
    bottom: 88px;
    opacity: 0.28;
  }

  .messages {
    width: min(100%, 430px);
    padding-bottom: 140px;
  }

  .message-row {
    grid-template-columns: 36px 1fr;
    gap: 8px;
    margin: 10px 0 14px;
  }

  .bot-avatar {
    width: 34px;
    height: 34px;
  }

  .message-card {
    padding: 12px 12px 30px;
    border-radius: 14px;
    font-size: 14px;
  }

  .sender {
    font-size: 14px;
  }

  .message-card h3 {
    margin-bottom: 10px;
    font-size: 17px;
  }

  .listing-actions {
    gap: 6px;
  }

  .listing-actions button,
  .listing-actions a {
    min-height: 38px;
    border-radius: 10px;
    font-size: 14px;
  }

  .time {
    right: 10px;
    bottom: 8px;
    font-size: 13px;
  }
}
