/* ==========================================================================
   琦琦听写宝 - 前台样式表 v1.6.2
   更新: 2026-02-01 - 修复iOS Safari蓝色选择框问题
   ========================================================================== */

/* CSS 自定义属性 */
:root {
  --color-primary: #2c5aa0;
  --color-primary-light: #1e88e5;
  --color-secondary: #43e97b;
  --color-secondary-light: #38f9d7;
  --color-accent: #64b5f6;
  --color-accent-light: rgba(100, 181, 246, 0.1);
  --color-success: #43e97b;
  --color-warning: #ffa500;
  --color-danger: #ff6b6b;
  --color-info: #64b5f6;
  --color-text-primary: #2c5aa0;
  --color-text-secondary: #666;
  --color-text-muted: #999;
  --color-bg-light: rgba(255, 255, 255, 0.95);
  --color-save-deck: #ff9800;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --border-radius-xl: 30px;
  --transition-speed: 0.3s;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'Comic Sans MS', cursive, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 0;
  color: var(--color-text-primary);
  line-height: 1.6;
}

/* 关键修复：拖拽时禁止全页面选择 */
body.dragging {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-user-drag: none !important;
  overflow: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--color-bg-light);
  border-radius: var(--border-radius-xl);
  padding: 30px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  min-height: 100vh;
}

/* 板块控制按钮样式 */
.section-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.section-toggle-btn {
  padding: 8px 16px;
  background: white;
  border: 2px solid var(--color-accent);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.section-toggle-btn:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
}

/* 分类导航板块 */
.category-section {
  margin-bottom: 25px;
  transition: all var(--transition-speed);
}

.category-section.hidden {
  display: none !important;
}

/* 卡组选择板块 */
.deck-section {
  margin-bottom: 25px;
  transition: all var(--transition-speed);
}

.deck-section.hidden {
  display: none !important;
}

/* 头部样式 - 恢复居中对齐 */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 25px;
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-light) 100%);
  border-radius: var(--border-radius-lg);
  color: #0a4e3e;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%230a4e2e' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
  opacity: 0.1;
}

.title {
  font-size: 2.5rem;
  margin-bottom: 10px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 15px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* 分类标签 */
.category-tabs {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--color-accent-light);
  border-radius: var(--border-radius-lg);
  overflow-x: auto;
  flex-wrap: wrap;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) transparent;
}

.category-tabs::-webkit-scrollbar {
  height: 6px;
}

.category-tab {
  padding: 8px 16px;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-size: 1rem;
  white-space: nowrap;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.category-tab:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
  border-color: var(--color-accent);
}

.category-tab.active {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%);
  color: #0a4e3e;
  border-color: var(--color-success);
  font-weight: bold;
  box-shadow: var(--shadow-md);
}

/* 卡组图标区域 */
.deck-icons-container {
  margin-bottom: 25px;
  min-height: 120px;
}

.deck-preview-title {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-bottom: 15px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
}

.deck-preview-title::after {
  content: attr(data-count);
  background: var(--color-success);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-left: 8px;
}

.deck-icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 20px;
  justify-content: center;
}

.deck-icon {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 15px 10px;
  aspect-ratio: 1/1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-md);
  border: 3px solid transparent;
  user-select: none;
}

.deck-icon:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.deck-icon.active {
  border-color: var(--color-success);
  background: linear-gradient(135deg, rgba(67, 233, 123, 0.15) 0%, rgba(56, 249, 215, 0.15) 100%);
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}

.deck-icon-emoji {
  font-size: 2.8rem;
  margin-bottom: 5px;
}

.deck-icon-name {
  font-size: 0.75rem;
  text-align: center;
  color: var(--color-text-secondary);
  font-weight: bold;
  line-height: 1.2;
}

.deck-icon-category {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* 输入区域 */
.input-section {
  margin-bottom: 25px;
  padding: 20px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: var(--border-radius-lg);
}

.input-label {
  display: block;
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-bottom: 10px;
  font-weight: bold;
}

.word-input {
  width: 100%;
  min-height: 80px;
  padding: 15px;
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius);
  font-size: 1rem;
  resize: vertical;
  font-family: var(--font-family);
  transition: all var(--transition-speed);
}

.word-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.15);
}

.input-hint {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

.input-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

/* 词语网格 */
.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.words-grid.hidden {
  display: none;
}

.word-box {
  background: white;
  border-radius: var(--border-radius);
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-md);
  border: 3px solid transparent;
  user-select: none;
}

.word-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.word-box.reading {
  border-color: var(--color-success);
  background: linear-gradient(135deg, rgba(67, 233, 123, 0.1) 0%, rgba(56, 249, 215, 0.1) 100%);
  animation: pulse 1s infinite;
}

.word-box.completed {
  border-color: #ccc;
  background: rgba(0, 0, 0, 0.05);
  opacity: 0.7;
}

.word-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-primary);
  margin-bottom: 5px;
  word-break: break-word;
}

/* 音标显示样式 */
.word-phonetic {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 5px;
  font-family: 'Arial', sans-serif;
}

.word-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* 控制按钮 */
.control-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 25px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%);
  width: 0%;
  transition: width 0.3s ease;
}

/* 当前朗读显示 */
.current-word-display {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  padding: 20px;
  border-radius: var(--border-radius-lg);
  text-align: center;
  margin-bottom: 25px;
  display: none;
  box-shadow: var(--shadow-md);
}

.current-word-display.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

.current-word-display.hidden {
  display: none !important;
}

.current-word-label {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 10px;
}

.current-word-text {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 10px;
  word-break: break-word;
}

.timer-display {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* 状态栏 */
.status {
  background: rgba(255, 193, 7, 0.1);
  padding: 15px;
  border-radius: var(--border-radius);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1rem;
  border: 2px solid rgba(255, 193, 7, 0.3);
  font-weight: 500;
  animation: fadeIn 0.5s ease;
}

/* 设置菜单 */
.settings-menu {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
}

.settings-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-speed);
}

.settings-toggle:hover {
  transform: rotate(90deg) scale(1.1);
}

.settings-dropdown {
  position: absolute;
  top: 70px;
  right: 0;
  background: white;
  border-radius: var(--border-radius);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: none;
  min-width: 220px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all var(--transition-speed);
  z-index: 2001;
}

.settings-dropdown.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.settings-item {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 1rem;
  color: var(--color-text-primary);
  background: var(--color-accent-light);
  font-weight: bold;
}

.settings-item:hover {
  background: rgba(100, 181, 246, 0.2);
  transform: translateX(-5px);
}

.settings-item:last-child {
  margin-bottom: 0;
}

.settings-item span {
  font-size: 1.2rem;
}

/* 翻译面板 */
.translation-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-height: 400px;
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1999;
  display: none;
  overflow: hidden;
}

.translation-panel.active {
  display: block;
  animation: slideIn 0.3s ease;
}

.translation-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-panel-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-speed);
}

.close-panel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.translation-content {
  padding: 20px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  max-height: 250px;
  overflow-y: auto;
  word-break: break-word;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.active {
  display: flex;
  animation: fadeIn 0.4s ease;
}

.modal-content {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 30px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.4s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  font-size: 1.8rem;
  color: var(--color-primary);
  margin-bottom: 20px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--color-accent-light);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--color-text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-speed);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-danger);
}

/* 教程弹窗样式 */
#tutorialModal .modal-content {
  max-width: 650px;
  border-radius: 25px;
  padding: 35px;
  background: linear-gradient(135deg, #fff9e6 0%, #e6f7ff 100%);
  border: 5px solid var(--color-accent);
}

#tutorialModal .modal-header {
  border-bottom: none;
  margin-bottom: 25px;
  justify-content: center;
  text-align: center;
  position: relative;
}

#tutorialModal .modal-header > div {
  flex-direction: column;
}

#tutorialModal .modal-header span:last-child {
  font-size: 2rem;
  color: var(--color-primary);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

#tutorialModal .modal-close {
  position: absolute;
  right: -15px;
  top: -15px;
  background: var(--color-danger);
  color: white;
  border: 3px solid white;
}

/* 词典查询模态框 */
#dictionaryQueryModal .modal-content {
  max-width: 650px;
  border-radius: 25px;
  padding: 35px;
  background: linear-gradient(135deg, #fff9e6 0%, #e6f7ff 100%);
  border: 5px solid var(--color-accent);
}

#dictionaryQueryModal .modal-header {
  border-bottom: none;
  margin-bottom: 25px;
  justify-content: center;
  text-align: center;
  position: relative;
}

#dictionaryQueryModal .modal-header > div {
  flex-direction: column;
}

#dictionaryQueryModal .modal-header span:last-child {
  font-size: 2rem;
  color: var(--color-primary);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

#dictionaryQueryModal .modal-close {
  position: absolute;
  right: -15px;
  top: -15px;
  background: var(--color-danger);
  color: white;
  border: 3px solid white;
}

.word-search-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 15px;
  transition: all var(--transition-speed);
}

.word-search-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.15);
}

/* 搜索结果区域 */
#dictionaryQueryResults {
  background: white;
  border-radius: 18px;
  padding: 15px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
  border: 3px solid var(--color-accent);
}

#dictionaryQueryResults .search-result-item {
  background: linear-gradient(135deg, #fff 0%, var(--color-accent-light) 100%);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
  border: 2px solid transparent;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}

#dictionaryQueryResults .search-result-item:hover {
  transform: translateY(-3px);
  border-color: var(--color-success);
  box-shadow: var(--shadow-md);
}

#dictionaryQueryResults .search-result-word {
  font-size: 1.3rem;
  color: var(--color-primary);
  font-weight: bold;
  margin-bottom: 8px;
}

#dictionaryQueryResults .search-result-translation {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
}

/* 预设时间按钮 */
.preset-time-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.preset-btn {
  flex: 1;
  min-width: 60px;
  padding: 15px;
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius);
  background: white;
  cursor: pointer;
  transition: all var(--transition-speed);
  text-align: center;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.preset-btn:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
}

.preset-btn.active {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%);
  color: #0a4e3e;
  border-color: var(--color-success);
  font-weight: bold;
}

.preset-btn span {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 5px;
}

/* 自定义时间区域 */
.custom-time-section {
  background: var(--color-accent-light);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

.custom-time-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--color-accent);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 15px;
  transition: all var(--transition-speed);
}

.custom-time-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.15);
}

.confirm-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%);
  color: #0a4e3e;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.confirm-btn:hover {
  transform: translateY(-2px);
}

.current-time-display {
  text-align: center;
  padding: 15px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: var(--border-radius);
  color: var(--color-primary);
  font-weight: bold;
}

.current-time-display span {
  color: var(--color-success);
  font-size: 1.5rem;
}

/* 发音设置 */
.voice-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.voice-btn {
  flex: 1;
  min-width: 80px;
  padding: 15px;
  border: 2px solid var(--color-accent);
  border-radius: var(--border-radius);
  background: white;
  cursor: pointer;
  transition: all var(--transition-speed);
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

.voice-btn:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
}

.voice-btn.active {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%);
  color: #0a4e3e;
  border-color: var(--color-success);
  font-weight: bold;
}

.voice-btn span {
  display: block;
  font-size: 32px;
  margin-bottom: 5px;
}

.current-voice-display {
  text-align: center;
  padding: 15px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: var(--border-radius);
  color: var(--color-primary);
  font-weight: bold;
}

.current-voice-display span {
  color: var(--color-success);
  font-size: 1.5rem;
}

/* 按钮基础样式 */
.btn-large, .btn-hero, .admin-btn {
  border: none;
  border-radius: var(--border-radius);
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
}

.btn-large {
  padding: 12px 24px;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
}

.btn-hero {
  padding: 16px 32px;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
  min-width: 140px;
}

.btn-hero:hover, .btn-large:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn-hero:disabled, .btn-large:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* 按钮颜色变体 */
.btn-add, .btn-play { 
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-secondary-light) 100%); 
  color: #0a4e3e; 
}
.btn-save-deck { 
  background: linear-gradient(135deg, var(--color-save-deck) 0%, #ffb74d 100%);
  color: white; 
}
.btn-toggle-cards { 
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary-light) 100%); 
  color: white; 
}
.btn-clear, .btn-stop { 
  background: linear-gradient(135deg, var(--color-danger) 0%, #fad0c4 100%); 
  color: #7a1e3c; 
}
.btn-pause { 
  background: linear-gradient(135deg, var(--color-warning) 0%, #ffca28 100%); 
  color: white; 
}

/* 动画定义 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 15px 8px;
    margin: 0;
    min-height: 100vh;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  
  .header {
    margin: -15px -8px 20px -8px;
    border-radius: 0;
    padding: 20px 15px;
  }
  
  .title {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .section-controls {
    justify-content: center;
  }
  
  .deck-icons-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 12px;
  }
  
  .deck-icon {
    padding: 12px 8px;
  }
  
  .deck-icon-emoji {
    font-size: 2.2rem;
  }
  
  .input-section {
    padding: 15px;
  }
  
  .btn-large {
    padding: 10px 16px;
    font-size: 1rem;
  }
  
  .btn-hero {
    padding: 14px 24px;
    font-size: 1.1rem;
    min-width: 120px;
  }
  
  .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }
  
  .word-box {
    padding: 12px 8px;
  }
  
  .current-word-text {
    font-size: 2rem;
  }
  
  .settings-menu {
    top: 10px;
    right: 10px;
  }
  
  .modal-content {
    padding: 20px;
    width: 95%;
  }
}

/* ===== 拖拽排序相关样式（全部统一为左右方向） ===== */

/* 定位指示器 - 统一为垂直线（左右方向） */
.position-indicator {
  position: absolute;
  width: 4px;
  height: 100%;
  background: #ff6b6b;
  z-index: 100;
  animation: pulse 0.6s ease-in-out infinite;
  pointer-events: none;
  border-radius: 2px;
  top: 0;
}

/* 插入到目标左侧（前面） */
.position-indicator[data-position="before"] {
  left: -2px;
  box-shadow: 2px 0 8px rgba(255, 107, 107, 0.6);
}

/* 插入到目标右侧（后面） */
.position-indicator[data-position="after"] {
  right: -2px;
  box-shadow: -2px 0 8px rgba(255, 107, 107, 0.6);
}

/* 拖拽时目标元素高亮 */
.drag-over {
  border: 3px dashed #64b5f6 !important;
  background: rgba(100, 181, 246, 0.1) !important;
  transform: scale(1.02) !important;
}

/* 拖拽中的元素样式 */
[draggable="true"]:active {
  opacity: 0.7;
  cursor: move;
  z-index: 1000;
}

/* 可拖拽元素基础样式（禁止文本选择） */
.deck-icon, .category-tab, .word-box {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* 关键修复：禁止所有子元素选择，防止iOS Safari蓝色框 */
.deck-icon *, .category-tab *, .word-box * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* 移动端长按时的视觉反馈 */
@media (hover: none) {
  .deck-icon, .category-tab, .word-box {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
  }
}

/* 拖拽后的弹跳动画 */
@keyframes bounce {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  80% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* 定位指示器的脉冲动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 确保拖拽时body不滚动 */
body.dragging {
  overflow: hidden;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Safari特定：禁止所有选择和高亮 */
@supports (-webkit-touch-callout: none) {
  html, body,
  .deck-icon, .category-tab, .word-box,
  .deck-icon *, .category-tab *, .word-box *,
  #deckIcons, #wordsGrid, #categoryTabs {
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-user-drag: none !important;
    -webkit-highlight: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Safari的选择高亮覆盖 */
  ::selection {
    background: transparent !important;
    color: inherit !important;
  }
  
  ::-moz-selection {
    background: transparent !important;
    color: inherit !important;
  }
}

/* 终极禁止选择：覆盖所有可能情况 */
body.dragging,
body.dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-user-drag: none !important;
}

/* 明确禁止容器选择 */
#deckIcons, #wordsGrid, #categoryTabs {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* 定位指示器绝对禁止交互 */
.position-indicator {
  pointer-events: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

/* 拖拽过程中的所有元素 */
.drag-over, 
.drag-over *,
[draggable="true"]:active,
[draggable="true"]:active * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
