/* ==========================================================================
   SpinChakra — hand-authored stylesheet (no framework, no build step)
   1 tokens · 2 base · 3 layout · 4 header/footer · 5 controls · 6 cards
   7 wheel workspace · 8 tools · 9 content · 10 ads · 11 responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --radius-input: 12px;
  --radius-button: 12px;
  --radius-card: 18px;
  --radius-panel: 22px;
  --radius-pill: 9999px;

  --space-8: 0.5rem;
  --space-16: 1rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-48: 3rem;
  --space-72: 4.5rem;

  /* Light — near-white slate with a violet accent */
  --background: 250 40% 99%;
  --surface: 0 0% 100%;
  --surface-2: 250 30% 97%;
  --foreground: 232 40% 12%;
  --muted-foreground: 232 12% 42%;
  --border: 250 20% 89%;
  --accent: 262 76% 54%;
  --accent-hover: 262 76% 46%;
  --accent-foreground: 0 0% 100%;
  --accent-soft: 262 80% 96%;
  --success: 152 62% 36%;
  --danger: 0 72% 50%;
  --glass: 0 0% 100% / 0.72;

  --tile-h: 262;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --shadow-sm: 0 1px 2px rgb(16 12 40 / 0.05);
  --shadow-card: 0 1px 3px rgb(16 12 40 / 0.05), 0 10px 24px -12px rgb(16 12 40 / 0.16);
  --shadow-lift: 0 2px 6px -2px rgb(16 12 40 / 0.08), 0 22px 44px -18px rgb(16 12 40 / 0.28);
  --shadow-glow: 0 18px 60px -24px hsl(262 76% 54% / 0.55);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 180ms var(--ease);

  --control-h: 2.75rem;
  --container: 1280px;
}

.dark {
  --background: 235 45% 7%;
  --surface: 234 38% 11%;
  --surface-2: 234 32% 15%;
  --foreground: 240 40% 98%;
  --muted-foreground: 235 16% 68%;
  --border: 235 24% 22%;
  --accent: 262 84% 70%;
  --accent-hover: 262 84% 78%;
  --accent-foreground: 235 45% 9%;
  --accent-soft: 262 45% 20%;
  --success: 152 60% 55%;
  --danger: 0 78% 68%;
  --glass: 234 38% 13% / 0.72;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-card: 0 1px 3px rgb(0 0 0 / 0.45), 0 12px 28px -14px rgb(0 0 0 / 0.7);
  --shadow-lift: 0 2px 8px -2px rgb(0 0 0 / 0.5), 0 26px 48px -20px rgb(0 0 0 / 0.85);
  --shadow-glow: 0 20px 70px -26px hsl(262 84% 70% / 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-16);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.3rem + 2.8vw, 3.1rem);
}

p {
  margin: 0 0 var(--space-16);
}

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

a:hover {
  text-decoration: underline;
}

img,
svg,
canvas {
  max-width: 100%;
}

code {
  font-size: 0.9em;
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: hsl(var(--surface-2));
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.18em;
}

.icon.flip {
  transform: rotate(180deg);
}

:focus-visible {
  outline: 2px solid hsl(var(--accent));
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 0.75rem 1rem;
  background: hsl(var(--surface));
  border-radius: 0 0 var(--radius-button) 0;
}

.skip-link:focus {
  left: 0;
}

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.container-page {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-24);
}

.container-page.narrow {
  max-width: 48rem;
}

main {
  padding-bottom: var(--space-72);
}

.section {
  margin-top: var(--space-48);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
}

.title-md {
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.7rem);
  margin-bottom: var(--space-24);
}

.page-head {
  padding: var(--space-32) 0 var(--space-24);
}

.page-head .lede {
  color: hsl(var(--muted-foreground));
  font-size: 1.075rem;
  max-width: 48rem;
  margin-bottom: 0;
}

.link-more {
  font-weight: 600;
  font-size: 0.925rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.icon-tile {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: hsl(var(--tile-h) 78% 95%);
  color: hsl(var(--tile-h) 62% 42%);
  margin-bottom: var(--space-16);
}

.dark .icon-tile {
  background: hsl(var(--tile-h) 44% 20%);
  color: hsl(var(--tile-h) 84% 76%);
}

.icon-tile .icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* --------------------------------------------------------------------------
   4. Header / footer
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: hsl(var(--glass));
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid hsl(var(--border));
}

.header-bar {
  display: flex;
  align-items: center;
  gap: var(--space-24);
  height: 4rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: hsl(var(--foreground));
  font-weight: 700;
  font-size: 1.075rem;
  letter-spacing: -0.03em;
}

.logo:hover {
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 11px;
  background: linear-gradient(135deg, hsl(262 76% 58%), hsl(199 90% 52%));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.header-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.95rem;
}

.header-nav a {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
  color: hsl(var(--foreground));
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mobile-menu {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
  padding-block: var(--space-16);
}

.mobile-menu nav {
  display: grid;
  gap: 0.15rem;
}

.mobile-menu a {
  padding: 0.6rem 0;
  color: hsl(var(--foreground));
  font-weight: 500;
}

.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--surface-2));
  padding-block: var(--space-48);
  font-size: 0.925rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(5, minmax(0, 1fr));
  gap: var(--space-32);
}

.footer-grid h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.footer-grid a {
  color: hsl(var(--foreground));
}

.footer-about p {
  color: hsl(var(--muted-foreground));
  max-width: 26rem;
}

.footer-about .logo {
  margin-bottom: var(--space-16);
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: hsl(var(--success));
  font-weight: 600;
}

.footer-legal {
  margin-top: var(--space-32);
  padding-top: var(--space-24);
  border-top: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
}

.footer-legal p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   5. Controls
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--control-h);
  padding-inline: 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition),
    box-shadow var(--transition);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: hsl(var(--accent-hover));
}

.btn-soft {
  background: hsl(var(--accent-soft));
  color: hsl(var(--accent));
  border-color: transparent;
}

.btn-ghost {
  background: hsl(var(--surface));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-ghost:hover {
  background: hsl(var(--surface-2));
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-button);
  background: hsl(var(--surface));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background var(--transition);
}

.icon-btn:hover {
  background: hsl(var(--surface-2));
}

.menu-btn {
  display: none;
}

.icon-btn-sm {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.icon-btn-sm:hover {
  background: hsl(var(--surface-2));
  color: hsl(var(--foreground));
}

.icon-btn-sm.danger:hover {
  color: hsl(var(--danger));
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--accent));
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  background: hsl(var(--surface-2));
  color: hsl(var(--muted-foreground));
}

.badge-lg {
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  background: hsl(var(--accent-soft));
  color: hsl(var(--accent));
  margin-bottom: var(--space-16);
}

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  padding: 0 0.4rem;
  height: 1.6rem;
  border-radius: var(--radius-pill);
  background: hsl(var(--accent-soft));
  color: hsl(var(--accent));
  font-size: 0.8rem;
  font-weight: 700;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--accent));
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.85rem;
  margin-bottom: var(--space-16);
  box-shadow: var(--shadow-sm);
}

.field label,
.switch span {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea,
.bulk-edit textarea,
.copy-row input,
.entry-add input,
.reveal textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-input);
  padding: 0.6rem 0.8rem;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.copy-row input,
.entry-add input {
  height: var(--control-h);
}

.field textarea,
.bulk-edit textarea,
.reveal textarea {
  resize: vertical;
  line-height: 1.5;
}

.field input[type="range"] {
  width: 100%;
  accent-color: hsl(var(--accent));
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
}

.field-help {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: hsl(var(--muted-foreground));
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  cursor: pointer;
}

.switch input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: hsl(var(--accent));
}

.switch span {
  margin: 0;
  font-weight: 500;
  font-size: 0.925rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-16);
}

.copy-row {
  display: flex;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: var(--space-24);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--space-24);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: hsl(var(--tile-h) 60% 70% / 0.5);
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-16);
}

.card-top .icon-tile {
  margin-bottom: 0;
}

.card-body h3 {
  font-size: 1.1rem;
  margin: 0.75rem 0 0.35rem;
}

.card-body p {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  margin: 0;
}

.card-open {
  margin-top: auto;
  padding-top: var(--space-16);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: hsl(var(--accent));
  font-weight: 600;
  font-size: 0.9rem;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--space-24);
}

.cat-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-16);
  padding: var(--space-24);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
}

.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}

.cat-card .icon-tile {
  margin-bottom: 0;
}

.cat-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.cat-card p {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.cat-card-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--accent));
}

.cat-card > .icon {
  margin-left: auto;
  color: hsl(var(--muted-foreground));
}

.why {
  margin-top: var(--space-72);
  padding-block: var(--space-48);
  background: hsl(var(--surface-2));
  border-block: 1px solid hsl(var(--border));
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--space-24);
}

.why-card {
  padding: var(--space-24);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
}

.why-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.why-card p {
  color: hsl(var(--muted-foreground));
  font-size: 0.925rem;
  margin: 0;
}

/* --------------------------------------------------------------------------
   7. Wheel workspace
   -------------------------------------------------------------------------- */
.hero-workspace {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
  background:
    radial-gradient(80% 60% at 20% 0%, hsl(262 84% 60% / 0.16), transparent 60%),
    radial-gradient(70% 60% at 85% 10%, hsl(199 90% 55% / 0.14), transparent 60%);
}

.hero-copy {
  max-width: 46rem;
}

.hero-copy h1 {
  font-size: clamp(1.9rem, 1.3rem + 2vw, 2.6rem);
  margin-bottom: 0.6rem;
}

.hero-sub {
  color: hsl(var(--muted-foreground));
  font-size: 1.05rem;
  margin-bottom: var(--space-16);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-24);
}

/* Wheel + optional desktop sidebar ad. The ad column never overlaps the
   wheel and disappears entirely below 1100px. */
.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-24);
  align-items: start;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(19rem, 22rem);
  gap: var(--space-24);
  align-items: start;
}

.workspace-stage,
.workspace-panels {
  min-width: 0;
}

.workspace-panels {
  display: grid;
  gap: var(--space-16);
}

.wheel-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--space-16);
  padding: var(--space-24);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-panel);
  background-color: hsl(var(--surface));
  background-repeat: no-repeat;
  background-position: center top;
  box-shadow: var(--shadow-card);
}

.wheel-stage:fullscreen {
  border-radius: 0;
  align-content: center;
  background-color: hsl(var(--background));
}

.wheel-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.wheel-frame {
  position: relative;
  width: 100%;
  max-width: 36rem;
  aspect-ratio: 1;
  filter: drop-shadow(var(--shadow-glow));
}

.wheel-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  touch-action: manipulation;
}

/* Pointer sits at 3 o'clock — the wheel's 0° — and points inward. */
.wheel-pointer {
  position: absolute;
  top: 50%;
  right: -2px;
  z-index: 2;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-block: 0.85rem solid transparent;
  border-right: 1.5rem solid hsl(var(--foreground));
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.35));
}

.spin-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 24%;
  aspect-ratio: 1;
  min-width: 4.5rem;
  border: 4px solid hsl(var(--surface));
  border-radius: 50%;
  background: linear-gradient(140deg, hsl(262 76% 58%), hsl(232 82% 55%));
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: clamp(0.95rem, 0.7rem + 0.7vw, 1.2rem);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 22px -8px rgb(16 12 40 / 0.7);
  transition: transform 150ms var(--ease), filter var(--transition);
}

.spin-hub:hover {
  transform: translate(-50%, -50%) scale(1.05);
  filter: brightness(1.07);
}

.spin-hub:active {
  transform: translate(-50%, -50%) scale(0.97);
}

.spin-hub:disabled {
  filter: grayscale(0.7);
  cursor: not-allowed;
}

.is-spinning .spin-hub {
  pointer-events: none;
  opacity: 0.9;
}

.winner-banner {
  min-height: 2.6rem;
  margin: 0;
  padding: 0.35rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: hsl(var(--accent));
  background: transparent;
  opacity: 0;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  transform: translateY(4px);
  overflow-wrap: anywhere;
}

.winner-banner.is-visible {
  opacity: 1;
  transform: none;
  background: hsl(var(--accent-soft));
}

.stage-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.stage-tools .btn {
  font-size: 0.875rem;
  padding-inline: 0.85rem;
  min-height: 2.4rem;
}

/* Panels ------------------------------------------------------------------ */
.panel {
  padding: var(--space-24);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  margin-bottom: var(--space-16);
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1rem;
  margin: 0;
}

.panel-empty {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  margin: 0;
}

.entry-list {
  list-style: none;
  margin: 0 0 var(--space-16);
  padding: 0;
  display: grid;
  gap: 0.35rem;
  max-height: 26rem;
  overflow-y: auto;
  counter-reset: entry;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: hsl(var(--surface-2));
}

.entry-row.is-dragging {
  opacity: 0.55;
}

.entry-grip {
  display: grid;
  place-items: center;
  width: 1.5rem;
  color: hsl(var(--muted-foreground));
  cursor: grab;
}

.entry-label,
.entry-weight {
  font: inherit;
  font-size: 0.925rem;
  color: hsl(var(--foreground));
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  min-width: 0;
}

.entry-label {
  flex: 1;
}

.entry-weight {
  width: 3.6rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.entry-label:focus,
.entry-weight:focus {
  background: hsl(var(--background));
  border-color: hsl(var(--accent));
  outline: none;
}

.entry-tools {
  display: flex;
  gap: 0.1rem;
}

.entry-add {
  display: flex;
  gap: 0.5rem;
}

.entry-add input {
  flex: 1;
}

.bulk-edit {
  margin-top: var(--space-16);
}

.bulk-edit label {
  display: block;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.4rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  max-height: 15rem;
  overflow-y: auto;
}

.history-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: hsl(var(--surface-2));
  font-size: 0.9rem;
}

.history-index {
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: hsl(var(--accent-soft));
  color: hsl(var(--accent));
  font-size: 0.75rem;
  font-weight: 700;
}

.history-label {
  flex: 1;
  overflow-wrap: anywhere;
}

.history-list time {
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.reveal {
  margin-top: var(--space-16);
  padding-top: var(--space-16);
  border-top: 1px solid hsl(var(--border));
}

.reveal label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.qr-holder {
  display: grid;
  place-items: center;
  padding: var(--space-16);
  background: #fff;
  border-radius: var(--radius-input);
  margin-bottom: var(--space-16);
}

.qr-holder svg {
  width: 100%;
  max-width: 15rem;
  height: auto;
}

.qr-holder .panel-empty {
  color: #475569;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-pill);
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
}

/* Embed view -------------------------------------------------------------- */
body.bare {
  background: hsl(var(--background));
}

.embed-page {
  padding: var(--space-16);
}

.workspace-compact {
  display: block;
}

.embed-credit {
  display: block;
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------------------------
   8. Tool UI
   -------------------------------------------------------------------------- */
.tool {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: var(--space-24);
  padding: var(--space-24);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
}

.field-grid {
  display: grid;
  gap: var(--space-16);
  align-content: start;
}

.result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-24);
  background: hsl(var(--surface-2));
  border-radius: var(--radius-card);
  min-height: 13rem;
}

.result-empty {
  color: hsl(var(--muted-foreground));
  margin: 0;
  text-align: center;
}

.result-headline {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}

.result-detail {
  color: hsl(var(--muted-foreground));
  margin-bottom: var(--space-16);
}

.result-rows {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.result-rows > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-16);
  padding-top: 0.45rem;
  border-top: 1px solid hsl(var(--border));
}

.result-rows dt {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
}

.result-rows dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.tool button[type="submit"] {
  opacity: 0.55;
  pointer-events: none;
}

.tool.is-ready button[type="submit"] {
  opacity: 1;
  pointer-events: auto;
}

.tool-nojs {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.82rem;
  color: hsl(var(--muted-foreground));
}

.tool.is-ready .tool-nojs {
  display: none;
}

/* --------------------------------------------------------------------------
   9. Content: breadcrumbs, prose, FAQ, premium, 404
   -------------------------------------------------------------------------- */
.breadcrumbs {
  padding-top: var(--space-24);
  font-size: 0.875rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: hsl(var(--muted-foreground));
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumbs a {
  color: hsl(var(--muted-foreground));
}

.faq-list {
  display: grid;
  gap: 0.7rem;
}

.faq-list details {
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
  padding: 0 var(--space-24);
}

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-16) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary .icon {
  color: hsl(var(--muted-foreground));
  transition: transform var(--transition);
}

.faq-list details[open] summary .icon {
  transform: rotate(45deg);
}

.faq-list p {
  color: hsl(var(--muted-foreground));
  margin-top: 0;
}

.prose {
  max-width: 48rem;
}

.prose h2 {
  font-size: 1.35rem;
  margin-top: var(--space-32);
}

.prose ol,
.prose ul {
  padding-left: 1.25rem;
  color: hsl(var(--muted-foreground));
  display: grid;
  gap: 0.4rem;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.steps li {
  position: relative;
  padding-left: 2.4rem;
  color: hsl(var(--foreground));
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: hsl(var(--accent-soft));
  color: hsl(var(--accent));
  font-size: 0.85rem;
  font-weight: 700;
}

.premium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-16);
}

.premium-card {
  padding: var(--space-24);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-card);
  background: hsl(var(--surface));
}

.premium-card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.premium-card p {
  color: hsl(var(--muted-foreground));
  font-size: 0.925rem;
  margin: 0;
}

.not-found {
  padding-top: var(--space-48);
  text-align: center;
}

.not-found .hero-actions {
  justify-content: center;
  margin-bottom: var(--space-48);
}

/* --------------------------------------------------------------------------
   10. Ads — reserved, never over the wheel, collapsed on small screens
   -------------------------------------------------------------------------- */
.ad-slot {
  display: grid;
  place-items: center;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius-card);
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: hsl(var(--surface-2) / 0.5);
}

.ad-top {
  min-height: 90px;
  margin-bottom: var(--space-24);
}

.ad-sidebar {
  min-height: 600px;
  width: 300px;
  position: sticky;
  top: 5rem;
}

.ad-in-content,
.ad-between {
  min-height: 100px;
  margin-block: var(--space-32);
}

/* --------------------------------------------------------------------------
   11. Responsive
   -------------------------------------------------------------------------- */
/* The sidebar ad only appears when there's room for it beside a full-size
   wheel — never at the wheel's expense. */
@media (min-width: 1500px) {
  .workspace-shell {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 1499px) {
  .ad-sidebar {
    display: none;
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-about {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .tool {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .header-nav {
    display: none;
  }

  .menu-btn {
    display: grid;
  }

  .header-actions {
    margin-left: auto;
  }

  .container-page {
    padding-inline: var(--space-16);
  }

  .wheel-stage {
    padding: var(--space-16);
  }

  .stage-tools .btn {
    flex: 1 1 8rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-24);
  }

  /* The top banner is a desktop placement — on a phone it would push the
     wheel below the fold, so it is dropped rather than shrunk. */
  .ad-top {
    display: none;
  }

  .hero-workspace {
    padding-top: var(--space-16);
  }

  .hero-sub {
    font-size: 1rem;
    margin-bottom: var(--space-16);
  }

  .winner-banner {
    min-height: 2.2rem;
  }

  .entry-list {
    max-height: 20rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .entry-weight {
    width: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
