/* ==========================================================================
   عجلة الفخامة — style.css
   واجهة عربية RTL متجاوبة، فاتحة وداكنة، بدون أي اعتماديات خارجية.
   ========================================================================== */

/* Title face: Tajawal 800 (self-hosted subsets) ---------------------------- */
@font-face {
  font-family: "Tajawal Title";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/tajawal-800-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E,
    U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

@font-face {
  font-family: "Tajawal Title";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/tajawal-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF;
}

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #eef2fb;
  --bg-deep: #e3eaf7;
  --surface: #ffffff;
  --surface-2: #f6f8fe;
  --surface-3: #edf2fb;

  --text: #16213a;
  --text-strong: #0a1428;
  --muted: #66758f;
  --muted-2: #8d99b1;

  --border: #e2e8f3;
  --border-strong: #d2dbea;

  --accent: #6d4aff;
  --accent-strong: #5636e8;
  --accent-2: #06a9c7;
  --accent-soft: rgba(109, 74, 255, 0.11);
  --accent-soft-2: rgba(6, 169, 199, 0.12);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef476f;
  --danger-strong: #d92e57;
  --danger-soft: rgba(239, 71, 111, 0.11);

  --pointer: #ff3d71;
  --canvas-ring: rgba(255, 255, 255, 0.9);
  --canvas-line: rgba(255, 255, 255, 0.52);

  --toast-bg: #15213b;
  --toast-text: #ffffff;

  --shadow-xs: 0 1px 2px rgba(20, 33, 64, 0.05);
  --shadow-sm: 0 4px 14px rgba(20, 33, 64, 0.06);
  --shadow-md: 0 18px 46px -18px rgba(20, 33, 64, 0.24);
  --shadow-lg: 0 36px 90px -30px rgba(13, 24, 48, 0.42);
  --ring: 0 0 0 4px rgba(109, 74, 255, 0.16);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;

  --font: "Segoe UI", "Noto Sans Arabic", "Noto Kufi Arabic", Tahoma,
    "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-display: "Tajawal Title", "Segoe UI", Tahoma, Arial, sans-serif;
  --brand-dot: #2f6bff;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 1.25, 0.32, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080c17;
  --bg-deep: #0b1120;
  --surface: #11182a;
  --surface-2: #0d1424;
  --surface-3: #182137;

  --text: #e9eefb;
  --text-strong: #ffffff;
  --muted: #98a4bd;
  --muted-2: #74819b;

  --border: #1e2942;
  --border-strong: #2a3754;

  --accent: #8b6dff;
  --accent-strong: #a18aff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(139, 109, 255, 0.16);
  --accent-soft-2: rgba(34, 211, 238, 0.14);

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #ff5c86;
  --danger-strong: #ff7899;
  --danger-soft: rgba(255, 92, 134, 0.14);

  --pointer: #ff4d7d;
  --canvas-ring: rgba(255, 255, 255, 0.22);
  --canvas-line: rgba(9, 14, 28, 0.38);
  --brand-dot: #6f9bff;

  --toast-bg: #eef3ff;
  --toast-text: #0a1428;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 22px 54px -18px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 40px 100px -30px rgba(0, 0, 0, 0.78);
  --ring: 0 0 0 4px rgba(139, 109, 255, 0.22);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -10%, var(--accent-soft-2), transparent 36%),
    radial-gradient(circle at 8% 4%, var(--accent-soft), transparent 34%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
p {
  margin: 0;
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  color: #fff;
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   3. Ambient background
   -------------------------------------------------------------------------- */
.bg-orb {
  position: fixed;
  z-index: 0;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.55;
}

.bg-orb--one {
  top: -190px;
  inset-inline-end: -130px;
  background: radial-gradient(circle, rgba(109, 74, 255, 0.3), transparent 68%);
}

.bg-orb--two {
  bottom: -220px;
  inset-inline-start: -150px;
  background: radial-gradient(circle, rgba(6, 169, 199, 0.24), transparent 68%);
}

[data-theme="dark"] .bg-orb {
  opacity: 0.42;
}

/* --------------------------------------------------------------------------
   4. Shell
   -------------------------------------------------------------------------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 36px;
}

/* --------------------------------------------------------------------------
   5. Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__mark {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
}

.brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  min-width: 0;
}

.brand__text h1 {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: clamp(26px, 2.4vw, 31px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand__dot {
  margin-inline-start: 3px;
  color: var(--brand-dot);
  font-size: 2.2em;
  line-height: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0) scale(0.97);
}

.icon-btn .icon {
  width: 21px;
  height: 21px;
}

.icon-btn .icon--sound-off,
.icon-btn .icon--sun {
  display: none;
}

.icon-btn[data-sound="off"] .icon--sound-on {
  display: none;
}

.icon-btn[data-sound="off"] .icon--sound-off {
  display: block;
}

[data-theme="dark"] .icon-btn .icon--moon {
  display: none;
}

[data-theme="dark"] .icon-btn .icon--sun {
  display: block;
}

/* --------------------------------------------------------------------------
   6. Layout and cards
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  gap: clamp(16px, 2.2vw, 26px);
  align-items: start;
}

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: clamp(18px, 2.4vw, 28px);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(109, 74, 255, 0.45),
    rgba(6, 169, 199, 0.35),
    transparent
  );
  pointer-events: none;
}

.wheel-card {
  overflow: hidden;
}

.wheel-column {
  min-width: 0;
}

.developer-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}

.developer-credit img {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  object-fit: contain;
}

.editor-card {
  position: sticky;
  top: 20px;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.4;
}

.eyebrow--card {
  margin-bottom: 0;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

/* --------------------------------------------------------------------------
   7. Wheel stage
   -------------------------------------------------------------------------- */
.wheel-stage {
  --pointer-space: 32px;

  position: relative;
  width: min(100%, 548px);
  padding-top: var(--pointer-space);
  margin: 2px auto 8px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.wheel-visual {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
}

#wheel {
  display: block;
  width: calc(100% - 24px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
  cursor: pointer;
}

.wheel-stage.is-spinning #wheel {
  cursor: default;
}

.wheel-stage.is-empty .hub {
  display: none;
}

/* Pointer ------------------------------------------------------------------ */
.pointer {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 50%;
  width: 38px;
  height: 56px;
  transform: translateX(-50%);
  pointer-events: none;
  filter: drop-shadow(0 7px 8px rgba(16, 26, 50, 0.28));
}

.pointer__cap {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 26px;
  height: 26px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(145deg, #ff799c, var(--pointer));
  transform: translateX(-50%);
  box-shadow: 0 4px 10px rgba(255, 61, 113, 0.34);
}

.pointer__tip {
  position: absolute;
  top: 24px;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 20px solid var(--pointer);
  border-inline-start: 10px solid transparent;
  border-inline-end: 10px solid transparent;
  transform: translateX(-50%);
  transform-origin: 50% 0;
}

/* Hub ---------------------------------------------------------------------- */
.hub {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: clamp(82px, 18.5%, 105px);
  aspect-ratio: 1;
  padding: 0;
  border: 6px solid var(--surface);
  border-radius: 50%;
  color: var(--text);
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.8), transparent 46%),
    linear-gradient(145deg, var(--surface), var(--surface-3));
  box-shadow:
    0 12px 28px -8px rgba(17, 30, 58, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 1px var(--border);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition:
    transform 0.24s var(--ease-spring),
    box-shadow 0.24s ease;
}

[data-theme="dark"] .hub {
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.11), transparent 48%),
    linear-gradient(145deg, var(--surface-3), var(--surface));
  box-shadow:
    0 14px 30px -8px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px var(--border-strong);
}

.hub:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.045);
  box-shadow:
    0 16px 34px -8px rgba(17, 30, 58, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 1px var(--accent);
}

.hub:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.98);
}

.hub:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.hub__icon {
  display: grid;
  place-items: center;
  color: var(--accent);
}

.hub__icon svg {
  width: 23px;
  height: 23px;
}

.hub__label {
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
}

.hub__count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

body.is-spinning .hub__icon {
  animation: spin 1.1s linear infinite;
}

body.is-spinning .hub__label {
  color: var(--accent);
}

/* Empty state -------------------------------------------------------------- */
.empty-state {
  position: absolute;
  z-index: 4;
  inset: 7%;
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: 50%;
  text-align: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

[data-theme="dark"] .empty-state {
  background: rgba(13, 20, 36, 0.82);
}

.empty-state__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 220px;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}

.empty-state__icon svg {
  width: 25px;
  height: 25px;
}

.empty-state strong {
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 800;
}

.empty-state p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-out),
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #8466ff 0%, var(--accent) 44%, #5030df 100%);
  box-shadow:
    0 12px 26px -9px rgba(109, 74, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn--primary:hover:not(:disabled) {
  box-shadow:
    0 16px 32px -10px rgba(109, 74, 255, 0.82),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn--ghost {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--accent);
  border-color: rgba(109, 74, 255, 0.38);
  background: var(--surface);
}

.btn--danger-ghost {
  color: var(--danger);
  border-color: rgba(239, 71, 111, 0.22);
  background: transparent;
}

.btn--danger-ghost:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(239, 71, 111, 0.45);
  background: var(--danger-soft);
}

.btn--danger-ghost.is-armed {
  color: #fff;
  border-color: transparent;
  background: var(--danger);
  box-shadow: 0 8px 20px -8px rgba(239, 71, 111, 0.6);
}

.btn--lg {
  min-height: 52px;
  padding: 14px 28px;
  border-radius: 15px;
  font-size: 15.5px;
  font-weight: 800;
}

.btn--sm {
  min-height: 36px;
  padding: 8px 13px;
  font-size: 12px;
  border-radius: 10px;
}

.btn__spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

body.is-spinning #spinBtn .btn__spinner {
  display: block;
}

body.is-spinning #spinBtn .btn__icon {
  display: none;
}

body.is-spinning #spinBtn {
  cursor: progress;
}

.wheel-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.wheel-actions .btn--primary {
  min-width: 216px;
}

/* Last result -------------------------------------------------------------- */
.last-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
}

.last-result strong {
  max-width: 180px;
  color: var(--text-strong);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-result__dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.last-result__emoji {
  width: 1.7em;
  height: 1.7em;
  flex: 0 0 auto;
  margin-inline-start: 1px;
  object-fit: contain;
  pointer-events: none;
  filter:
    drop-shadow(0 0 3px rgba(12, 22, 42, 0.52))
    drop-shadow(0 0 7px rgba(47, 107, 255, 0.45));
}

[data-theme="dark"] .last-result__emoji {
  filter:
    drop-shadow(0 0 3px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 9px rgba(111, 155, 255, 0.65));
}

/* --------------------------------------------------------------------------
   9. Editor
   -------------------------------------------------------------------------- */
.count-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 7px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
}

.entries-input {
  display: block;
  width: 100%;
  min-height: 214px;
  max-height: 42vh;
  padding: 13px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.9;
  resize: vertical;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    opacity 0.18s ease;
}

.entries-input::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.entries-input:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.entries-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--ring);
}

.entries-input:disabled {
  cursor: progress;
  opacity: 0.58;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 11px 0 19px;
}

.editor-toolbar .btn {
  min-width: 0;
  padding-inline: 9px;
}

.editor-toolbar .btn:nth-child(-n + 3) {
  grid-column: span 2;
}

.editor-toolbar .btn--wide {
  grid-column: span 3;
}

.editor-toolbar .btn--full {
  grid-column: span 6;
}

.editor-toolbar .btn--wide svg,
.editor-toolbar .btn--full svg {
  color: var(--accent);
}

.entries-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 214px;
  margin: 0;
  padding: 0 0 0 4px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.entries-list::-webkit-scrollbar,
.entries-input::-webkit-scrollbar {
  width: 7px;
}

.entries-list::-webkit-scrollbar-thumb,
.entries-input::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 99px;
  background: var(--border-strong);
  background-clip: padding-box;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 35px;
  padding: 6px 8px 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface-2);
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.entry-item:hover {
  border-color: var(--border);
  background: var(--surface);
}

.entry-item__swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--swatch, var(--accent));
  box-shadow: 0 0 0 2px rgba(128, 128, 128, 0.1);
}

.entry-item__label {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-item__remove {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted-2);
  background: transparent;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background-color 0.16s ease;
}

.entry-item__remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.entry-item__remove svg {
  width: 13px;
  height: 13px;
}

.entries-list__empty {
  padding: 18px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   10. Winner modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 21, 0.62);
  -webkit-backdrop-filter: blur(9px) saturate(120%);
  backdrop-filter: blur(9px) saturate(120%);
  animation: fadeIn 0.24s ease both;
}

.modal__card {
  position: relative;
  z-index: 2;
  width: min(432px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 34px 28px 26px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalPop 0.46s var(--ease-spring) both;
  scrollbar-width: thin;
}

.modal__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--winner-color, var(--accent)), var(--accent-2), transparent);
}

.modal__close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.modal__close:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

.modal__close svg {
  width: 17px;
  height: 17px;
}

.modal__card .eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Fire stage --------------------------------------------------------------- */
.winner-stage {
  position: relative;
  margin: 6px 0 24px;
  padding: 28px 22px 32px;
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(110% 120% at 50% 118%, rgba(255, 93, 0, 0.34) 0%, rgba(255, 93, 0, 0) 58%),
    linear-gradient(180deg, #1b1f27 0%, #0b0d12 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 18px 36px -24px rgba(0, 0, 0, 0.9);
}

.winner-stage__glow {
  position: absolute;
  z-index: 0;
  inset: auto -12% -52% -12%;
  height: 78%;
  background: radial-gradient(
    closest-side,
    rgba(255, 122, 0, 0.55),
    rgba(255, 60, 0, 0.18) 55%,
    transparent 76%
  );
  filter: blur(14px);
  animation: emberPulse 2.6s ease-in-out infinite alternate;
  pointer-events: none;
}

.fire-wrapper {
  position: relative;
  z-index: 1;
  display: inline-block;
  max-width: 100%;
}

.winner-name {
  margin: 0;
  color: #fff;
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #fff3b8 16%,
    #ffe600 38%,
    #ff8a00 66%,
    #ff2d00 88%,
    #c90000 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(34px, 7.4vw, 56px);
  font-weight: 900;
  line-height: 1.28;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  filter: drop-shadow(0 0 6px rgba(255, 176, 24, 0.55))
    drop-shadow(0 0 18px rgba(255, 96, 0, 0.45))
    drop-shadow(0 0 34px rgba(255, 42, 0, 0.28));
  animation: fireFlicker 1.8s ease-in-out infinite alternate;
}

.fire-sparks {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.spark {
  position: absolute;
  bottom: 7%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c4 0%, #ffb703 46%, #ff5d00 100%);
  box-shadow:
    0 0 9px rgba(255, 132, 0, 0.95),
    0 0 18px rgba(255, 64, 0, 0.55);
  opacity: 0;
  animation: sparkRise 1.8s ease-in infinite;
}

.spark:nth-child(1) {
  left: 9%;
  animation-delay: 0.15s;
  animation-duration: 1.5s;
}

.spark:nth-child(2) {
  left: 26%;
  width: 3px;
  height: 3px;
  animation-delay: 0.55s;
  animation-duration: 1.75s;
}

.spark:nth-child(3) {
  left: 42%;
  animation-delay: 0.3s;
  animation-duration: 1.35s;
}

.spark:nth-child(4) {
  left: 58%;
  width: 4px;
  height: 4px;
  animation-delay: 0.75s;
  animation-duration: 1.9s;
}

.spark:nth-child(5) {
  left: 74%;
  animation-delay: 0.2s;
  animation-duration: 1.6s;
}

.spark:nth-child(6) {
  left: 90%;
  width: 3px;
  height: 3px;
  animation-delay: 0.65s;
  animation-duration: 1.45s;
}

.modal__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  max-width: 260px;
  margin: 0 auto;
}

.modal__actions .btn {
  width: 100%;
  min-height: 45px;
}

/* Speed settings dialog ---------------------------------------------------- */
.modal__card--speed {
  width: min(392px, 100%);
  padding: 30px 26px 22px;
}

.modal__card--speed .eyebrow {
  margin-bottom: 4px;
}

.speed-title {
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.speed-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 0;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.speed-value strong {
  color: var(--accent);
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.speed-value span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.speed-slider {
  margin: 12px 2px 0;
  direction: ltr;
}

.speed-range {
  display: block;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0;
  direction: ltr;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.speed-range::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--speed-pct, 60%),
    var(--surface-3) var(--speed-pct, 60%),
    var(--surface-3) 100%
  );
  box-shadow: inset 0 1px 3px rgba(13, 24, 48, 0.16);
}

.speed-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -8px;
  border: 4px solid var(--accent);
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 8px 16px -4px rgba(109, 74, 255, 0.5),
    0 0 0 4px rgba(109, 74, 255, 0.12);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.speed-range:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

.speed-range:focus-visible {
  outline: none;
}

.speed-range:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 8px 16px -4px rgba(109, 74, 255, 0.5),
    0 0 0 6px rgba(109, 74, 255, 0.24);
}

.speed-range::-moz-range-track {
  height: 14px;
  border-radius: 999px;
  background: var(--surface-3);
}

.speed-range::-moz-range-progress {
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
}

.speed-range::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 4px solid var(--accent);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 16px -4px rgba(109, 74, 255, 0.5);
}

.speed-scale {
  display: flex;
  justify-content: space-between;
  margin: 2px 4px 0;
  color: var(--muted-2);
  font-size: 11.5px;
  font-weight: 700;
  direction: ltr;
}

.modal__card--speed .modal__actions {
  max-width: 200px;
  margin-top: 18px;
}

/* Confetti ----------------------------------------------------------------- */
.confetti-layer {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: 42%;
  left: 50%;
  width: var(--size, 9px);
  height: calc(var(--size, 9px) * 1.45);
  border-radius: 2px;
  background: var(--color, var(--accent));
  opacity: 0;
  animation: confettiFall var(--duration, 1.9s) cubic-bezier(0.18, 0.72, 0.3, 1)
    var(--delay, 0s) forwards;
  will-change: transform, opacity;
}

/* --------------------------------------------------------------------------
   11. Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  z-index: 200;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 11px 17px;
  border-inline-start: 3px solid var(--accent);
  border-radius: 12px;
  color: var(--toast-text);
  background: var(--toast-bg);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 14px);
  transition:
    opacity 0.24s ease,
    transform 0.24s var(--ease-out),
    visibility 0.24s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   12. Motion
   -------------------------------------------------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8);
  }
  8% {
    opacity: 1;
  }
  45% {
    opacity: 1;
    transform: translate3d(var(--midx, 0px), var(--midy, -90px), 0)
      rotate(var(--midrot, 75deg)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx, 0px), var(--dy, 480px), 0)
      rotate(var(--rot, 360deg)) scale(0.9);
  }
}

@keyframes fireFlicker {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(255, 176, 24, 0.5))
      drop-shadow(0 0 16px rgba(255, 96, 0, 0.4))
      drop-shadow(0 0 30px rgba(255, 42, 0, 0.22));
  }
  50% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(0.995);
    filter: drop-shadow(0 0 8px rgba(255, 196, 48, 0.65))
      drop-shadow(0 0 22px rgba(255, 82, 0, 0.5))
      drop-shadow(0 0 40px rgba(255, 30, 0, 0.32));
  }
}

@keyframes emberPulse {
  from {
    opacity: 0.6;
    transform: scale(0.96);
  }
  to {
    opacity: 0.95;
    transform: scale(1.04);
  }
}

@keyframes sparkRise {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.7);
  }
  18% {
    opacity: 1;
  }
  70% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translateY(-58px) scale(0.25);
  }
}

/* --------------------------------------------------------------------------
   13. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-card {
    position: static;
  }

  .wheel-stage {
    max-width: 500px;
  }

  .entries-list {
    max-height: 240px;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 15px 12px 26px;
  }

  .topbar {
    margin-bottom: 15px;
  }

  .brand {
    gap: 9px;
  }

  .brand__mark {
    width: 42px;
    height: 42px;
  }

  .brand__text h1 {
    font-size: 22px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .icon-btn .icon {
    width: 19px;
    height: 19px;
  }

  .card {
    border-radius: var(--radius-lg);
    padding: 16px 14px;
  }

  .card__head {
    margin-bottom: 13px;
  }

  .eyebrow {
    font-size: 10.5px;
  }

  .eyebrow--card {
    font-size: 15px;
  }

  .count-badge {
    padding: 6px 9px;
    font-size: 10.5px;
  }

  .wheel-stage {
    --pointer-space: 30px;

    width: calc(100% - 4px);
  }

  #wheel {
    width: calc(100% - 16px);
  }

  .pointer {
    width: 32px;
    height: 48px;
  }

  .pointer__cap {
    width: 23px;
    height: 23px;
    border-width: 3px;
  }

  .pointer__tip {
    top: 21px;
    border-top: 17px solid var(--pointer);
    border-inline-start-width: 9px;
    border-inline-end-width: 9px;
  }

  .hub {
    width: clamp(74px, 22%, 92px);
    border-width: 5px;
  }

  .hub__icon svg {
    width: 20px;
    height: 20px;
  }

  .hub__label {
    font-size: 11.5px;
  }

  .hub__count {
    font-size: 9.5px;
  }

  .wheel-actions {
    flex-direction: column;
    gap: 9px;
    margin-top: 9px;
  }

  .wheel-actions .btn--primary {
    width: 100%;
    min-width: 0;
  }

  .btn--lg {
    min-height: 49px;
    padding: 13px 20px;
    font-size: 15px;
  }

  .last-result {
    margin-top: 12px;
    font-size: 11px;
  }

  .entries-input {
    min-height: 172px;
    max-height: 34vh;
    font-size: 14px;
  }

  .editor-toolbar {
    gap: 6px;
    margin: 10px 0 16px;
  }

  .editor-toolbar .btn {
    min-height: 39px;
    padding: 9px 6px;
    font-size: 12px;
    gap: 5px;
  }

  .editor-toolbar .btn svg {
    width: 15px;
    height: 15px;
  }

  .entries-list {
    max-height: 190px;
  }

  .modal {
    padding: 14px;
  }

  .modal__card {
    padding: 30px 16px 21px;
    border-radius: 25px;
  }

  .modal__card--speed {
    padding: 26px 20px 18px;
  }

  .speed-value strong {
    font-size: 40px;
  }

  .winner-stage {
    padding: 22px 14px 26px;
    border-radius: 16px;
  }

  .winner-name {
    font-size: clamp(30px, 10vw, 44px);
  }

  .modal__actions {
    gap: 8px;
  }

  .modal__actions .btn {
    min-height: 43px;
    padding-inline: 8px;
    font-size: 12px;
    gap: 5px;
  }

  .modal__actions .btn svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 400px) {
  .topbar__actions {
    gap: 7px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .card__head {
    gap: 8px;
  }

  .entries-list {
    max-height: 170px;
  }
}

/* --------------------------------------------------------------------------
   14. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .confetti-piece {
    display: none;
  }
}
