:root {
  --bg-main: radial-gradient(circle at top, #2b1a3a 0, #090909 55%, #050508 100%);
  --card-bg: linear-gradient(145deg, #1a1a23, #111119);
  --accent: #ff4b77;
  --accent-soft: rgba(255, 75, 119, 0.18);
  --accent-2: #ffb36b;
  --text-main: #f5f5f7;
  --text-muted: #9a9aaf;
  --border-soft: rgba(255, 255, 255, 0.06);
  --chat-bg: radial-gradient(circle at top left, #1d1427, #070709);
  --panel-bg: linear-gradient(145deg, rgba(8, 8, 14, 0.95), rgba(4, 4, 8, 0.98));
  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.7);
  --radius-lg: 18px;
  --radius-md: 12px;
  --transition-fast: 180ms ease-out;
  --transition-med: 220ms ease-out;
}

/* Global */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: var(--text-main);
  background: #050507;
}

body {
  background: var(--bg-main);
  overflow-y: auto;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* Layout wrappers */

.app-shell {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Top bar */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 2px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: conic-gradient(from 180deg, #ff4b77, #ffb36b, #ff4b77);
  padding: 2px;
}

.logo-badge-inner {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 20%, #2b1a3a, #050508);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffe4f0;
  font-size: 13px;
  font-weight: 700;
}

.logo-text-main {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.4));
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.login-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.2), rgba(255, 179, 107, 0.2));
  color: #ffe5f0;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-btn:hover {
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.3), rgba(255, 179, 107, 0.3));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 75, 119, 0.3);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: radial-gradient(circle, #45f39f 0, #0da561 40%, #02160b 100%);
  box-shadow: 0 0 12px rgba(69, 243, 159, 0.65);
}

/* Main views container */

.main-view {
  flex: 1;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(15, 12, 28, 0.96), rgba(3, 3, 7, 0.98));
  box-shadow: var(--shadow-soft);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Header inside view */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.view-title {
  font-size: 17px;
  font-weight: 600;
}

.view-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* Gallery grid */

.gallery {
  display: flex;
  flex-direction: column;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.card {
  position: relative;
  border-radius: 16px;
  padding: 4px;
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.16), rgba(10, 10, 24, 0.95));
  cursor: pointer;
  transition: transform var(--transition-med), box-shadow var(--transition-med), background var(--transition-med);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}

.card-inner {
  height: 100%;
  border-radius: 12px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-image {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at top, #3b233f, #07070b);
}

.card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: blur(0px);
  transition: filter 0.3s ease;
}

.card-image.secret img {
  filter: blur(8px);
}

.card-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(0, 0, 0, 0.15), transparent 40%, rgba(255, 255, 255, 0.03) 60%, transparent 80%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.card-image-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
}

.card-footer {
  display: none;
}

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 30%, rgba(0,0,0,0) 60%);
  z-index: 2;
}

.card-name-overlay {
  font-size: 13px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
  margin-bottom: 4px;
}

.card-age {
  font-weight: 400;
  opacity: 0.85;
  font-size: 12px;
}

.card-badges-overlay {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-self: flex-end;
}

.badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.9), rgba(255, 179, 107, 0.9));
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Card hover */

.card:hover {
  transform: translateY(-3px);
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.22), rgba(255, 179, 107, 0.22));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
}

.card:hover .card-image::before {
  opacity: 1;
}

/* Chat layout */

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1.8fr 1fr;
  gap: 10px;
  min-height: 0;
}

/* Left: big photo */

.chat-photo {
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top, #402145, #08060c 70%);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  padding: 10px;
}

.chat-photo img {
  filter: blur(0px);
  transition: filter 0.3s ease;
}

.chat-photo.secret img {
  filter: blur(12px);
}

.chat-photo-main {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0, rgba(255, 179, 107, 0.3), transparent 55%), radial-gradient(circle at 80% 0, rgba(255, 75, 119, 0.4), transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.7;
}

.chat-photo-fallback {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: 130%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(155deg, #2b1a3a, #130b19);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #ffe4f0;
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
}

/* Center: chat */

.chat-center {
  border-radius: var(--radius-lg);
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 0;
}

.chat-center-header {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.5));
  flex-shrink: 0;
  height: auto;
  min-height: 50px;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #ffb36b, #ff4b77 40%, #150a16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #ffe9f2;
}

.chat-user-main {
  font-size: 12px;
  font-weight: 600;
}

.chat-user-meta {
  font-size: 10px;
  color: #45f39f;
}

/* Typing indicator styles */
.typing-indicator-user {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #45f39f;
  margin-left: 6px;
  animation: pulse 1.5s infinite;
}

.typing-indicator-user .typing-dots {
  display: flex;
  gap: 2px;
}

.typing-indicator-user .typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #45f39f;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-indicator-user .typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator-user .typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator-user .typing-dot:nth-child(3) { animation-delay: 0s; }

.typing-indicator-user .typing-text {
  color: #45f39f;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
}

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* Typing indicator bubble in chat */
.typing-bubble {
  display: none;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.15), rgba(35, 24, 54, 0.95));
  border: 1px solid rgba(255, 75, 119, 0.2);
  width: fit-content;
  margin-bottom: 8px;
}

.typing-bubble.visible {
  display: block;
}

.typing-bubble-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-bubble-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4b77;
  animation: typingBubble 1.4s infinite ease-in-out;
}

.typing-bubble-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-bubble-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-bubble-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBubble {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  background: linear-gradient(135deg, rgba(69, 243, 159, 0.1), rgba(10, 64, 32, 0.9));
  color: #b5ffdb;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.actions-toggle-btn {
  display: none;
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 500;
  background: radial-gradient(circle at top left, rgba(255, 75, 119, 0.3), rgba(10, 10, 18, 0.95));
  color: #ffe0ec;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 75, 119, 0.5);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.actions-toggle-btn:active {
  transform: scale(0.96);
  box-shadow: 0 0 8px rgba(255, 75, 119, 0.5);
}

/* Actions modal */

.actions-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 6, 0.86);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  z-index: 30;
}

.actions-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.actions-modal {
  width: 100%;
  max-width: 420px;
  border-radius: 18px 18px 0 0;
  background: var(--panel-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.8);
  padding: 10px 10px 12px;
}

.actions-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.actions-modal-close {
  border: none;
  outline: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.9));
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.actions-modal-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: radial-gradient(circle, #45f39f 0, #0da561 45%, #02160b 100%);
}

/* Messages */

.chat-messages {
  flex: 1;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
}

.chat-messages-inner {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 20px;
  min-height: 0;
}

/* custom scrollbar, subtle */

.chat-messages-inner::-webkit-scrollbar {
  width: 4px;
}

body::-webkit-scrollbar {
  width: 4px;
}

.chat-messages-inner::-webkit-scrollbar-track {
  background: transparent;
}

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

.chat-messages-inner::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.msg-row {
  display: flex;
  margin-bottom: 8px;
  width: 100%;
}

.msg-row.me {
  justify-content: flex-end;
}

.msg-row.me .msg-bubble {
  margin-left: auto;
}

.msg-row.other {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: normal;
  overflow-wrap: normal;
  position: relative;
  display: inline-block;
  max-width: fit-content;
  white-space: pre-wrap;
}

.msg-row.other .msg-bubble {
  border-bottom-left-radius: 4px;
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.15), rgba(35, 24, 54, 0.95));
  color: #ffe8f0;
  border: 1px solid rgba(255, 75, 119, 0.2);
}

.msg-row.me .msg-bubble {
  border-bottom-right-radius: 4px;
  background: linear-gradient(145deg, rgba(255, 179, 107, 0.2), rgba(66, 43, 20, 0.95));
  color: #ffe5d0;
  border: 1px solid rgba(255, 179, 107, 0.3);
}

.msg-meta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
}

.msg-row.me .msg-meta {
  text-align: right;
  color: #45f39f;
}

.msg-row.other .msg-meta {
  text-align: left;
}

/* Media messages */
.msg-media-image {
  border-radius: 12px;
  overflow: hidden;
  max-width: 320px;
  margin: 4px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.msg-media-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  max-height: 400px;
}

.msg-media-video {
  border-radius: 12px;
  overflow: hidden;
  max-width: 320px;
  margin: 4px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.msg-media-video video {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  max-height: 400px;
}

.msg-action {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  margin-top: 4px;
}

.msg-text {
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: normal;
}

.msg-time {
  font-size: 10px;
  opacity: 0.8;
}

/* Markdown styles */
.msg-text strong {
  font-weight: 700;
  color: inherit;
}

.msg-text em {
  font-style: italic;
  color: inherit;
}

.msg-text code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #ffe5d0;
}

.msg-text pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 4px 0;
}

.msg-text pre code {
  background: none;
  padding: 0;
}

.msg-text a {
  color: #ffb36b;
  text-decoration: underline;
}

.msg-text a:hover {
  color: #ff4b77;
}

.msg-text ul, .msg-text ol {
  margin: 4px 0;
  padding-left: 20px;
}

.msg-text li {
  margin: 2px 0;
}

.msg-text blockquote {
  border-left: 3px solid rgba(255, 179, 107, 0.5);
  padding-left: 8px;
  margin: 4px 0;
  color: rgba(255, 229, 208, 0.9);
}

/* Input */

.chat-input-row {
  padding: 6px 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(8, 8, 15, 0.98));
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin-top: auto;
  flex-shrink: 0;
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 11px;
  outline: none;
}

.chat-input::placeholder {
  color: rgba(154, 154, 175, 0.8);
}

.chat-send-btn {
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ff4b77, #ffb36b);
  color: #19050b;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 75, 119, 0.7);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.chat-send-btn:active {
  transform: scale(0.96);
  box-shadow: 0 0 10px rgba(255, 75, 119, 0.6);
}

/* Right: actions */

.chat-actions {
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 8px 8px 10px;
  gap: 6px;
}

.chat-actions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.actions-title {
  font-size: 11px;
  font-weight: 600;
}

.actions-tag {
  font-size: 10px;
  color: var(--text-muted);
}

.action-button {
  width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at top left, rgba(255, 75, 119, 0.15), rgba(10, 10, 18, 0.98));
  color: #ffe5f0;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.action-button.secondary {
  background: radial-gradient(circle at top left, rgba(255, 179, 107, 0.2), rgba(10, 7, 3, 0.98));
  color: #fff1e1;
}

.action-button.ghost {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.9));
  color: var(--text-muted);
}

.action-label-main {
  font-size: 11px;
  font-weight: 500;
}

.action-label-sub {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.65);
}

.action-pill {
  font-size: 9px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

/* Video cards in actions panel */
.videos-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.videos-loading, .videos-empty {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  padding: 20px 10px;
}

.video-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.1), rgba(20, 15, 30, 0.95));
  border: 1px solid rgba(255, 75, 119, 0.15);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.video-card:hover {
  background: linear-gradient(145deg, rgba(255, 75, 119, 0.2), rgba(30, 20, 45, 0.95));
  border-color: rgba(255, 75, 119, 0.3);
  transform: translateY(-2px);
}

.video-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

.video-card.purchased {
  border-color: rgba(69, 243, 159, 0.5);
  background: linear-gradient(145deg, rgba(69, 243, 159, 0.1), rgba(20, 15, 30, 0.95));
}

.video-thumbnail {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: radial-gradient(circle at center, #3b233f, #0a0a12);
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 75, 119, 0.6);
}

.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 75, 119, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 75, 119, 0.5);
  transition: transform var(--transition-fast);
}

.video-card:hover .video-play-icon {
  transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.video-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-price {
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-cost {
  font-size: 12px;
  font-weight: 700;
  color: #45f39f;
}

/* Back button */

.back-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98), rgba(0, 0, 0, 0.98));
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.back-btn-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Auth Modal */

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 6, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  z-index: 100;
}

.auth-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal {
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  padding: 20px;
  transform: translateY(20px);
  transition: transform var(--transition-med);
}

.auth-modal-backdrop.open .auth-modal {
  transform: translateY(0);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.auth-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
}

.auth-close-btn {
  border: none;
  outline: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.9));
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.auth-close-btn:hover {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.9));
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.3), rgba(255, 179, 107, 0.3));
  color: #ffe5f0;
  box-shadow: 0 2px 8px rgba(255, 75, 119, 0.3);
}

.auth-form-container {
  position: relative;
}

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

.auth-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(255, 75, 119, 0.2);
}

.form-group input::placeholder {
  color: rgba(154, 154, 175, 0.6);
}

.auth-submit-btn {
  margin-top: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff4b77, #ffb36b);
  color: #19050b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 75, 119, 0.4);
}

.auth-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 75, 119, 0.4);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-error {
  color: #ff6b8a;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

.auth-success {
  color: #45f39f;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* Balance Modal */

.balance-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 6, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  z-index: 100;
}

.balance-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.balance-modal {
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  padding: 20px;
  transform: translateY(20px);
  transition: transform var(--transition-med);
}

.balance-modal-backdrop.open .balance-modal {
  transform: translateY(0);
}

.balance-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.balance-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
}

.balance-close-btn {
  border: none;
  outline: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.9));
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.balance-close-btn:hover {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.9));
}

.balance-modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.token-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.token-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff4b77, #ffb36b);
}

.token-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.token-details {
  flex: 1;
}

.token-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.token-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.amount-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.amount-btn {
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.amount-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 75, 119, 0.1);
}

.amount-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.2), rgba(255, 179, 107, 0.2));
  color: #ffe5f0;
}

.payment-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.payment-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.payment-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 75, 119, 0.2), rgba(255, 179, 107, 0.2));
}

.payment-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.payment-details {
  flex: 1;
  text-align: left;
}

.payment-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.payment-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.create-payment-btn {
  margin-top: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #45f39f, #0da561);
  color: #02160b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.create-payment-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(69, 243, 159, 0.4);
}

.create-payment-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(69, 243, 159, 0.4);
}

.create-payment-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.balance-error {
  color: #ff6b8a;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

.balance-success {
  color: #45f39f;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* User Menu in Top Bar */

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4b77, #ffb36b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.user-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
}

.user-balance {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #b5ffdb;
}

.balance-amount {
  color: #45f39f;
  font-weight: 700;
}

.balance-add-btn {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(69, 243, 159, 0.5);
  background: rgba(69, 243, 159, 0.1);
  color: #45f39f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.balance-add-btn:hover {
  background: rgba(69, 243, 159, 0.2);
  transform: scale(1.1);
}

.logout-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 75, 119, 0.2);
  color: #ffe5f0;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(255, 75, 119, 0.3);
}

/* Utility */

.fade-in {
  animation: fadeIn 220ms ease-out;
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Responsive: adapt for narrow mobile */

@media (max-width: 900px) {
  .app-shell {
    padding: 8px 6px;
  }

  .main-view {
    padding: 10px 8px;
    border-radius: 18px;
  }

  .top-bar {
    padding: 2px 6px 0;
  }

  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .card-footer {
    padding: 4px 5px 5px;
  }

  .card-name {
    font-size: 11px;
  }

  .badge {
    font-size: 8px;
  }

  .chat-shell {
    grid-template-columns: 1fr 1.8fr;
    gap: 8px;
  }

  .chat-photo {
    display: none;
  }

  .chat-photo-fallback {
    border-radius: 14px;
  }

  .chat-actions {
    padding: 8px;
    order: 2;
  }

  .action-button {
    padding: 6px 7px;
  }

  .chat-center-header {
    padding: 8px 10px;
  }

  .chat-messages {
    padding: 8px;
    max-height: calc(100vh - 180px);
  }

  .chat-messages-inner {
    padding-bottom: 15px;
  }

  .chat-input-row {
    padding: 6px 8px 10px;
  }

  .msg-bubble {
    max-width: 90%;
    word-wrap: normal;
    overflow-wrap: normal;
    white-space: pre-wrap;
  }
}

@media (max-width: 640px) {
  /* Mobile: 2 cards per row */
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    border-radius: 12px;
  }

  .card-name-overlay {
    font-size: 12px;
  }

  .badge {
    font-size: 7px;
    padding: 2px 5px;
  }

  /* Chat: full screen mobile layout */
  .chat-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
  }

  .chat-photo {
    display: none;
  }

  .chat-center {
    flex: 1;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    max-height: none;
    height: 100%;
  }

  .chat-center-header {
    padding: 10px 12px;
    border-radius: 12px 12px 0 0;
  }

  .chat-avatar-mini {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .chat-user-main {
    font-size: 14px;
  }

  .chat-messages {
    flex: 1;
    padding: 10px;
    max-height: none;
    height: auto;
    min-height: 0;
  }

  .chat-messages-inner {
    padding-bottom: 10px;
  }

  .chat-input-row {
    padding: 8px 10px 12px;
    border-radius: 0 0 12px 12px;
  }

  .chat-input {
    font-size: 14px;
    padding: 8px 12px;
  }

  .chat-send-btn {
    padding: 10px 16px;
    font-size: 12px;
  }

  .msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 14px;
  }

  /* Actions panel as horizontal scroll */
  .chat-actions {
    order: -1;
    border-radius: 12px;
    margin-bottom: 8px;
    max-height: 140px;
    overflow-y: auto;
  }

  .chat-actions-header {
    position: sticky;
    top: 0;
    background: var(--panel-bg);
    z-index: 1;
    padding-bottom: 6px;
  }

  .videos-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .video-card {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
  }

  .video-thumbnail {
    width: 100%;
    height: 50px;
  }

  .video-name {
    font-size: 10px;
  }

  .video-cost {
    font-size: 11px;
  }

  /* Top bar mobile */
  .top-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .logo-text-main {
    font-size: 14px;
  }

  .logo-text-sub {
    font-size: 9px;
  }

  .chip-pill {
    font-size: 10px;
    padding: 4px 8px;
  }

  .user-menu {
    flex-wrap: wrap;
    gap: 6px;
  }

  .user-info {
    padding: 4px 8px;
  }

  .user-name {
    font-size: 10px;
  }

  /* View header */
  .view-header {
    margin-bottom: 8px;
  }

  .view-title {
    font-size: 14px;
  }

  .view-subtitle {
    font-size: 10px;
  }

  /* Media in messages */
  .msg-media-image, .msg-media-video {
    max-width: 240px;
  }

  .msg-media-image img, .msg-media-video video {
    max-height: 300px;
  }
}

/* Desktop optimizations */
@media (min-width: 901px) {
  .chat-center {
    max-height: calc(100vh - 120px);
  }
  
  .chat-messages {
    max-height: calc(100vh - 220px);
  }
  
  .chat-messages-inner {
    padding-bottom: 25px;
  }
}