/* Denim DNA — Glass Morphism UI */

:root {
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --accent: #4a9eff;
  --accent-hover: #6bb3ff;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #0a0a0f;
  color: var(--text-primary);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Фон */
.bg-gradient {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(74, 158, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(100, 80, 200, 0.1) 0%, transparent 40%),
    linear-gradient(180deg, #0a0a12 0%, #12121a 100%);
  z-index: -1;
  pointer-events: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  position: relative;
  overflow: hidden;
}

/* Glass panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
}

/* CodePen-style glowy overlay on glass blocks */
.glow-panel {
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
  --glow-opacity: 0;
}

.glow-panel::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--x) var(--y),
    rgba(107, 179, 255, 0.28) 0%,
    rgba(107, 179, 255, 0.12) 18%,
    rgba(107, 179, 255, 0.0) 55%
  );
  opacity: var(--glow-opacity, 0);
  filter: blur(6px);
  transition: opacity 160ms ease;
}

.glow-panel > * {
  position: relative;
  z-index: 1;
}

.glow-panel:hover::after {
  opacity: 1;
}

/* 3D Canvas — на весь экран, как в Telegram Mini App (и в вебе) */
.canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  touch-action: none;
  background: #000000;
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Loader */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  font-size: 14px;
  z-index: 10;
  transition: opacity 0.3s;
}

.loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-hint {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  margin-top: 12px;
  padding: 0 12px;
}
.loader-hint code {
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Panel wrapper — для анимации скрытия/показа */
.panel-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.panel-wrapper.panel-hidden {
  transform: translateY(calc(100% + 20px));
  pointer-events: none;
}

/* Ручка для свайпа вниз (скрыть панель) — на всех размерах экрана */
.panel-swipe-handle {
  height: 32px;
  margin: -8px 0 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.panel-swipe-handle::before {
  content: '';
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

/* Ручка для возврата панели (когда скрыта) */
.panel-restore-handle {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  text-align: center;
  z-index: 50;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.restore-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Control panel — разрешаем свайп/скролл внутри панели */
.control-panel {
  margin: 12px 16px;
  padding: 16px;
  max-height: 42vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.panel-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  padding-right: 16px;
  min-height: 44px;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
  scrollbar-width: thin;
  cursor: grab;
  scroll-behavior: smooth;
}
.panel-tabs:active {
  cursor: grabbing;
}

.panel-tabs::-webkit-scrollbar {
  display: none;
}

.panel-tabs {
  scrollbar-width: none;
}

.tab {
  flex-shrink: 0;
  padding: 10px 16px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
}

.tab::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: radial-gradient(
    circle at var(--x) var(--y),
    rgba(107, 179, 255, 0.34) 0%,
    rgba(107, 179, 255, 0.10) 20%,
    transparent 58%
  );
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.tab:hover, .tab.active {
  background: rgba(74, 158, 255, 0.35);
  color: var(--text-primary);
}

.tab:hover::after, .tab.active::after {
  opacity: 1;
}

.panel-content {
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 30vh;
  padding-right: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.panel-content::-webkit-scrollbar {
  display: none;
}

.panel-content.active {
  display: block;
}

.panel-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.control-group {
  margin-bottom: 14px;
}

.control-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.control-group input[type="range"] {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(145deg, #5aadff 0%, var(--accent) 50%, #3a8ee6 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(74, 158, 255, 0.6), 0 0 0 2px rgba(255,255,255,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 14px rgba(74, 158, 255, 0.7);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(145deg, #5aadff 0%, var(--accent) 100%);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 10px rgba(74, 158, 255, 0.6);
}

.control-group input[type="range"]::-moz-range-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.control-group input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
}

.control-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: #1a1a2e;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.control-group select option {
  background: #1a1a2e;
  color: #ffffff;
  padding: 10px;
}

.control-group input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: #1a1a2e;
  color: var(--text-primary);
  font-size: 14px;
}

.control-group input[type="text"] {
  width: 80px;
  margin-left: 10px;
  padding: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
}

.btn::after,
.btn-send::after,
.stepper-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: radial-gradient(
    circle at var(--x) var(--y),
    rgba(107, 179, 255, 0.30) 0%,
    rgba(107, 179, 255, 0.09) 22%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.btn:hover::after,
.btn-send:hover::after,
.stepper-btn:hover::after {
  opacity: 1;
}

.glass-btn {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.4) 0%, rgba(74, 158, 255, 0.2) 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-btn:hover {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.5) 0%, rgba(74, 158, 255, 0.3) 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  margin-left: 8px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.control-group .btn {
  margin-right: 8px;
}

/* Holes preview */
.holes-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Stepper controls */
.control-stepper .stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-stepper .stepper input {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(74, 158, 255, 0.3);
  color: white;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
}

.stepper-btn:hover {
  background: rgba(74, 158, 255, 0.5);
}

/* Holes list */
.holes-list {
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: none;
}

.holes-list::-webkit-scrollbar {
  display: none;
}

.hole-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
}

.hole-item input {
  width: 50px;
  padding: 4px 8px;
  font-size: 12px;
}

.hole-item .btn-remove {
  padding: 4px 8px;
  font-size: 11px;
}

/* Bottom bar */
.bottom-bar {
  margin: 0 16px 16px;
  padding: 12px 16px;
}

.btn-send {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  --x: 50%;
  --y: 50%;
}

.btn-icon {
  font-size: 20px;
}

/* Brush overlay */
.brush-overlay {
  position: fixed;
  bottom: 100px;
  left: 16px;
  right: 16px;
  padding: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  z-index: 100;
  text-align: center;
}

.brush-overlay.hidden {
  display: none;
}

.brush-overlay p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hidden {
  display: none !important;
}

/* Кнопка «Обучение» */
.tutorial-help-btn {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  z-index: 45;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brush-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.brush-actions-row .btn-brush-mode {
  flex: 1 1 auto;
  min-width: 120px;
}

.brush-history-btns {
  display: inline-flex;
  gap: 4px;
}

.brush-icon-btn {
  min-width: 44px;
  padding: 10px 14px;
  font-size: 18px;
  line-height: 1;
}

/* Обучение */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  pointer-events: none;
}

.onboarding.hidden {
  display: none !important;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: auto;
  animation: onboardingBackdropIn 0.4s ease;
}

@keyframes onboardingBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.onboarding-visual {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  line-height: 1;
  opacity: 0.95;
}

.onboarding-visual.v-welcome::before {
  content: '👖';
  animation: onboardingPop 0.6s ease;
}

.onboarding-visual.v-rotate::before {
  content: '↻';
  color: var(--accent);
  animation: onboardingRotateHint 2.4s ease-in-out infinite;
}

.onboarding-visual.v-zoom::before {
  content: '🔍';
  animation: onboardingZoomHint 2s ease-in-out infinite;
}

.onboarding-visual.v-panel::before {
  content: '⚙️';
  animation: onboardingPop 0.5s ease infinite alternate;
}

.onboarding-visual.v-brush::before {
  content: '🖌';
  animation: onboardingBrushHint 2.2s ease-in-out infinite;
}

.onboarding-visual.v-send::before {
  content: '📤';
  animation: onboardingPop 1.2s ease-in-out infinite;
}

@keyframes onboardingRotateHint {
  0%, 100% { transform: rotate(0deg) scale(1); opacity: 1; }
  50% { transform: rotate(180deg) scale(1.08); opacity: 0.85; }
}

@keyframes onboardingZoomHint {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes onboardingBrushHint {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(8px, -6px); }
  50% { transform: translate(-6px, 4px); }
  75% { transform: translate(4px, 8px); }
}

@keyframes onboardingPop {
  from { transform: scale(0.85); opacity: 0.7; }
  to { transform: scale(1); opacity: 1; }
}

.onboarding-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  pointer-events: auto;
  animation: onboardingCardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.onboarding-step-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 8px;
}

.onboarding-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.25;
}

.onboarding-body {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.onboarding-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}

.onboarding-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: background 0.2s, transform 0.2s;
}

.onboarding-dots span.active {
  background: var(--accent);
  transform: scale(1.15);
}

.onboarding-actions {
  display: flex;
  gap: 10px;
}

.onboarding-actions .btn {
  flex: 1;
}

/* Модалка отправки */
.send-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.send-modal.hidden {
  display: none !important;
}

.send-modal-content {
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.send-modal-content h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.send-modal-howto {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: rgba(74, 158, 255, 0.12);
  border: 1px solid rgba(74, 158, 255, 0.28);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.send-modal-howto-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.send-modal-howto-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.send-modal-howto-list li {
  margin-bottom: 6px;
}

.send-modal-howto-list li:last-child {
  margin-bottom: 0;
}

.send-modal-text {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  user-select: text;
  -webkit-user-select: text;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 16px;
  max-height: 200px;
}

.send-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.send-modal-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* Режим просмотра (для дизайнера — только крутить модель) */
body.view-only .panel-wrapper,
body.view-only .panel-restore-handle {
  display: none !important;
}

body.view-only .canvas-container {
  position: fixed;
  inset: 0;
}

.view-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  border-radius: 20px;
  z-index: 50;
  animation: viewHintFade 4s ease-out forwards;
}

.view-hint.hidden {
  display: none !important;
  animation: none;
}

@keyframes viewHintFade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

/* Мобильные отступы нижней панели */
@media (max-width: 767px) {
  .bottom-bar {
    margin-bottom: calc(12px + var(--safe-bottom));
  }

  .panel-swipe-handle {
    height: 36px;
    margin: -8px 0 6px 0;
  }

  .panel-restore-handle {
    bottom: 0;
    padding-bottom: calc(12px + var(--safe-bottom));
  }
}

@media (min-width: 1024px) {
  .bottom-bar {
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .send-modal-content {
    max-width: 92vw;
    padding: 16px;
  }

  .send-modal-text {
    font-size: 12.5px;
    max-height: 38vh;
    margin-bottom: 12px;
  }

  .send-modal-actions {
    gap: 6px;
  }

  .send-modal-actions .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 12px 10px;
    font-size: 13px;
  }
}

/* Десктоп — сцена на весь экран; настройки справа сверху, кнопка отправки по центру внизу */
@media (min-width: 1024px) {
  .panel-content {
    max-height: min(42vh, 420px);
  }

  .control-panel {
    max-height: none;
  }

  /* Контейнер на весь вьюпорт: сетка вместо колонки снизу */
  .panel-wrapper {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    display: grid;
    grid-template-columns: 1fr minmax(300px, 400px);
    grid-template-rows: 1fr auto;
    align-items: start;
    justify-items: stretch;
    pointer-events: none;
  }

  .panel-wrapper .control-panel {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 100%;
    max-width: 400px;
    margin: calc(52px + var(--safe-top)) calc(16px + var(--safe-right)) 12px 0;
    pointer-events: auto;
    max-height: min(72vh, 560px);
  }

  .panel-wrapper .bottom-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: end;
    justify-self: center;
    width: fit-content;
    max-width: min(630px, calc(100vw - 32px));
    margin: 0 16px calc(16px + var(--safe-bottom));
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 15px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
  }

  .panel-wrapper .btn-send {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 15px 27px;
    font-size: 21px;
    gap: 12px;
    flex: 0 0 auto;
    border-radius: 18px;
  }

  .panel-wrapper .bottom-bar .btn-icon {
    font-size: 24px;
  }

  /* Ручка свайпа на ПК не нужна */
  .panel-swipe-handle {
    display: none;
  }
}

/* Dark theme from Telegram */
@media (prefers-color-scheme: light) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a1a;
    --text-secondary: rgba(0, 0, 0, 0.6);
  }

  body {
    background: #f0f2f5;
  }

  .bg-gradient {
    background: 
      radial-gradient(ellipse 80% 50% at 50% 0%, rgba(74, 158, 255, 0.12) 0%, transparent 50%),
      linear-gradient(180deg, #f5f7fa 0%, #e8ecf1 100%);
  }

  /* Контраст в светлой теме: лоадер и текст модалки */
  .loader {
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.9);
  }
  .loader-hint {
    color: rgba(255, 255, 255, 0.8);
  }
  .loader-hint code {
    background: rgba(0,0,0,0.35);
  }

  .send-modal-text {
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-primary);
  }

  .panel-swipe-handle::before {
    background: rgba(0, 0, 0, 0.18);
  }

  /* Поля ввода / select: в light теме оставляем светлый фон */
  .control-group select {
    background: rgba(255, 255, 255, 0.85);
    color: #111318;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  .control-group select option {
    background: #ffffff;
    color: #111318;
  }

  .control-group input[type="number"] {
    background: rgba(255, 255, 255, 0.85);
    color: #111318;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  .control-group input[type="text"] {
    background: rgba(255, 255, 255, 0.85);
    color: #111318;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  .control-group input[type="color"] {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
  }

  /* Чтобы цифры в stepper-input были читаемыми */
  .control-stepper .stepper input {
    color: #111318;
  }
}
