@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Manrope:wght@400;600;700;800&display=swap');

:root {
  --bg-0: #091318;
  --bg-1: #0f1f27;
  --bg-2: #182c33;
  --card: rgba(11, 29, 34, 0.78);
  --line: rgba(155, 220, 236, 0.2);
  --text: #e9f8fc;
  --muted: #8bbbc8;
  --accent-1: #06b6d4;
  --accent-2: #f97316;
  --accent-3: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  background:
    radial-gradient(circle at 18% -8%, rgba(6, 182, 212, 0.26), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(249, 115, 22, 0.22), transparent 38%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 38%, var(--bg-2));
  min-height: 100dvh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 12px 28px;
  backdrop-filter: blur(10px);
  background: rgba(9, 19, 24, 0.82);
  border-bottom: 1px solid rgba(138, 210, 229, .2);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 0 18px rgba(6, 182, 212, .75), 0 0 24px rgba(249, 115, 22, .5);
}

.brand__title {
  font-family: 'Bebas Neue', cursive;
  letter-spacing: 1px;
  font-size: 28px;
  line-height: 1;
}

.topbar__nav {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.topbar__link {
  color: #d7eff7;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(138, 210, 229, .24);
  background: rgba(8, 35, 41, .45);
  font-weight: 700;
}

.topbar__link:hover { background: rgba(8, 48, 56, .65); }

.topbar__user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: var(--muted);
}

.shell,
.guest-shell {
  width: min(1600px, calc(100vw - 28px));
  margin: 22px auto 28px;
  position: relative;
  z-index: 1;
}

.page-head,
.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #86ddf1;
  font-weight: 700;
  font-size: 11px;
}

.title {
  margin: 4px 0 8px;
  font-family: 'Bebas Neue', cursive;
  letter-spacing: .02em;
  font-size: clamp(32px, 5vw, 52px);
  line-height: .96;
}

.lead {
  margin: 0;
  color: #8ec6d4;
  max-width: 72ch;
}

.card,
.editor-panel,
.preview-panel,
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 26px 55px rgba(0, 0, 0, .3);
}

.card {
  padding: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card--empty {
  text-align: center;
  padding: 38px 18px;
}

.card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.kicker,
.meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

[hidden] {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #a6d0dc;
}

input,
textarea,
select {
  width: 100%;
  background: rgba(3, 21, 26, 0.7);
  color: #f0fbfe;
  border: 1px solid rgba(141, 215, 231, 0.3);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

textarea { resize: vertical; min-height: 68px; }

select[multiple] {
  min-height: 120px;
  padding: 8px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  color: #c8ebf4;
  font-size: 13px;
  font-weight: 700;
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: #06b6d4;
  border: 0;
  background: transparent;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 12px 26px rgba(6, 182, 212, .25);
}

.btn--primary:hover { filter: brightness(1.05); }

.btn--ghost {
  color: #daf3fa;
  background: rgba(10, 43, 51, .65);
  border-color: rgba(144, 220, 237, .3);
}

.btn--ghost:hover { background: rgba(8, 56, 66, .75); }

.btn--danger {
  color: #fff;
  background: linear-gradient(125deg, #f43f5e, var(--danger));
}

.notice {
  border-radius: 12px;
  padding: 11px 13px;
  margin: 10px 0;
  font-weight: 700;
  border: 1px solid transparent;
}

.notice--ok {
  background: rgba(34, 197, 94, .15);
  border-color: rgba(34, 197, 94, .42);
}

.notice--error {
  background: rgba(239, 68, 68, .16);
  border-color: rgba(239, 68, 68, .42);
}

.notice--warn {
  background: rgba(249, 115, 22, .15);
  border-color: rgba(249, 115, 22, .4);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(9, 50, 59, .75);
  color: #b4e6f3;
  border: 1px solid rgba(145, 219, 235, .3);
  border-radius: 999px;
  font-size: 12px;
  padding: 5px 10px;
  font-weight: 700;
}

.badge--button {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.badge--button:hover {
  background: rgba(13, 64, 74, .82);
  border-color: rgba(173, 231, 245, .45);
}

.editor-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  align-items: start;
}

.editor-panel,
.preview-panel {
  padding: 16px;
}

.editor-panel h2,
.preview-panel h2,
.card h2 {
  margin: 0 0 12px;
  font-family: 'Bebas Neue', cursive;
  font-size: 30px;
  letter-spacing: .02em;
}

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

.section-head h3 {
  margin: 0;
  font-size: 18px;
  color: #dcf6fd;
}

.hint {
  color: #84c6d8;
  font-size: 12px;
}

.ring-controls,
.segment-builder,
.segments-table-wrap {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(140, 214, 231, .2);
  background: rgba(4, 23, 28, .55);
}

.ring-controls__btns {
  display: flex;
  gap: 8px;
}

.ring-list {
  display: grid;
  gap: 8px;
}

.ring-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 8px;
}

.ring-item__toggle {
  appearance: none;
  border: 1px solid rgba(155, 220, 236, .35);
  border-radius: 10px;
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease;
}

.ring-item__toggle.is-all {
  font-size: 12px;
  color: #d7f3fa;
  background: rgba(14, 54, 64, .55);
}

.ring-item__toggle.is-hide-label {
  color: #f6e5bd;
  background: rgba(94, 76, 36, .48);
  border-color: rgba(236, 210, 147, .45);
}

.ring-item__toggle.is-hide-all {
  color: #89aab4;
  background: rgba(10, 31, 37, .45);
  border-color: rgba(120, 145, 153, .35);
  opacity: .78;
}

.ring-item__toggle:hover {
  border-color: rgba(193, 237, 248, .62);
}

.ring-item__toggle:focus-visible {
  outline: 2px solid rgba(113, 210, 232, .7);
  outline-offset: 1px;
}

.segment-builder__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segment-builder__grid .wide {
  grid-column: 1 / -1;
}

.segment-builder__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segments-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.segments-table th,
.segments-table td,
.table th,
.table td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid rgba(131, 205, 224, .2);
  vertical-align: top;
}

.segments-table tbody tr:hover,
.table tbody tr:hover {
  background: rgba(13, 53, 63, .45);
}

.color-chip {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.4);
}

.preview-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wheel-stage {
  position: relative;
  margin: 10px 0 14px;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(149, 224, 240, .24);
  background:
    radial-gradient(circle at 50% 52%, rgba(8, 58, 67, .56), rgba(3, 17, 22, .98)),
    conic-gradient(from 160deg, rgba(6, 182, 212, .05), rgba(249, 115, 22, .08), rgba(34, 197, 94, .05), rgba(6, 182, 212, .05));
  box-shadow:
    inset 0 0 80px rgba(6, 182, 212, .14),
    inset 0 0 120px rgba(249, 115, 22, .09),
    0 16px 38px rgba(0, 0, 0, .38);
}

#wheel-svg {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1;
  position: relative;
  z-index: 1;
}

.wheel-segment__path {
  cursor: pointer;
  transition: transform .2s ease, fill-opacity .2s ease, stroke-width .2s ease, filter .2s ease;
}

.wheel-segment__path:hover,
.wheel-segment__path:focus-visible {
  fill-opacity: 1;
  stroke: rgba(255,255,255,.86);
  stroke-width: 2.5;
  filter: brightness(1.08);
}

.wheel-segment.is-active .wheel-segment__path {
  stroke: rgba(255,255,255,.95);
  stroke-width: 2.9;
  filter: brightness(1.13);
}

.wheel-segment__text {
  pointer-events: none;
}

.wheel-center-info {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(290px, 52%);
  min-height: 166px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(156, 228, 243, .32);
  background:
    linear-gradient(165deg, rgba(6, 30, 37, .95), rgba(4, 23, 30, .92));
  box-shadow:
    0 10px 26px rgba(0, 0, 0, .42),
    inset 0 0 24px rgba(6, 182, 212, .1);
  pointer-events: none;
  text-align: center;
  z-index: 2;
}

.wheel-center-info__kicker {
  margin: 0;
  color: #8dd8eb;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 800;
}

.wheel-center-info__title {
  margin: 6px 0 6px;
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: .96;
  letter-spacing: .03em;
  color: #effbff;
  word-break: break-word;
}

.wheel-center-info__meta {
  margin: 0;
  font-size: 12px;
  color: #acd8e4;
  font-weight: 700;
}

.wheel-center-info__note {
  margin: 7px 0 0;
  font-size: 12px;
  color: #c7e9f1;
  line-height: 1.34;
  max-height: 4.1em;
  overflow: hidden;
}

.segments-table tbody tr.is-active {
  background: rgba(6, 182, 212, .2);
}

.segment-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.segment-modal[hidden] {
  display: none;
}

.segment-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 11, 14, .72);
  backdrop-filter: blur(3px);
}

.segment-modal__dialog {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  max-height: min(90dvh, 860px);
  overflow: auto;
  margin: min(7dvh, 56px) auto 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(150, 223, 240, .32);
  background: linear-gradient(160deg, rgba(10, 36, 43, .98), rgba(6, 24, 30, .98));
  box-shadow: 0 24px 56px rgba(0, 0, 0, .55);
}

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

.segment-modal__head h3 {
  margin: 0;
  font-size: 24px;
  font-family: 'Bebas Neue', cursive;
  letter-spacing: .03em;
}

.segment-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segment-modal__grid .wide {
  grid-column: 1 / -1;
}

.segment-modal__actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.modal-open {
  overflow: hidden;
}

.wheel-center-label {
  font-family: 'Bebas Neue', cursive;
  letter-spacing: .04em;
}

.editor-panel__footer {
  margin-top: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}

.admin-grid--stack {
  grid-template-columns: 1fr;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.share-mode-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.share-mode-buttons .btn {
  min-width: 145px;
}

.share-mode-buttons .btn.is-active {
  color: #072a33;
  background: linear-gradient(130deg, #9beec5, #7fd8ff);
  border-color: rgba(152, 236, 210, .7);
  font-weight: 800;
}

.validation-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.validation-item {
  border-radius: 10px;
  border: 1px solid rgba(141, 215, 231, 0.28);
  background: rgba(4, 24, 30, 0.52);
  padding: 8px 10px;
  color: #9ccfdd;
  font-size: 12px;
  font-weight: 700;
}

.validation-item.is-ok {
  border-color: rgba(34, 197, 94, .55);
  background: rgba(34, 197, 94, .16);
  color: #baf3ce;
}

.validation-item.is-bad {
  border-color: rgba(239, 68, 68, .55);
  background: rgba(239, 68, 68, .15);
  color: #ffc5c5;
}

.validation-line {
  margin: -2px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.validation-line.is-neutral {
  color: #9ccfdd;
}

.validation-line.is-ok {
  color: #a8efc2;
}

.validation-line.is-bad {
  color: #ffc1c1;
}

.inline-mini-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.inline-mini-form input[type="text"] {
  width: 130px;
  padding: 7px 8px;
}

.inline-mini-form input[type="email"],
.inline-mini-form select {
  width: 170px;
  padding: 7px 8px;
}

.inline-mini-form select[multiple] {
  width: 220px;
  min-height: 92px;
}

.inline-mini-form .toggle-row {
  margin: 0;
}

.inline-mini-form .toggle-row span {
  font-size: 12px;
}

.table-wrap { overflow-x: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.coadmin-users-row td {
  background: rgba(4, 26, 34, .66);
}

.coadmin-users-details {
  margin: 2px 0;
}

.coadmin-users-details > summary {
  cursor: pointer;
  font-weight: 700;
  color: #c3e9f5;
  outline: none;
}

.coadmin-users-details > summary::before {
  content: "[+] ";
  color: #90d7ea;
}

.coadmin-users-details[open] > summary::before {
  content: "[-] ";
}

.coadmin-users-panel {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(123, 203, 224, .24);
  background: rgba(2, 17, 24, .56);
}

.login-hero {
  min-height: min(92vh, 880px);
  display: grid;
  place-items: center;
  position: relative;
}

.login-hero__disc {
  position: absolute;
  width: min(88vw, 760px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 22px solid rgba(6, 182, 212, .4);
  box-shadow:
    inset 0 0 40px rgba(6, 182, 212, .38),
    inset 0 0 90px rgba(249, 115, 22, .25),
    0 0 50px rgba(6, 182, 212, .25);
  transform: rotate(-8deg);
}

.login-card {
  width: min(520px, calc(100vw - 26px));
  padding: 22px;
  position: relative;
  z-index: 2;
}

.app-footer {
  text-align: center;
  color: #8ebdcc;
  padding: 18px;
  font-size: 12px;
}

@media (max-width: 1260px) {
  .editor-grid,
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 10px;
  }

  .topbar__user { align-items: flex-start; }

  .segment-builder__grid {
    grid-template-columns: 1fr;
  }

  .segment-modal__grid {
    grid-template-columns: 1fr;
  }

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

  .inline-form {
    width: 100%;
  }

  .inline-form > * {
    flex: 1 1 100%;
  }
}
