:root {
  --bg: #f6f8fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-solid: #ffffff;
  --panel-field: #f8fafc;
  --line: #dfe7f1;
  --line-strong: #d8e0ea;
  --text: #172033;
  --muted: #66758a;
  --soft: #94a3b8;
  --blue: #2e6ef6;
  --green: #077a56;
  --gold: #f4ad2a;
  --danger: #ff6b6b;
  --shadow: 0 18px 42px rgba(11, 19, 36, 0.1);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  background: var(--bg);
}

.app.is-dark {
  --bg: #070b12;
  --surface: rgba(13, 20, 32, 0.94);
  --surface-solid: #0d1420;
  --panel-field: #090f19;
  --line: #263247;
  --line-strong: #334155;
  --text: #f1f7ff;
  --muted: #8fa1b5;
  --soft: #637388;
  --shadow: 0 18px 42px rgba(11, 19, 36, 0.35);
}

.header {
  height: 75px;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-title {
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
  margin: 0;
}

.brand-subtitle {
  display: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.app.is-dark.has-multiple .brand-subtitle {
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-menu {
  position: relative;
}

.tool-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.tool-menu summary::-webkit-details-marker {
  display: none;
}

.tool-menu summary .icon {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.tool-menu[open] summary .icon {
  transform: rotate(180deg);
}

.tool-menu summary:hover,
.header-results:hover {
  background: var(--panel-field);
}

.tool-menu summary:focus-visible,
.header-results:focus-visible,
.theme-switch:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.tool-menu-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 14px;
  width: min(310px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.tool-menu-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.tool-menu-column > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-menu-column a {
  padding: 7px 8px;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.tool-menu-column a:hover,
.tool-menu-column a[aria-current="page"] {
  background: var(--panel-field);
}

.header-results,
.theme-switch,
.small-square,
.panel-collapse,
.icon-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.header-results {
  height: 30px;
  width: 96px;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.theme-switch {
  width: 64px;
  height: 30px;
  border-radius: 999px;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--panel-field);
}

.theme-switch span {
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.theme-switch .icon {
  width: 14px;
  height: 14px;
}

.theme-switch .active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(11, 19, 36, 0.12);
}

.app.is-dark .theme-switch .active {
  background: #263445;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.shell {
  position: relative;
  min-height: calc(100vh - 75px);
  padding: 32px 48px;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
  gap: 36px;
  align-items: start;
  min-height: calc(100dvh - 139px);
  margin: 0 auto;
}

.wheel-zone {
  min-width: 0;
  min-height: calc(100dvh - 139px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wheel-zone.is-centered {
  grid-column: 1 / -1;
}

.spin-all-top {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-solid);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  margin: 0 auto 28px;
}

.wheels-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--wheel-columns), minmax(0, 1fr));
  gap: 12px 20px;
  justify-content: center;
}

.wheel-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.has-multiple .wheel-card {
  min-height: 0;
  padding: 22px 4px 48px;
  border-color: var(--line);
  background: rgba(13, 20, 32, 0.02);
}

.app.is-dark .has-multiple .wheel-card {
  background: rgba(13, 20, 32, 0.42);
}

.wheel-wrap {
  position: relative;
  width: min(100%, calc(100dvh - 180px));
  aspect-ratio: 1;
  container-type: inline-size;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(11, 19, 36, 0.08);
}

.has-multiple .wheel-wrap {
  width: min(100%, max(72px, var(--wheel-fit-height)));
}

.has-multiple .center-button {
  font-size: clamp(8px, 10cqw, 17px);
  border-width: clamp(1px, 1.2cqw, 3px);
}

.wheel-viewport {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: clip;
  contain: paint;
}

.wheel-svg,
.wheel-spin-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wheel-svg {
  display: block;
}

.wheel-spin-layer {
  transform: rotate(var(--rotation));
  backface-visibility: hidden;
  border-radius: 50%;
  pointer-events: none;
  contain: paint;
  will-change: transform;
}

.wheel-pointers,
.pointer-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wheel-pointers {
  z-index: 3;
}

.pointer {
  position: absolute;
  top: calc(var(--pointer-offset) * -1);
  left: 50%;
  width: var(--pointer-width);
  height: var(--pointer-height);
  transform: translateX(-50%);
  z-index: 3;
  filter: drop-shadow(0 2px 2px rgba(128, 77, 14, 0.28));
}

.pointer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #f4ad2a;
  clip-path: polygon(50% 100%, 8% 0, 50% 28%, 92% 0);
}

.center-button {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: var(--button-size);
  height: var(--button-size);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 249, 239, 0.85);
  border-radius: 50%;
  background: var(--gold);
  color: #111827;
  font-size: var(--button-font);
  font-weight: 800;
  box-shadow: 0 0 0 var(--glow-size) rgba(244, 173, 42, 0.35), 0 14px 28px rgba(128, 77, 14, 0.18);
}

.winner-toast {
  position: absolute;
  z-index: 10;
  left: min(44%, 420px);
  top: 296px;
  width: min(480px, calc(100vw - 72px));
  min-height: 180px;
  border: 2px solid #e5b94e;
  border-radius: 8px;
  background: #fff9ef;
  box-shadow: 0 0 16px rgba(245, 173, 41, 0.16), 0 14px 32px rgba(18, 26, 38, 0.18);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 28px;
  align-items: center;
  padding: 34px 40px;
  animation: toast-in 360ms ease both;
}

.winner-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #66758a;
}

.winner-close:hover {
  background: rgba(23, 32, 51, 0.08);
}

.winner-close .icon {
  width: 18px;
  height: 18px;
}

.feedback-toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  animation: feedback-toast-in 240ms ease both;
}

.winner-toast strong {
  display: block;
  color: #b93846;
  font-size: 15px;
  line-height: 22px;
  margin-bottom: 6px;
}

.winner-toast h2 {
  margin: 0;
  color: #172033;
  font-size: 34px;
  line-height: 44px;
}

.winner-toast.is-multi {
  width: min(420px, calc(100vw - 72px));
  min-height: 0;
  max-height: none;
  padding: 22px 28px;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 18px;
}

.winner-toast > div:last-child {
  min-width: 0;
}

.winner-names {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  color: #172033;
  font-size: 18px;
  line-height: 26px;
  font-weight: 700;
}

.winner-names span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner-names b {
  margin-right: 10px;
  color: #b93846;
  font-size: 14px;
}

.winner-toast p {
  margin: 4px 0 0;
  color: #2f7d6d;
  font-size: 13px;
  font-weight: 700;
}

.trophy {
  color: var(--gold);
}

.confetti {
  position: absolute;
  width: var(--piece-width);
  height: var(--piece-height);
  border-radius: var(--piece-radius);
  pointer-events: none;
  animation: confetti-pop 1500ms cubic-bezier(0.18, 0.75, 0.25, 1) var(--delay) both;
}

.winner-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.has-multiple .wheel-card.has-winner {
  min-height: var(--winner-height);
}

.has-multiple .winner-toast {
  position: relative;
  left: auto;
  top: auto;
  width: min(230px, calc(100% - 12px));
  min-height: 0;
  max-height: none;
  padding: 10px;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  overflow: visible;
  pointer-events: auto;
}

.has-multiple .winner-toast .trophy .icon {
  width: 22px;
  height: 22px;
}

.has-multiple .winner-toast strong {
  font-size: 10px;
  line-height: 14px;
}

.has-multiple .winner-toast h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  line-height: 25px;
}

.has-multiple .winner-names {
  gap: 1px;
  font-size: 12px;
  line-height: 18px;
}

.has-multiple .winner-names b {
  margin-right: 5px;
  font-size: 10px;
}

.has-multiple .winner-toast p {
  font-size: 10px;
}

.panel {
  position: sticky;
  top: 32px;
  width: 368px;
  height: max(540px, calc(100dvh - 139px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px 16px 20px;
}

.panel-top {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-spin-all,
.add-wheel {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.panel-spin-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--green);
}

.panel-spin-all .icon {
  width: 13px;
  height: 13px;
}

.add-wheel {
  min-width: 88px;
}

.add-wheel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.collapse-link {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tabs {
  height: 46px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  min-width: 0;
  margin: 0 0 20px;
}

.wheel-tabs {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  touch-action: pan-x;
  user-select: none;
  cursor: grab;
}

.wheel-tabs.is-dragging,
.wheel-tabs.is-dragging .tab {
  cursor: grabbing;
}

.wheel-tabs .tab {
  cursor: grab;
}

.wheel-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  flex: none;
  height: 40px;
  min-width: 80px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: var(--blue);
}

.tab-count {
  color: var(--blue);
  font-size: 10px;
  margin-left: 4px;
}

.tab-close {
  color: var(--muted);
  margin-left: 4px;
  font-size: 14px;
}

.results-tab {
  margin-left: 12px;
  width: 88px;
}

.results-tab::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  width: 1px;
  height: 18px;
  border-radius: 1px;
  background: var(--line-strong);
  transform: translateY(-50%);
}

.tools {
  height: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 27px;
}

.tools .icon-button:last-child {
  margin-left: auto;
}

.icon-button {
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-button.primary {
  color: var(--green);
}

.app.is-dark .icon-button.primary {
  color: var(--gold);
}

.names-input {
  width: 100%;
  flex: 1;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-field);
  color: var(--text);
  resize: none;
  outline: none;
  padding: 15px 20px;
  font-size: 13px;
  line-height: 30px;
}

.app.is-dark .names-input {
  font-size: 14px;
}

.panel-results {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

.panel-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.panel-results-head button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.panel-results-head button .icon {
  width: 14px;
  height: 14px;
}

.panel-results-pagination {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.panel-results-pagination button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
}

.panel-results-pagination button:hover:not(:disabled) {
  background: var(--line);
}

.panel-results-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mini-results {
  flex: 1;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-field);
  overflow: auto;
}

.mini-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 62px 24px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.mini-row strong {
  color: var(--text);
}

.result-remove,
.result-add,
.add-result-form button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.result-remove:hover,
.add-result-form button:hover {
  background: var(--line);
  color: var(--text);
}

.result-add {
  color: var(--blue);
  font-size: 22px;
  line-height: 1;
}

.result-add:hover {
  background: var(--line);
}

.result-add-row .add-result-form {
  grid-column: 1 / -1;
}

.add-result-form {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.add-result-form input,
.add-result-form select {
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 12px;
}

.add-result-form input { flex: 1; }
.add-result-form select { max-width: 95px; }

.result-action-cell {
  width: 64px;
}

.panel-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.panel-result-actions button {
  height: 38px;
  border: 1px solid #41546a;
  border-radius: 6px;
  background: #182331;
  color: #d7e6e0;
  font-size: 13px;
  font-weight: 500;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.36);
  z-index: 30;
  display: grid;
  place-items: center;
}

.delete-modal {
  width: 272px;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.22);
  padding: 22px;
}

.delete-modal h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 18px;
  line-height: 24px;
}

.delete-modal p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 17px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-actions button {
  height: 34px;
  border-radius: 6px;
  padding: 0 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.modal-actions .danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.settings-modal {
  width: min(320px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.22);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.settings-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 22px;
}

.settings-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.settings-close:hover {
  background: var(--panel-field);
}

.settings-fields {
  display: grid;
  gap: 7px;
  padding: 18px;
}

.settings-modal label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.settings-modal label:not(:first-child) {
  margin-top: 10px;
}

.settings-modal input,
.settings-modal select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-field);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}

.settings-modal input:focus-visible,
.settings-modal select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.settings-modal .modal-actions {
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.settings-modal .save {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.collapsed-controls {
  position: fixed;
  right: 48px;
  top: 92px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.small-square {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface-solid);
  box-shadow: 0 2px 6px rgba(13, 20, 31, 0.12);
  color: var(--green);
}

.results-page {
  min-height: calc(100vh - 75px);
  padding: 40px 48px 64px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.back-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  margin-bottom: 8px;
}

.results-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.results-title h1 {
  margin: 0;
  font-size: 44px;
  line-height: 56px;
  font-weight: 500;
  letter-spacing: 0;
}

.results-title span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.result-actions {
  display: flex;
  gap: 12px;
}

.result-actions button {
  height: 37px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  min-height: 153px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: 0 4px 6px rgba(11, 19, 36, 0.05);
  padding: 24px;
}

.stat-card.best {
  border-color: #57e3be;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-value {
  margin: 16px 0 2px;
  color: var(--text);
  font-size: 32px;
  font-weight: 800;
}

.stat-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(11, 19, 36, 0.05);
}

.filter-bar {
  padding: 24px;
  border-bottom: 1px solid #e4ebf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.segments {
  display: flex;
  gap: 4px;
  border-radius: 8px;
  background: #f6f8fb;
  padding: 4px;
}

.segments button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
}

.segments .active {
  background: #fff;
  color: #172033;
  box-shadow: 0 1px 1px rgba(11, 19, 36, 0.05);
}

.search {
  width: 260px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  padding: 0 14px;
  color: var(--text);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th,
.results-table td {
  padding: 16px 24px;
  border-bottom: 1px solid #e4ebf3;
  text-align: left;
}

.results-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.results-table td {
  color: var(--muted);
  font-size: 14px;
}

.results-table strong {
  color: #172033;
}

.wheel-pill {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 10px;
  background: #e8f0fe;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.wheel-pill.alt {
  background: #fef6e9;
  color: var(--gold);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

.table-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.page-size-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}

.page-size-select:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.pager {
  display: flex;
  gap: 6px;
}

.pager button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: #172033;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager .active {
  background: #172033;
  color: #fff;
}

.sr-file {
  display: none;
}

.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .icon,
.small-square .icon {
  width: 100%;
  height: 100%;
}

.trophy .icon {
  width: 42px;
  height: 42px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes feedback-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes confetti-pop {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.4) rotate(0);
  }
  12% {
    opacity: 1;
  }
  48% {
    opacity: 1;
    transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rot));
    animation-timing-function: ease-in;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--end-x), var(--end-y), 0) rotate(calc(var(--rot) + 240deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti {
    animation-duration: 1ms;
  }
}

@media (max-width: 1120px) {
  .shell {
    padding: 32px 24px 64px;
  }

  .wheel-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .panel {
    position: relative;
    top: 0;
    width: min(100%, 520px);
    justify-self: center;
  }

  .wheel-zone {
    min-height: min(700px, calc(100dvh - 139px));
  }

  .winner-toast {
    left: 50%;
    top: 260px;
    transform: translateX(-50%);
  }
}

@media (max-width: 760px) {
  .header {
    padding: 0 12px;
  }

  .brand-title {
    font-size: 17px;
  }

  .header-actions {
    gap: 6px;
  }

  .tool-menu summary {
    padding: 0 6px;
  }

  .theme-switch {
    width: 60px;
  }

  .header-results {
    width: 36px;
  }

  .header-results span {
    display: none;
  }

  .wheels-grid {
    grid-template-columns: 1fr;
  }

  .wheel-card {
    min-height: 380px;
  }

  .has-multiple .wheel-card {
    min-height: 0;
  }

  .has-multiple .wheel-wrap {
    width: min(100%, 360px, calc(100dvh - 260px));
  }

  .results-head,
  .filter-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-actions,
  .stats {
    grid-template-columns: 1fr;
    flex-wrap: wrap;
  }

  .stats {
    display: grid;
  }

  .results-table {
    min-width: 780px;
  }

  .table-card {
    overflow-x: auto;
  }

  .table-foot,
  .pager {
    flex-wrap: wrap;
    gap: 12px;
  }
}
