/* ================================
   凯撒密码加解密工具 - 自定义样式
   ================================ */

:root {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1E293B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: rgba(79, 70, 229, 0.08);
  --secondary: #F97316;
  --accent: #EC4899;
  --success: #059669;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Toast */
.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

#header.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

.tool-section { padding: 24px 0 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}
.panel:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.08); }

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  flex-wrap: wrap; gap: 10px;
}
.panel-title { font-size: 16px; font-weight: 700; color: var(--text); }

/* ROT13 button */
.rot13-btn {
  padding: 6px 14px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 100px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: #D97706; cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.rot13-btn:hover { background: rgba(245,158,11,0.2); border-color: rgba(245,158,11,0.4); }

/* Mode tabs */
.mode-tabs { display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 100px; padding: 2px; background: var(--surface); }
.mode-tab {
  padding: 6px 16px; background: transparent; border: none;
  border-radius: 100px; font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s ease;
  white-space: nowrap;
}
.mode-tab.active { background: var(--primary); color: white; }

.panel-body { padding: 20px; }

/* Slider */
.slider-group { margin-bottom: 20px; }
.slider-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.slider-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.slider-value {
  font-size: 22px; font-weight: 700; color: var(--primary);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  min-width: 36px; text-align: right;
}

.range-slider {
  width: 100%; height: 6px;
  -webkit-appearance: none; appearance: none;
  background: var(--border);
  border-radius: 10px; outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.range-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Wheel */
.wheel-container {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wheel-row {
  display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto;
  scrollbar-width: thin;
}
.wheel-row:last-child { margin-bottom: 0; }
.wheel-cell {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.wheel-cell.source {
  background: rgba(79,70,229,0.08); border-color: rgba(79,70,229,0.25); color: var(--primary);
}
.wheel-cell.target {
  background: rgba(5,150,105,0.08); border-color: rgba(5,150,105,0.2); color: var(--success);
}
.wheel-arrow-hint {
  text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 8px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.input-field {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 15px; color: var(--text);
  transition: all 0.2s ease; outline: none;
}
.input-field:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.input-field::placeholder { color: #9CA3AF; }
.input-field--mono { font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace; font-size: 14px; }
.textarea-field { resize: vertical; min-height: 80px; }

/* Output with copy */
.output-row { position: relative; }
.btn-copy-textarea {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
  z-index: 2;
}
.btn-copy-textarea:hover { background: var(--primary-light); border-color: rgba(79,70,229,0.25); color: var(--primary); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #A5B4FC; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4F46E5; }
::selection { background: rgba(79, 70, 229, 0.2); color: #1E293B; }

.guide-section {
  margin-top: 16px; margin-bottom: 64px;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.guide-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 20px; background: none; border: none;
  cursor: pointer; transition: background 0.15s ease;
}
.guide-toggle:hover { background: var(--bg-alt); }
.guide-toggle-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: #1E293B;
}
.guide-toggle.open .toggle-arrow { transform: rotate(180deg); }
.toggle-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.guide-list { padding: 0 20px 20px; }
.guide-list.hidden { display: none; }
.guide-item { padding: 16px 0; border-top: 1px solid var(--border); }
.guide-item:first-child { border-top: 1px solid var(--border); }
.guide-item-title { font-size: 14px; font-weight: 600; color: #1E293B; margin-bottom: 6px; }
.guide-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.guide-item-body kbd {
  padding: 1px 6px; background: var(--bg-alt);
  border: 1px solid var(--border-strong); border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 12px; color: var(--text-secondary);
}

@media (max-width: 768px) {
  .page { padding: 0 16px; }
  .panel-header { flex-direction: column; gap: 10px; align-items: flex-start; }
}
