/* ==========================================================================
   VÒNG QUAY MAY MẮN - Styles
   ========================================================================== */

/* Google Fonts - Loaded via HTML <link> */
:root {
  --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --panel-bg: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.14);
  --panel-blur: 14px;
  --accent: #ffd84d;
  --accent-2: #ff5ca8;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.72);
  --text-muted: rgba(255, 255, 255, 0.45);
  --success: #4ade80;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s ease;
  --app-font: "Be Vietnam Pro", "Baloo 2", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  font-family: var(--app-font);
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { position: relative; }

/* Custom cursor state */
body.custom-cursor, body.custom-cursor * { cursor: none !important; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* ===== Light BG override (dark text scheme for bright backgrounds) ===== */
body.light-bg {
  --text: #1a1a2e;
  --text-dim: rgba(26, 26, 46, 0.78);
  --text-muted: rgba(26, 26, 46, 0.55);
  --panel-bg: rgba(255, 255, 255, 0.55);
  --panel-border: rgba(0, 0, 0, 0.1);
  color: #1a1a2e;
}
body.light-bg .site-header .logo { color: #1a1a2e; }
body.light-bg nav.main-nav a { color: rgba(26, 26, 46, 0.72); }
body.light-bg nav.main-nav a:hover { color: #1a1a2e; background: rgba(0,0,0,0.06); }
body.light-bg nav.main-nav a.active { color: #c2185b; background: rgba(255,255,255,0.5); }
body.light-bg .icon-btn {
  background: rgba(255,255,255,0.55);
  color: #1a1a2e;
  border-color: rgba(0,0,0,0.1);
}
body.light-bg .icon-btn:hover { background: rgba(255,255,255,0.8); }
body.light-bg .kbd-hint { color: rgba(26, 26, 46, 0.65); }
body.light-bg .kbd-hint kbd {
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.15);
  color: #1a1a2e;
}
body.light-bg .tabs-nav {
  background: rgba(255,255,255,0.5);
  border-bottom-color: rgba(0,0,0,0.08);
}
body.light-bg .tab-btn { color: rgba(26,26,46,0.7); }
body.light-bg .tab-btn:hover { color: #1a1a2e; background: rgba(0,0,0,0.04); }
body.light-bg .tab-btn.active { color: #c2185b; }
body.light-bg .tab-btn.active::after { background: #c2185b; }
body.light-bg .section-title { color: #1a1a2e; }
body.light-bg .section-title .count {
  background: rgba(0,0,0,0.08);
  color: rgba(26,26,46,0.7);
}
body.light-bg .input,
body.light-bg .textarea,
body.light-bg select {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.12);
  color: #1a1a2e;
}
body.light-bg .input:focus,
body.light-bg .textarea:focus,
body.light-bg select:focus { border-color: #c2185b; }
body.light-bg .btn {
  background: rgba(255,255,255,0.7);
  color: #1a1a2e;
  border-color: rgba(0,0,0,0.12);
}
body.light-bg .btn:hover { background: rgba(255,255,255,0.9); }
body.light-bg .btn.primary { color: #fff; }
body.light-bg .btn.danger { background: rgba(239,68,68,0.15); color: #b91c1c; border-color: rgba(239,68,68,0.4); }
body.light-bg .preset-item {
  background: rgba(255,255,255,0.5);
  color: #1a1a2e;
}
body.light-bg .preset-item:hover { background: rgba(255,255,255,0.8); }
body.light-bg .preset-item.active {
  border-color: #c2185b;
  background: rgba(255,192,203,0.5);
}
body.light-bg .font-item {
  background: rgba(255,255,255,0.5);
  color: #1a1a2e;
}
body.light-bg .font-item:hover { background: rgba(255,255,255,0.8); }
body.light-bg .font-item.active { border-color: #c2185b; background: rgba(255,192,203,0.5); }
body.light-bg .font-item .preview { color: rgba(26,26,46,0.6); }
body.light-bg .toggle-row { color: #1a1a2e; }
body.light-bg .toggle-row + .toggle-row { border-top-color: rgba(0,0,0,0.08); }
body.light-bg .switch { background: rgba(0,0,0,0.18); }
body.light-bg .switch.on { background: #22c55e; }
body.light-bg .slider-row label { color: rgba(26,26,46,0.7); }
body.light-bg .slider-row label span { color: #c2185b; }
body.light-bg input[type="range"] { background: rgba(0,0,0,0.15); }
body.light-bg input[type="range"]::-webkit-slider-thumb { background: #c2185b; }
body.light-bg input[type="range"]::-moz-range-thumb { background: #c2185b; }
body.light-bg .item-row {
  background: rgba(255,255,255,0.55);
  color: #1a1a2e;
}
body.light-bg .item-row:hover { background: rgba(255,255,255,0.85); }
body.light-bg .item-row .drag-handle { color: rgba(26,26,46,0.5); }
body.light-bg .history-empty { color: rgba(26,26,46,0.55); }
body.light-bg .history-item {
  background: rgba(255,255,255,0.55);
  color: #1a1a2e;
}
body.light-bg .history-item .idx { color: #c2185b; }
body.light-bg .history-item .ts { color: rgba(26,26,46,0.55); }
body.light-bg .color-picker-row { color: rgba(26,26,46,0.8); }
body.light-bg .seo-section {
  background: rgba(255,255,255,0.6);
  color: #1a1a2e;
  border-color: rgba(0,0,0,0.08);
}
body.light-bg .seo-section h1,
body.light-bg .seo-section h2,
body.light-bg .seo-section h3,
body.light-bg .seo-section strong { color: #1a1a2e; }
body.light-bg .seo-section h2 { border-left-color: #c2185b; }
body.light-bg .seo-section .faq-item { background: rgba(255,255,255,0.6); }
body.light-bg .template-card {
  background: rgba(255,255,255,0.7);
  color: #1a1a2e;
  border-color: rgba(0,0,0,0.1);
}
body.light-bg .template-card:hover {
  background: rgba(255,255,255,0.95);
  border-color: #c2185b;
}
body.light-bg .template-card p { color: rgba(26,26,46,0.7); }
body.light-bg .site-footer {
  background: rgba(255,255,255,0.5);
  color: rgba(26,26,46,0.75);
  border-top-color: rgba(0,0,0,0.08);
}
body.light-bg .site-footer a { color: rgba(26,26,46,0.8); }
body.light-bg .site-footer a:hover { color: #c2185b; }
body.light-bg .tpl-header p { color: rgba(26,26,46,0.75); }
body.light-bg a { color: #c2185b; }

/* ===== Top Gradient Bar ===== */
.top-gradient-bar {
  height: 5px;
  background: linear-gradient(90deg, #ff6ec4, #7873f5, #4ade80, #facc15, #ff6ec4);
  background-size: 200% 100%;
  animation: gradient-slide 6s linear infinite;
}
body.no-gradient-bar .top-gradient-bar { display: none; }
@keyframes gradient-slide {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ===== Header / Nav ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  position: relative;
  z-index: 5;
  flex-wrap: wrap;
  gap: 10px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 20px;
  color: var(--text);
}
.logo-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: conic-gradient(#ff4d6d, #ffd84d, #4ade80, #60a5fa, #c084fc, #ff4d6d);
  box-shadow: 0 0 18px rgba(255,216,77,0.5);
  position: relative;
}
.logo-icon::after {
  content: ""; position: absolute; inset: 30%;
  background: #fff; border-radius: 50%;
}
nav.main-nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav.main-nav a {
  color: var(--text-dim); font-weight: 500; font-size: 14px;
  padding: 6px 10px; border-radius: 8px;
  transition: var(--transition);
}
nav.main-nav a:hover { color: var(--text); background: rgba(255,255,255,0.08); text-decoration: none; }
nav.main-nav a.active { color: var(--accent); background: rgba(255,255,255,0.06); }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.1);
}
.icon-btn:hover { background: rgba(255,255,255,0.16); transform: translateY(-1px); }

/* ===== Keyboard hint ===== */
.kbd-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 auto 10px;
  padding: 6px 14px;
  display: inline-block;
}
.kbd-hint kbd {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  margin: 0 2px;
}
.kbd-hint-wrap { text-align: center; }

/* ===== Main Layout ===== */
.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  padding: 8px 28px 40px;
  max-width: 1500px;
  margin: 0 auto;
}

.wheel-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-height: 560px;
}

.wheel-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
  aspect-ratio: 1 / 1;
  margin: 20px auto;
  display: flex; align-items: center; justify-content: center;
}

#wheelCanvas {
  width: 100%; height: 100%;
  display: block;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.55));
}
body.no-wheel-shadow #wheelCanvas { filter: none; }

/* Pointer — combines two layers of motion for realism (r10 update):
   1) --needle-pos : continuous spring-physics deflection set by JS each frame
      (port of vongquaymayman.info needleKick: vel += -SPRING*pos; vel *= DAMPING)
   2) .tick CSS animation : short visual kick on each slice cross
   The two compose via CSS `transform` so JS can update --needle-pos at 60fps
   while CSS animation handles the snappy "flap" on each tick.
*/
.pointer {
  position: absolute;
  top: -10px; left: 50%;
  /* Use translateX + rotate(--needle-pos) so JS spring physics applies smoothly. */
  --needle-pos: 0deg;
  --tick-intensity: 1;
  transform: translateX(-50%) rotate(var(--needle-pos));
  transform-origin: 50% 18%;
  width: 56px; height: 78px;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}
/* Tick keyframe: brief kick on slice cross, scales with --tick-intensity.
   Composes on top of --needle-pos by re-using rotate(var(--needle-pos)) at end. */
.pointer.tick { animation: pointer-tick 0.10s cubic-bezier(.2,.6,.2,1); }
@keyframes pointer-tick {
  0%   { transform: translateX(-50%) rotate(var(--needle-pos)); }
  40%  { transform: translateX(-50%) rotate(calc(var(--needle-pos) - 14deg * var(--tick-intensity))); }
  100% { transform: translateX(-50%) rotate(var(--needle-pos)); }
}

/* Wheel-wrap glow + subtle scale while spinning — adds life without distorting the canvas. */
.wheel-wrap.is-spinning::before {
  content: "";
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 60, 0.25), transparent 65%);
  animation: wheel-glow-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes wheel-glow-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

/* Subtle button "pressed/spinning" state */
.spin-btn.spinning {
  animation: spin-btn-pulse 0.9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes spin-btn-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 180, 0, 0.55), inset 0 -6px 14px rgba(0,0,0,0.25); transform: translate(-50%, -50%) scale(1); }
  50%      { box-shadow: 0 6px 22px rgba(255, 200, 30, 0.85), inset 0 -6px 14px rgba(0,0,0,0.25); transform: translate(-50%, -50%) scale(0.97); }
}

/* Center Spin Button */
.spin-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22%; height: 22%;
  min-width: 80px; min-height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe58a, #ffb300 60%, #c77700);
  color: #3a1f00;
  font-weight: 900; font-size: clamp(16px, 2.2vw, 22px);
  letter-spacing: 0.05em;
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.9),
    0 0 0 8px rgba(0,0,0,0.35),
    0 10px 22px rgba(0,0,0,0.45),
    inset 0 -6px 10px rgba(0,0,0,0.18),
    inset 0 6px 10px rgba(255,255,255,0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 4;
  user-select: none;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.spin-btn:hover { transform: translate(-50%, -50%) scale(1.06); }
.spin-btn:active { transform: translate(-50%, -50%) scale(0.96); }
.spin-btn.disabled { opacity: 0.7; cursor: not-allowed; }

/* ===== Side Panel ===== */
.side-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 100px);
  position: sticky;
  top: 16px;
}

.tabs-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--panel-border);
}
.tab-btn {
  padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-dim);
  font-size: 12px; font-weight: 600;
  position: relative;
  transition: var(--transition);
}
.tab-btn i { font-size: 16px; }
.tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.tab-btn.active { color: var(--accent); }
.tab-btn.active::after {
  content: ""; position: absolute; bottom: 0; left: 10%; right: 10%; height: 3px;
  background: var(--accent); border-radius: 3px 3px 0 0;
}

.tab-panel {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  display: none;
}
.tab-panel.active { display: block; }
.tab-panel::-webkit-scrollbar { width: 8px; }
.tab-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; }

/* Section heading inside panel */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 6px;
  letter-spacing: 0.02em;
}
.section-title:first-child { margin-top: 4px; }
.section-title .count {
  margin-left: auto; font-size: 11px; color: var(--text-muted); font-weight: 500;
  background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 10px;
}

/* Form inputs */
.input, .textarea, select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus, .textarea:focus, select:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 160px; line-height: 1.5; font-family: inherit; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #ff5ca8, #c040ff); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.4); color: #fecaca; }
.btn.danger:hover { background: rgba(239,68,68,0.3); }
.btn.small { padding: 6px 10px; font-size: 12px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Preset Grid (color/background/effect options) */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.preset-item {
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 62px;
  justify-content: center;
  user-select: none;
}
.preset-item:hover { background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.preset-item.active { border-color: var(--accent); background: rgba(255,216,77,0.14); }

.color-dots { display: flex; gap: 2px; }
.color-dots span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bg-preview {
  width: 100%; height: 26px; border-radius: 6px;
  background: rgba(255,255,255,0.1);
}

.preset-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.preset-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* Font list */
.font-list {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  max-height: 260px; overflow-y: auto;
  padding-right: 4px;
}
.font-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-size: 14px;
  transition: var(--transition);
}
.font-item:hover { background: rgba(255,255,255,0.1); }
.font-item.active { border-color: var(--accent); background: rgba(255,216,77,0.12); }
.font-item .preview { color: var(--text-dim); font-size: 14px; }

/* Toggle Switch */
.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px;
  font-size: 13px;
  color: var(--text);
}
.toggle-row + .toggle-row { border-top: 1px solid rgba(255,255,255,0.06); }
.switch {
  position: relative;
  width: 40px; height: 22px;
  background: rgba(255,255,255,0.18);
  border-radius: 22px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.switch.on { background: #4ade80; }
.switch.on::after { left: 20px; }

/* Slider */
.slider-row {
  margin: 10px 0;
}
.slider-row label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-dim); margin-bottom: 6px;
}
.slider-row label span { color: var(--accent); font-weight: 600; }
input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 6px; background: rgba(255,255,255,0.18); border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}

/* Color picker */
.color-picker-row {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0;
  font-size: 13px; color: var(--text-dim);
}
input[type="color"] {
  width: 40px; height: 30px; border: none; border-radius: 8px;
  background: transparent; cursor: pointer; padding: 0;
}
input[type="color"]::-webkit-color-swatch { border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 6px; }

/* Item list */
.item-list { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.item-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  font-size: 13px;
  transition: var(--transition);
}
.item-row:hover { background: rgba(255,255,255,0.1); }
.item-row .drag-handle {
  cursor: grab; color: var(--text-muted); padding: 2px;
}
.item-row .item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row .remove-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(239,68,68,0.2); color: #fecaca;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.item-row .remove-btn:hover { background: rgba(239,68,68,0.5); }
.item-row.dragging { opacity: 0.4; }

/* History */
.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 10px;
  font-size: 14px;
}
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 13px;
}
.history-item .idx { color: var(--accent); font-weight: 700; margin-right: 8px; }
.history-item .ts { font-size: 11px; color: var(--text-muted); }

/* ===== Result Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: linear-gradient(135deg, #4a148c, #7b1fa2);
  border-radius: 20px;
  padding: 40px 36px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  animation: scale-in 0.45s cubic-bezier(0.3, 1.4, 0.4, 1);
  position: relative;
  border: 1px solid rgba(255,255,255,0.2);
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}
.modal-title { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.modal-sub { font-size: 14px; color: var(--text-dim); margin-bottom: 18px; }
.modal-result {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 900;
  background: linear-gradient(90deg, #ffd84d, #ff5ca8, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 18px 10px;
  word-wrap: break-word;
  line-height: 1.2;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-top: 18px;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  color: white;
  font-size: 18px;
}
.modal-close:hover { background: rgba(0,0,0,0.5); }

/* ===== Overlay Canvases for effects ===== */
#bgEffectCanvas, #confettiCanvas, #cursorTrailCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
#confettiCanvas { z-index: 1100; }
#cursorTrailCanvas { z-index: 1200; }

/* Ensure main app content is above background effects */
.site-header, .app-layout, .seo-section, .site-footer, .top-gradient-bar, .kbd-hint-wrap {
  position: relative;
  z-index: 2;
}

#customCursor {
  position: fixed;
  pointer-events: none;
  z-index: 1300;
  width: 32px; height: 32px;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  display: none;
  color: var(--accent);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 12px 22px;
  border-radius: 30px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== SEO Content ===== */
.seo-section {
  max-width: 960px;
  margin: 40px auto;
  padding: 30px 28px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  line-height: 1.75;
  color: var(--text-dim);
  font-size: 15px;
}
.seo-section h1 { font-size: 28px; margin: 0 0 20px; color: var(--text); }
.seo-section h2 {
  font-size: 22px; margin: 28px 0 12px; color: var(--text);
  border-left: 4px solid var(--accent); padding-left: 12px;
}
.seo-section h3 { font-size: 17px; margin: 18px 0 8px; color: var(--text); }
.seo-section p { margin: 0 0 14px; }
.seo-section ul, .seo-section ol { margin: 0 0 14px; padding-left: 26px; }
.seo-section li { margin-bottom: 6px; }
.seo-section strong { color: var(--text); }
.seo-section .faq-item { margin-bottom: 14px; padding: 12px 16px; background: rgba(255,255,255,0.04); border-radius: 10px; }
.seo-section .faq-item p:last-child { margin: 0; }

.templates-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-top: 14px;
}
.template-card {
  display: block;
  padding: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: var(--text);
  transition: var(--transition);
  text-decoration: none !important;
}
.template-card:hover { background: rgba(255,255,255,0.12); transform: translateY(-3px); border-color: var(--accent); }
.template-card h4 { margin: 0 0 6px; font-size: 16px; }
.template-card p { margin: 0; font-size: 13px; color: var(--text-dim); }

/* ===== Footer ===== */
.site-footer {
  padding: 30px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
  margin-top: 40px;
}
.site-footer .footer-links {
  display: flex; gap: 16px; justify-content: center; margin-bottom: 12px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--accent); }

/* ===== Fullscreen ===== */
:fullscreen .site-header,
:fullscreen .side-panel,
:fullscreen .seo-section,
:fullscreen .site-footer,
:fullscreen .top-gradient-bar,
:fullscreen .kbd-hint-wrap { display: none !important; }
:fullscreen .app-layout { grid-template-columns: 1fr; padding: 0; }
:fullscreen .wheel-wrap { max-width: 92vmin; }

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  .app-layout { grid-template-columns: 1fr; padding: 8px 16px 40px; }
  .side-panel {
    max-height: none;
    position: static;
  }
  .wheel-wrap { max-width: 520px; }
}
@media (max-width: 640px) {
  .site-header { padding: 10px 14px; }
  nav.main-nav { display: none; }
  .logo { font-size: 17px; }
  .wheel-wrap { max-width: 100%; margin: 10px auto; }
  .tab-panel { padding: 14px; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .seo-section { padding: 20px 16px; font-size: 14px; }
  .seo-section h1 { font-size: 22px; }
  .seo-section h2 { font-size: 18px; }
}

/* Utility */
.hide { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .input { flex: 1; }
.grow { flex: 1; }
.text-small { font-size: 12px; color: var(--text-muted); }
.mb-6 { margin-bottom: 6px; } .mb-10 { margin-bottom: 10px; } .mb-14 { margin-bottom: 14px; }
.mt-6 { margin-top: 6px; } .mt-10 { margin-top: 10px; }

/* Templates header */
.tpl-header {
  text-align: center; padding: 20px 20px 0;
}
.tpl-header h1 {
  font-size: clamp(24px, 4vw, 36px);
  margin: 10px 0 6px;
  background: linear-gradient(90deg, #ffd84d, #ff5ca8, #60a5fa);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.tpl-header p { color: var(--text-dim); margin: 0 0 14px; font-size: 15px; }

/* ========== Accessibility / SEO 2026 additions ========== */

/* Skip link: visually-hidden until focused (WCAG 2.4.1).
   Uses the proven "clip" pattern (1px square, clipped, off-screen) which works
   reliably across all browsers/devices and isn't affected by transform paint
   timing or browser auto-focus heuristics.
   When focused (keyboard Tab), it expands into a visible button at the top. */
.skip-link {
  position: fixed !important;
  top: -100px;
  left: 50%;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  background: #ffd60a;
  color: #0f0c29;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  z-index: 99999;
  pointer-events: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  padding: 10px 20px;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  outline: 3px solid #ff006e;
  outline-offset: 2px;
  pointer-events: auto;
}

/* Breadcrumb: only used inside <main> on content pages (info, blog, glossary) — NOT on template/home */
.breadcrumb-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.72);
}
/* When inside a narrow content container, align breadcrumb with that container */
.info-page-wrap + * .breadcrumb-nav,
main > .breadcrumb-nav { padding-left: 24px; padding-right: 24px; }
.breadcrumb-nav ol {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 8px;
  list-style: none; margin: 0; padding: 0;
}
.breadcrumb-nav li {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0; padding: 0;
}
.breadcrumb-nav a {
  color: #06ffa5; text-decoration: none;
  border-bottom: 1px dotted rgba(6,255,165,0.5);
  padding: 2px 0;
}
.breadcrumb-nav a:hover { color: #ffd60a; border-bottom-color: #ffd60a; }
.breadcrumb-nav .sep { color: rgba(255,255,255,0.45); font-size: 14px; }
.breadcrumb-nav [aria-current="page"] {
  color: #fff; font-weight: 600;
  max-width: 60vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Quick Answer block: contained, with proper spacing — only inside main containers */
.quick-answer {
  max-width: 1180px;
  margin: 14px auto 18px;
  padding: 14px 20px;
  background: linear-gradient(90deg, rgba(255,214,10,0.14), rgba(255,0,110,0.10));
  border-left: 4px solid #ffd60a;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.quick-answer strong { color: #ffd60a; margin-right: 6px; }

/* Light-bg variant for templates with bright background (already used by tpl-page) */
body.light-bg .quick-answer {
  background: linear-gradient(90deg, rgba(194,24,91,0.10), rgba(255,193,7,0.10));
  color: #1a1a2e;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
body.light-bg .quick-answer strong { color: #c2185b; }
body.light-bg .breadcrumb-nav { color: rgba(26,26,46,0.7); }
body.light-bg .breadcrumb-nav a { color: #c2185b; border-bottom-color: rgba(194,24,91,0.5); }
body.light-bg .breadcrumb-nav a:hover { color: #1a1a2e; border-bottom-color: #1a1a2e; }
body.light-bg .breadcrumb-nav .sep { color: rgba(26,26,46,0.45); }
body.light-bg .breadcrumb-nav [aria-current="page"] { color: #1a1a2e; }

/* Footer E-E-A-T meta line */
.footer-eeat {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
}
.footer-eeat a { color: rgba(255,255,255,0.8); text-decoration: underline; }
body.light-bg .footer-eeat { color: rgba(26,26,46,0.7); }
body.light-bg .footer-eeat a { color: #c2185b; }

/* ===== Static informational pages (about / editorial / privacy / contact / glossary) ===== */
/* Outer wrap provides background + padding so content never touches viewport edges.
   Narrower max-width (820px) gives a clear "card-on-page" reading layout instead of
   the previous full-screen feel. */
.info-page-wrap {
  max-width: 820px;
  margin: 32px auto 56px;
  padding: 0 20px;
}
/* Glossary uses a slightly wider container because it has a 2-column TOC */
.info-page-wrap.is-glossary { max-width: 920px; }

.info-page {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 36px clamp(20px, 4vw, 44px);
  color: #e5e7eb;
  line-height: 1.7;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.info-page h1 {
  font-size: clamp(26px, 4vw, 36px);
  background: linear-gradient(90deg, #ffd60a, #ff006e, #06ffa5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 0 0 14px;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.info-page h2 {
  font-size: clamp(18px, 2.4vw, 22px);
  margin: 30px 0 10px;
  color: #ffd60a;
  border-left: 3px solid #ffd60a;
  padding-left: 12px;
  line-height: 1.35;
}
.info-page h3 {
  font-size: clamp(15px, 2vw, 17px);
  margin: 18px 0 8px;
  color: #06ffa5;
  line-height: 1.4;
}
.info-page p, .info-page li {
  font-size: 15px; line-height: 1.75;
  color: rgba(255,255,255,0.86);
}
.info-page p { margin: 0 0 12px; }
.info-page ul, .info-page ol { margin: 0 0 14px; padding-left: 22px; }
.info-page li { margin-bottom: 6px; }
.info-page strong { color: #fff; }
.info-page a {
  color: #06ffa5; text-decoration: underline; text-underline-offset: 2px;
  word-break: break-word;
}
.info-page a:hover { color: #ffd60a; }
.info-page code {
  background: rgba(255,255,255,0.10);
  padding: 2px 6px; border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  color: #ffd60a;
  word-break: break-all;
}
.info-page table {
  width: 100%; border-collapse: collapse;
  margin: 18px 0; font-size: 14px;
  display: block; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.info-page table thead, .info-page table tbody { display: table; width: 100%; }
.info-page th, .info-page td {
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 12px; text-align: left;
  vertical-align: top;
}
.info-page th { background: rgba(255,255,255,0.06); color: #ffd60a; }
.info-page .meta-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px; padding: 18px; margin: 18px 0;
}

/* Glossary TOC 2 columns + term sections */
.glossary-toc {
  columns: 2;
  column-gap: 24px;
  margin: 18px 0 24px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  list-style: none;
}
.glossary-toc li {
  break-inside: avoid;
  margin: 0 0 6px;
  padding: 0;
  font-size: 14px;
}
.glossary-toc a { display: inline-block; padding: 2px 0; }
.glossary-term {
  scroll-margin-top: 90px;
  padding: 14px 0 6px;
  border-top: 1px dashed rgba(255,255,255,0.10);
}
.glossary-term:first-of-type { border-top: 0; }
.glossary-term .related {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}
.glossary-term .related a { font-size: 13px; }

/* ===== Responsive for info pages + breadcrumb + quick-answer ===== */
@media (max-width: 768px) {
  .info-page-wrap { padding: 0 12px; margin: 16px auto 30px; }
  .info-page { padding: 24px 18px; border-radius: 14px; }
  .info-page h1 { font-size: 24px; }
  .info-page h2 { font-size: 18px; margin-top: 22px; }
  .info-page p, .info-page li { font-size: 14.5px; }
  .breadcrumb-nav { padding: 8px 14px 0; font-size: 12.5px; }
  .breadcrumb-nav [aria-current="page"] { max-width: 50vw; }
  .quick-answer { margin-left: 12px; margin-right: 12px; padding: 12px 14px; font-size: 14px; }
  .glossary-toc { columns: 1; }
}
@media (max-width: 480px) {
  .info-page { padding: 20px 14px; }
  .info-page h1 { font-size: 22px; }
}

/* === Number range preset buttons (used on /vong-quay-so-ngau-nhien) === */
.num-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 6px;
}
.num-preset-btn {
  appearance: none;
  border: 1px solid rgba(255, 216, 77, 0.55);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.18), rgba(255, 92, 168, 0.18));
  color: #fff;
  font-family: var(--app-font);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.3px;
}
.num-preset-btn:hover {
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.4), rgba(255, 92, 168, 0.4));
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 216, 77, 0.25);
}
.num-preset-btn:active { transform: translateY(0); }
.num-preset-btn.alt {
  border-color: rgba(74, 222, 128, 0.55);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.18), rgba(56, 189, 248, 0.18));
}
.num-preset-btn.alt:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.4), rgba(56, 189, 248, 0.4));
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.25);
}
@media (max-width: 480px) {
  .num-preset-btn { font-size: 13px; padding: 8px 12px; }
}
