:root {
  --tg-theme-bg-color: #0f172a;
  --tg-theme-text-color: #f8fafc;
  --tg-theme-hint-color: #94a3b8;
  --tg-theme-link-color: #38bdf8;
  --tg-theme-button-color: #3b82f6;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #1e293b;
  --card-bg: #1e293b;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --border-color: #334155;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--tg-theme-bg-color);
  color: var(--tg-theme-text-color);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overflow-x: hidden;
}

/* Header */
.app-header {
  background: var(--tg-theme-secondary-bg-color);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.online-status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  -webkit-text-fill-color: #10b981;
  line-height: 1;
}

.online-pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
  animation: pulse-online 2s infinite ease-in-out;
}

@keyframes pulse-online {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
  }
  50% {
    transform: scale(1.35);
    opacity: 0.6;
    box-shadow: 0 0 10px rgba(16, 185, 129, 1);
  }
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: var(--tg-theme-secondary-bg-color);
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  align-items: stretch;
}

.nav-tab {
  flex: 1;
  min-height: 42px;
  padding: 6px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--tg-theme-hint-color);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 8px;
  box-sizing: border-box;
}

.nav-tab.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
  border-bottom: 2px solid var(--accent-blue);
}

/* Filter Pills */
.filter-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  white-space: nowrap;
}

.filter-pill {
  background: var(--tg-theme-secondary-bg-color);
  border: 1px solid var(--border-color);
  color: var(--tg-theme-hint-color);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Container */
.container {
  padding: 12px 16px;
  max-width: 600px;
  margin: 0 auto;
}

/* Room Cards */
.room-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.room-image-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #000;
}

.room-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.format-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.1);
}

.discount-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent-green);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.room-content {
  padding: 14px 16px;
}

.product-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.current-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-green);
}

.fee-subtext {
  font-size: 11px;
  color: var(--tg-theme-hint-color);
}

.market-price {
  font-size: 13px;
  text-decoration: line-through;
  color: var(--tg-theme-hint-color);
}

.market-price-clean {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  text-decoration: none !important;
}

/* Progress Bar */
.progress-wrap {
  margin-bottom: 14px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--tg-theme-hint-color);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #0f172a;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.deposit-spots-tag {
  font-size: 11px;
  color: var(--accent-gold);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-join {
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-join:active {
  transform: scale(0.98);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 16px)) 18px;
  border-top: 1px solid var(--border-color);
  animation: slideUp 0.25s ease-out;
  box-sizing: border-box;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Centered Dialog Popups (Окошки уведомлений, подтверждений и диалогов) */
.modal-overlay.modal-centered,
#appNoticeModal,
#editStockModal,
#secretAuthModal,
#existingRoomChoiceModal {
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.modal-overlay.modal-centered .modal-content,
#appNoticeModal .modal-content,
#editStockModal .modal-content,
#secretAuthModal .modal-content,
#existingRoomChoiceModal .modal-content {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: auto;
  max-height: 85vh;
  max-height: 85dvh;
  padding: 26px 20px 22px 20px;
  box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.5);
  animation: popInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
}

.modal-option {
  background: #0f172a;
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-option.selected {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
}

.option-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-title {
  font-size: 14px;
  font-weight: 700;
}

.option-desc {
  font-size: 12px;
  color: var(--tg-theme-hint-color);
}

.option-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-green);
}

.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--accent-gold);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  color: #fbbf24;
  margin: 12px 0;
}

/* Countdown & Live Drop Reel */
.countdown-box {
  text-align: center;
  padding: 30px 16px;
}

.timer-circle {
  font-size: 48px;
  font-weight: 900;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
  margin: 16px 0;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.reel-container {
  position: relative;
  width: 100%;
  height: 124px;
  background: #090d16;
  border: 2px solid #38bdf8;
  border-radius: 14px;
  overflow: hidden;
  margin: 18px 0;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.8), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.reel-container::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 45px;
  background: linear-gradient(90deg, #090d16 0%, transparent 100%);
  z-index: 5;
  pointer-events: none;
}

.reel-container::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 45px;
  background: linear-gradient(270deg, #090d16 0%, transparent 100%);
  z-index: 5;
  pointer-events: none;
}

.reel-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #f59e0b;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 0 10px #f59e0b, 0 0 20px rgba(245, 158, 11, 0.6);
  pointer-events: none;
}

.reel-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #f59e0b;
}

.reel-indicator::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 9px solid #f59e0b;
}

.reel-track {
  display: flex;
  align-items: center;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.reel-card {
  width: 90px;
  height: 96px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  margin: 0 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
  user-select: none;
}

.reel-card.winner {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(30, 41, 59, 0.95));
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.7);
  transform: scale(1.05);
}

.reel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.reel-number {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-blue);
}

/* Inventory Tab */
.token-card {
  background: #1e293b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-nominal {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-gold);
}

.token-timer {
  font-size: 12px;
  color: var(--tg-theme-hint-color);
  margin-top: 4px;
}

/* Admin Panel Styles */
.admin-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.admin-badge-private {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.admin-badge-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.admin-form-group {
  margin-bottom: 14px;
}

.admin-form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.admin-input {
  width: 100%;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
}

.admin-input:focus {
  border-color: #38bdf8;
}

.admin-textarea {
  width: 100%;
  padding: 10px 12px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f8fafc;
  font-size: 13px;
  outline: none;
  min-height: 70px;
  resize: vertical;
}

.photo-preview-wrap {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  border: 1px dashed #475569;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 6px;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-num {
  font-size: 18px;
  font-weight: 800;
  color: #38bdf8;
}

.stat-label {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-format-choice {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.btn-format-choice:hover {
  border-color: #38bdf8;
  color: #fff;
}
.btn-format-choice.selected {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

/* 2-Column Showcase Catalog Grid */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

@media (min-width: 600px) {
  .showcase-grid {
    gap: 14px;
  }
}

.showcase-card {
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.showcase-card:active {
  transform: scale(0.98);
}

.showcase-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.showcase-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.showcase-card:hover .showcase-card-img {
  transform: scale(1.04);
}

.showcase-badge-stock {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.showcase-card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.showcase-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 34px;
}

.showcase-card-prices {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}

.showcase-card-price {
  font-size: 15px;
  font-weight: 800;
  color: #10b981;
}

.showcase-card-market {
  font-size: 11px;
  color: #94a3b8;
  text-decoration: line-through;
}

.showcase-card-actions {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 6px;
}

.btn-showcase-buy {
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}

.btn-showcase-buy:active {
  opacity: 0.85;
}

.btn-showcase-cart {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-showcase-cart:active {
  background: rgba(56, 189, 248, 0.3);
}

/* VkusVill Style Floating Bottom Cart Bar */
.bottom-cart-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 480px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1.5px solid #38bdf8;
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8), 0 0 18px rgba(56, 189, 248, 0.35);
  z-index: 90;
  cursor: pointer;
  animation: slideUpCartBar 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s, box-shadow 0.15s;
}

.bottom-cart-bar:active {
  transform: translateX(-50%) scale(0.98);
}

@keyframes slideUpCartBar {
  from {
    opacity: 0;
    transform: translate(-50%, 25px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.bottom-cart-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bottom-cart-badge-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bottom-cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #38bdf8;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
}

.bottom-cart-meta {
  display: flex;
  flex-direction: column;
}

.bottom-cart-price {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.2;
}

.bottom-cart-timer {
  font-size: 11.5px;
  font-weight: 700;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 4px;
}

.bottom-cart-btn {
  background: #10b981;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  white-space: nowrap;
}

/* Certificate Checkbox Limiter States */
.cert-checkbox-disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  border-color: #334155 !important;
  background: rgba(15, 23, 42, 0.4) !important;
}

.has-bottom-cart {
  padding-bottom: 90px !important;
}



