/* ═══════════════════════════════════════════════════════════════
   Free Wheel – Styles v1.2  |  VQMM style
   Colorful · Fun · Game-like · Inherits theme font
   ═══════════════════════════════════════════════════════════════ */

/* ── Light theme (default – matches logo style) ─────────────────── */
.fw-app.fw-theme-light {
  --fw-bg:          #f0f4ff;
  --fw-bg-grad:     linear-gradient(160deg, #eef2ff 0%, #fdf4ff 50%, #fff7ed 100%);
  --fw-surface:     #ffffff;
  --fw-surface2:    #f5f7ff;
  --fw-accent:      #6c63ff;
  --fw-accent2:     #ff6b9d;
  --fw-gold:        #f59e0b;
  --fw-text:        #1e1b4b;
  --fw-muted:       #7c7aaa;
  --fw-border:      rgba(108,99,255,.15);
  --fw-topbar-bg:   rgba(255,255,255,.85);
  --fw-scrollbar:   rgba(108,99,255,.2);
  --fw-hist-sep:    rgba(108,99,255,.08);
  --fw-select-bg:   #fff;
  --fw-panel-shadow:0 2px 16px rgba(108,99,255,.08);
  --fw-btn-shadow:  0 4px 16px rgba(108,99,255,.3);
  --fw-radius:      18px;
  --fw-radius-sm:   10px;
}

/* ── Dark theme ─────────────────────────────────────────────────── */
.fw-app.fw-theme-dark {
  --fw-bg:          #13111e;
  --fw-bg-grad:     linear-gradient(160deg, #13111e 0%, #1a1030 50%, #1e1018 100%);
  --fw-surface:     rgba(255,255,255,.06);
  --fw-surface2:    rgba(255,255,255,.10);
  --fw-accent:      #7c6fff;
  --fw-accent2:     #ff6b9d;
  --fw-gold:        #fbbf24;
  --fw-text:        #eee9ff;
  --fw-muted:       #9d97cc;
  --fw-border:      rgba(124,111,255,.2);
  --fw-topbar-bg:   rgba(255,255,255,.04);
  --fw-scrollbar:   rgba(255,255,255,.15);
  --fw-hist-sep:    rgba(255,255,255,.06);
  --fw-select-bg:   #1e1a36;
  --fw-panel-shadow:0 2px 16px rgba(0,0,0,.3);
  --fw-btn-shadow:  0 4px 20px rgba(124,111,255,.4);
  --fw-radius:      18px;
  --fw-radius-sm:   10px;
}

/* ── Base ───────────────────────────────────────────────────────── */
.fw-app {
  font-family:   inherit;
  font-size:     inherit;
  background:    var(--fw-bg-grad);
  color:         var(--fw-text);
  border-radius: var(--fw-radius);
  overflow:      hidden;
  box-sizing:    border-box;
  transition:    background .3s, color .3s;
  position:      relative;
}
.fw-app *, .fw-app *::before, .fw-app *::after { box-sizing: border-box; }

/* Fullscreen */
.fw-app.fw-is-fullscreen {
  position: fixed !important; inset: 0 !important;
  z-index: 999999 !important; border-radius: 0 !important;
  overflow-y: auto;
}
.fw-app.fw-is-fullscreen .fw-wheel-col { position: static; }

/* ── Topbar ─────────────────────────────────────────────────────── */
.fw-topbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
  padding:         12px 20px;
  background:      var(--fw-topbar-bg);
  border-bottom:   1px solid var(--fw-border);
  backdrop-filter: blur(12px);
}

.fw-title-wrap {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.fw-title-star {
  font-size: 16px;
  background: linear-gradient(135deg, #6c63ff, #ff6b9d);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  animation: fw-star-spin 4s linear infinite;
}
@keyframes fw-star-spin { to { transform: rotate(360deg); } }

.fw-title {
  font-family:   inherit;
  font-size:     1.1rem;
  font-weight:   800;
  background:    linear-gradient(135deg, #6c63ff 0%, #ff6b9d 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0; padding: 3px 8px;
  border-radius: 8px;
  border: 2px solid transparent;
  outline: none; cursor: text;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 340px; line-height: 1.3;
  transition: border-color .15s, background-color .15s;
}
.fw-title:empty::before {
  content: attr(data-placeholder);
  background: none; -webkit-text-fill-color: var(--fw-muted);
  font-style: italic;
}
.fw-title:focus {
  border-color: var(--fw-accent);
  background-color: var(--fw-surface);
  -webkit-background-clip: unset; background-clip: unset;
  -webkit-text-fill-color: var(--fw-text);
  white-space: normal; text-overflow: clip;
}
.fw-title-pencil {
  color: var(--fw-muted); flex-shrink: 0; opacity: .5;
  transition: opacity .15s; display: flex; line-height: 1;
}
.fw-title-wrap:hover .fw-title-pencil { opacity: 1; }

/* Topbar icon buttons */
.fw-topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.fw-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1.5px solid var(--fw-border);
  border-radius: 10px;
  background: var(--fw-surface);
  color: var(--fw-muted);
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
.fw-icon-btn:hover {
  background: var(--fw-accent); color: #fff;
  border-color: var(--fw-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,99,255,.35);
}
.fw-icon-btn:active { transform: scale(.9); }
.fw-ico { width: 16px; height: 16px; display: block; }

/* Theme icons */
.fw-theme-light .fw-ico-sun  { display: block; }
.fw-theme-light .fw-ico-moon { display: none;  }
.fw-theme-dark  .fw-ico-sun  { display: none;  }
.fw-theme-dark  .fw-ico-moon { display: block; }

.fw-ico-compress { display: none; }
.fw-is-fullscreen .fw-ico-expand   { display: none;  }
.fw-is-fullscreen .fw-ico-compress { display: block; }

/* ── Body layout ────────────────────────────────────────────────── */
.fw-body {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
  padding: 20px 20px 28px;
  align-items: start;
}
@media (max-width: 740px) {
  .fw-body {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px 12px 24px;
  }
}

/* ── Wheel column ───────────────────────────────────────────────── */
.fw-wheel-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  position: sticky;
  top: 0;
  min-height: calc(100vh - 80px);
  overflow: visible;
}
@media (max-width: 740px) {
  .fw-wheel-col {
    position: static;
    min-height: unset;
    width: 100%;
  }
}

/* Sparkles */
.fw-sparkles {
  position: absolute; width: 460px; height: 460px;
  pointer-events: none; z-index: 1;
}
.fw-spark {
  position: absolute; font-size: 16px; font-weight: 900;
  background: linear-gradient(135deg, #6c63ff, #ff6b9d, #fbbf24);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: .7;
}
.fw-spark-1 { top: 12%; left: 6%;  animation: fw-twinkle 2.1s ease-in-out infinite; }
.fw-spark-2 { top: 6%;  right: 8%; animation: fw-twinkle 1.7s ease-in-out infinite .4s; font-size:12px; }
.fw-spark-3 { bottom:10%; left: 4%;animation: fw-twinkle 2.4s ease-in-out infinite .2s; font-size:10px; }
.fw-spark-4 { bottom:8%;  right:6%;animation: fw-twinkle 1.9s ease-in-out infinite .6s; }
.fw-spark-5 { top:50%;    left:-1%;animation: fw-twinkle 2.2s ease-in-out infinite .9s; font-size:11px; }
@keyframes fw-twinkle {
  0%,100% { transform: scale(1) rotate(0deg);   opacity: .6; }
  50%      { transform: scale(1.4) rotate(20deg);opacity: 1;  }
}

/* ── Wheel scene: chứa canvas + pointer, overflow visible ───────── */
.fw-wheel-scene {
  position: relative;
  display:  inline-flex;   /* co theo canvas, không full-width */
  align-items: center;
  justify-content: center;
  z-index: 2;
  overflow: visible;
}

/* Animated glow ring behind wheel */
.fw-wheel-glow {
  position: absolute; inset: -12px; border-radius: 50%;
  background: conic-gradient(
    #ff6b6b, #ffd93d, #6bcb77, #4d96ff,
    #c77dff, #ff6b9d, #ff6b6b
  );
  opacity: .35; filter: blur(14px);
  animation: fw-glow-spin 6s linear infinite;
  z-index: 0;
}
@keyframes fw-glow-spin { to { transform: rotate(360deg); } }

.fw-wheel-wrap {
  position: relative;
  display:  inline-block;
  z-index:  1;
}

/* Canvas fluid */
.fw-canvas,
.fw-confetti {
  display: block;
  max-width: 100%;
  height: auto;
}
.fw-canvas {
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255,255,255,.9),
              0 0 0 10px rgba(108,99,255,.2),
              0 20px 60px rgba(108,99,255,.3);
}
}
.fw-theme-dark .fw-canvas {
  box-shadow: 0 0 0 5px rgba(255,255,255,.08),
              0 0 0 9px rgba(124,111,255,.25),
              0 20px 60px rgba(0,0,0,.5);
}
.fw-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 20; border-radius: 50%; }

/* ── Pointer ────────────────────────────────────────────────────── */
.fw-pointer-hand {
  position:       absolute;
  top:            calc(50% - 45px);
  right:          -52px;
  width:          90px;
  height:         90px;
  z-index:        40;
  pointer-events: none;
  filter:         drop-shadow(-4px 2px 6px rgba(0,0,0,.55));
  animation:      fw-ptr-bob 1.5s ease-in-out infinite;
}
@keyframes fw-ptr-bob {
  0%,100% { transform: translateX(0);    }
  50%      { transform: translateX(-9px); }
}

/* ── Nút V tâm bánh ─────────────────────────────────────────────
   Kích thước cố định 52px, overlay chính giữa canvas.          */
.fw-center-btn {
  position:      absolute;
  top:           50%;
  left:          50%;
  transform:     translate(-50%, -50%);
  width:         52px;
  height:        52px;
  border-radius: 50%;
  border:        3px solid #fff;
  /* Gradient đẹp như logo: tím sáng → tím đậm */
  background:    radial-gradient(circle at 35% 35%, #9d8fff, #4a41e0 70%);
  color:         #fff;
  font-family:   inherit;
  font-weight:   900;
  font-size:     1.4rem;
  letter-spacing: -.02em;
  cursor:        pointer;
  z-index:       25;
  padding:       0;
  line-height:   1;
  display:       flex;
  align-items:   center;
  justify-content: center;
  /* Outer glow */
  box-shadow:
    0 0 0 4px rgba(108,99,255,.25),
    0 4px 18px rgba(74,65,224,.55),
    inset 0 1px 0 rgba(255,255,255,.35);
  transition:    transform .12s, box-shadow .12s;
}
.fw-center-btn:hover {
  transform:  translate(-50%, -50%) scale(1.1);
  box-shadow:
    0 0 0 5px rgba(108,99,255,.35),
    0 6px 24px rgba(74,65,224,.7),
    inset 0 1px 0 rgba(255,255,255,.35);
}
.fw-center-btn:active {
  transform: translate(-50%, -50%) scale(.93);
}

.fw-canvas {
  display: block; border-radius: 50%;
  box-shadow:
    0 0 0 6px rgba(255,255,255,.9),
    0 0 0 10px rgba(108,99,255,.2),
    0 20px 60px rgba(108,99,255,.3);
}
.fw-theme-dark .fw-canvas {
  box-shadow:
    0 0 0 5px rgba(255,255,255,.08),
    0 0 0 9px rgba(124,111,255,.25),
    0 20px 60px rgba(0,0,0,.5);
}
.fw-confetti {
  position: absolute; inset: 0; pointer-events: none; z-index: 20; border-radius: 50%;
}

/* ── Spin button – gradient, game style ─────────────────────────── */
.fw-spin-btn {
  font-family:    inherit;
  padding:        15px 56px;
  font-size:      1.05rem;
  font-weight:    900;
  letter-spacing: .06em;
  border:         none; border-radius: 50px; cursor: pointer; color: #fff;
  background:     linear-gradient(135deg, #6c63ff 0%, #ff6b9d 50%, #fbbf24 100%);
  background-size: 200% 200%;
  box-shadow:     var(--fw-btn-shadow);
  transition:     transform .15s, box-shadow .15s;
  position: relative; overflow: hidden;
  animation: fw-btn-shimmer 3s ease-in-out infinite, fw-btn-pulse 2s ease-in-out infinite;
}
.fw-spin-btn .fw-btn-shine {
  position: absolute; top: 0; left: -70%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  animation: fw-shine 2.8s ease-in-out infinite;
}
@keyframes fw-shine {
  0%,100% { left: -70%; }
  50%      { left: 130%; }
}
@keyframes fw-btn-shimmer {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes fw-btn-pulse {
  0%,100% { box-shadow: var(--fw-btn-shadow); }
  50%      { box-shadow: 0 6px 28px rgba(108,99,255,.55), 0 0 0 4px rgba(108,99,255,.1); }
}
.fw-spin-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 36px rgba(108,99,255,.5);
}
.fw-spin-btn:active:not(:disabled) { transform: scale(.97); }
.fw-spin-btn:disabled { opacity: .45; cursor: not-allowed; animation: none; box-shadow: none; }
.fw-spin-btn.fw-spinning { animation: fw-btn-shimmer 1s ease-in-out infinite; }

/* ── Result ─────────────────────────────────────────────────────── */
.fw-result-wrap {
  text-align: center; min-height: 52px;
  display: flex; align-items: center; justify-content: center; width: 100%;
}
.fw-result {
  display: inline-block; padding: 12px 28px; border-radius: 50px;
  font-family: inherit; font-weight: 900; font-size: 1.1rem;
  animation: fw-pop .4s cubic-bezier(.34,1.56,.64,1);
  max-width: 100%; text-align: center;
}
@keyframes fw-pop {
  from { transform: scale(.5) rotate(-8deg); opacity: 0; }
  to   { transform: scale(1)  rotate(0);     opacity: 1; }
}

.fw-spin-meta { font-family: inherit; font-size: 12px; color: var(--fw-muted); margin: 0; }
.fw-spin-meta strong { color: var(--fw-gold); font-weight: 800; }

/* ── Sidebar panels ─────────────────────────────────────────────── */
.fw-side { display: flex; flex-direction: column; gap: 12px; }

.fw-panel {
  background:    var(--fw-surface);
  border:        1.5px solid var(--fw-border);
  border-radius: var(--fw-radius);
  padding:       14px 16px;
  box-shadow:    var(--fw-panel-shadow);
  transition:    background .3s, border-color .3s;
}
.fw-panel:hover { border-color: rgba(108,99,255,.3); }

.fw-panel-title {
  font-family: inherit; font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fw-muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
}
.fw-panel-icon { font-size: 14px; }

.fw-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6c63ff, #ff6b9d);
  color: #fff; font-size: 10px; font-weight: 900;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px;
  font-family: inherit; margin-left: auto;
}

/* ── Textarea ───────────────────────────────────────────────────── */
.fw-textarea {
  width: 100%; resize: vertical;
  background: var(--fw-surface2); border: 1.5px solid var(--fw-border);
  border-radius: var(--fw-radius-sm); color: var(--fw-text);
  font-family: inherit; font-size: 13px; line-height: 1.8;
  padding: 10px 12px; outline: none;
  transition: border-color .2s, background .3s;
}
.fw-textarea:focus { border-color: var(--fw-accent); box-shadow: 0 0 0 3px rgba(108,99,255,.1); }
.fw-textarea::placeholder { color: var(--fw-muted); font-size: 12px; }
.fw-hint { font-family: inherit; font-size: 11px; color: var(--fw-muted); margin: 6px 0 0; }

/* ── Buttons ────────────────────────────────────────────────────── */
.fw-btn-row { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }

.fw-btn {
  flex: 1; padding: 8px 6px; font-family: inherit; font-size: 12px; font-weight: 700;
  border-radius: var(--fw-radius-sm); cursor: pointer;
  border: 1.5px solid var(--fw-border);
  background: var(--fw-surface2); color: var(--fw-text);
  transition: all .15s; white-space: nowrap; min-width: 56px; text-align: center;
}
.fw-btn:hover {
  background: var(--fw-accent); color: #fff; border-color: var(--fw-accent);
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,99,255,.3);
}
.fw-btn:active { transform: scale(.96); }

.fw-btn-primary {
  background: linear-gradient(135deg, #6c63ff, #9d8fff);
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 12px rgba(108,99,255,.35);
}
.fw-btn-primary:hover { background: linear-gradient(135deg, #5a52ee, #8a7eef); color: #fff; }

.fw-btn-danger { border-color: rgba(255,107,107,.3); color: #ef4444; }
.fw-btn-danger:hover { background: #ef4444; color: #fff; border-color: #ef4444; box-shadow: 0 4px 12px rgba(239,68,68,.3); }

/* ── Toggle / select ────────────────────────────────────────────── */
.fw-options { display: flex; flex-direction: column; gap: 10px; }
.fw-opt {
  display: flex; align-items: center; justify-content: space-between;
  font-family: inherit; font-size: 13px; color: var(--fw-muted); gap: 10px;
}
.fw-opt span { flex: 1; }

.fw-toggle {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 40px; height: 22px; border: none; outline: none;
  background: var(--fw-surface2); border-radius: 11px; cursor: pointer;
  position: relative; transition: background .25s;
  border: 1.5px solid var(--fw-border);
}
.fw-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--fw-muted); transition: left .2s, background .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.fw-toggle:checked {
  background: linear-gradient(135deg, #6c63ff, #ff6b9d);
  border-color: transparent;
}
.fw-toggle:checked::after { left: 20px; background: #fff; }

.fw-select {
  background: var(--fw-surface2); border: 1.5px solid var(--fw-border);
  color: var(--fw-text); border-radius: var(--fw-radius-sm);
  padding: 5px 10px; font-family: inherit; font-size: 12px; outline: none; cursor: pointer;
}
.fw-select:focus { border-color: var(--fw-accent); }
.fw-select option { background: var(--fw-select-bg); color: var(--fw-text); }

/* ── Entry list ─────────────────────────────────────────────────── */
.fw-entry-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 220px; overflow-y: auto;
}
.fw-entry-list::-webkit-scrollbar { width: 4px; }
.fw-entry-list::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--fw-accent), var(--fw-accent2));
  border-radius: 4px;
}

.fw-entry {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--fw-radius-sm);
  font-size: 13px; font-family: inherit; transition: background .15s;
}
.fw-entry:hover { background: var(--fw-surface2); }
.fw-entry-dot   { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.fw-entry-name  { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-entry-del   {
  background: none; border: none; cursor: pointer; color: var(--fw-muted);
  font-size: 17px; line-height: 1; padding: 0 2px; opacity: 0;
  transition: color .15s; font-family: monospace;
}
.fw-entry:hover .fw-entry-del { opacity: 1; }
.fw-entry-del:hover { color: #ef4444; }

/* ── History ────────────────────────────────────────────────────── */
.fw-history-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 150px; overflow-y: auto;
}
.fw-history-list::-webkit-scrollbar { width: 4px; }
.fw-history-list::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--fw-accent), var(--fw-accent2)); border-radius: 4px;
}

.fw-hist-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-family: inherit; padding: 5px 0;
  border-bottom: 1px solid var(--fw-hist-sep);
}
.fw-hist-item:last-child { border-bottom: none; }
.fw-hist-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fw-hist-name { flex: 1; font-weight: 700; color: var(--fw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-hist-num  { font-size: 10px; color: var(--fw-muted); background: var(--fw-surface2); padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.fw-hist-time { font-size: 10px; color: var(--fw-muted); flex-shrink: 0; }

/* ── Empty states ───────────────────────────────────────────────── */
.fw-empty { font-family: inherit; color: var(--fw-muted); font-size: 12px; text-align: center; padding: 16px 0; }
