@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
  --tg-bg: #0e1621;
  --tg-header: #17212b;
  --tg-surface: #17212b;
  --tg-card: #242f3d;
  --tg-card-hover: #2b394a;
  --tg-border: #242f3d;
  --tg-blue: #2481cc;
  --tg-blue-bright: #50a7ea;
  --tg-green: #4fae4e;
  --tg-text-muted: #7e8c9b;
}

/* 鎖定全螢幕，防止手機瀏覽器橡皮筋下拉效果 */
html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background-color: var(--tg-bg);
}

/* Telegram 經典聊天背景微紋理 */
.tg-wallpaper {
  background-color: #0e1621;
  background-image: radial-gradient(#1e2c3a 1px, transparent 1px), radial-gradient(#17222d 1px, #0e1621 1px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
}

/* Telegram 浮動卡片 */
.tg-card {
  background: #242f3d;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Telegram 頂部與底部列 */
.tg-bar {
  background: #17212b;
  border-color: #202b36;
}

/* Telegram 亮藍色圓形 FAB 按鈕 */
.tg-fab-btn {
  background: linear-gradient(135deg, #2481cc 0%, #1f74b7 100%);
  box-shadow: 0 4px 16px rgba(36, 129, 204, 0.4);
  transition: all 0.15s ease;
}

.tg-fab-btn:active {
  transform: scale(0.94);
  filter: brightness(0.9);
}

/* Telegram 濾鏡 Chip 標籤 */
.tg-chip {
  background: #1c2733;
  color: #8c9ba9;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
}

.tg-chip.active {
  background: #2481cc;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(36, 129, 204, 0.35);
  border-color: #50a7ea;
}

.tg-chip:not(.active):active {
  background-color: #242f3d;
  transform: scale(0.96);
}

/* Telegram 分段切換器 (Segmented Tab) 與膠囊按鈕樣式 */
.effect-seg-btn, .mode-seg-btn, .tg-segment-btn, .shape-btn {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  color: #8c9ba9;
}

.effect-seg-btn.active, .mode-seg-btn.active, .tg-segment-btn.active, .shape-btn.active {
  background: #2481cc !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(36, 129, 204, 0.45);
}

.effect-seg-btn:not(.active):active, .mode-seg-btn:not(.active):active, .shape-btn:not(.active):active {
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(0.97);
}

/* Telegram 批次動作按鈕 (Action Button: 按壓時亮微光，鬆開即恢復，不恆亮霸佔藍色) */
.bulk-action-btn {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.bulk-action-btn:active {
  background-color: rgba(36, 129, 204, 0.4);
  color: #ffffff;
  transform: scale(0.96);
}

/* Telegram 底部 Emoji 橫向平滑滑動按鈕 */
.deck-emoji-btn {
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  border-radius: 12px;
  line-height: 1;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.deck-emoji-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.deck-emoji-btn:active {
  transform: scale(0.88);
}

.deck-emoji-btn.active {
  background-color: rgba(36, 129, 204, 0.25);
  border-color: #2481cc;
  box-shadow: none;
  transform: scale(1.06);
}

/* Telegram 高質感微調滑桿 (清晰可見底軌 + 亮藍已滑動進度條 + 實體精緻滑塊，徹底杜絕右側溢色) */
.tg-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  outline: none;
  background-color: #313f52;
  background-image: linear-gradient(to right, #2481cc 0%, #2481cc var(--slider-progress, 36%), transparent var(--slider-progress, 36%), transparent 100%);
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: background-image 0.05s ease;
}

.tg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #2481cc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 6px rgba(36, 129, 204, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tg-slider::-webkit-slider-thumb:active {
  transform: scale(1.25);
  box-shadow: 0 0 12px rgba(80, 167, 234, 0.7);
}

.tg-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #2481cc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.tg-slider::-moz-range-track {
  height: 6px;
  border-radius: 9999px;
  background: #313f52;
}

/* 隱藏原生捲軸 */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 畫布容器與觸控防滑 */
#canvas-container {
  touch-action: none;
}

#overlay-canvas {
  touch-action: none;
}

/* Telegram 藍色微光動畫 */
@keyframes tgPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 16px rgba(36, 129, 204, 0.4);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 6px 22px rgba(80, 167, 234, 0.55);
  }
}

.animate-tg-pulse {
  animation: tgPulse 3s infinite ease-in-out;
}

/* 底部抽屜滑入動畫 */
@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 客製化 Telegram 風格滑桿 */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: #17212b;
  border-radius: 9999px;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #50a7ea;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
