.title_text {
  display: grid;
  justify-content: space-around;
  margin: 0;
}

body {
  background: radial-gradient(circle at 20% 20%, #0d1224 0%, #0a0f1d 35%, #060913 70%);
  color: #e2e8f0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: #8cb4ff;
  text-decoration-color: rgba(140, 180, 255, 0.6);
}

a:hover {
  color: #a6c7ff;
  text-decoration-color: rgba(166, 199, 255, 0.8);
}

.top-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 16px;
  background: #0f172a;
  color: #fff;
}

.wheel {
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  border: 1px solid #dadada;
  overflow: hidden;
  transform: rotate(var(--start, 0deg));
}

.wheel.spin {
  transform: rotate(var(--end, 360deg));
  transition: transform 3s cubic-bezier(0.41, 0.74, 0.6, 1);
}

.wheel--slice {
  --a: sin(calc(var(--i) * 127deg));
  --b: sin(calc(var(--i) * 311deg));
  --c: sin(calc(var(--i) * 199deg));

  --A: calc(var(--a) * abs(var(--a)));
  --B: calc(var(--b) * abs(var(--b)));
  --C: calc(var(--c) * abs(var(--c)));

  --R: clamp(20, calc(145 + 85*var(--A) + 25*var(--B) - 15*var(--C)), 230);
  --G: clamp(15, calc( 80 + 70*var(--B) + 20*var(--C) - 35*var(--A)), 200);
  --Bv: clamp(20, calc( 85 + 80*var(--C) + 25*var(--A) - 30*var(--B)), 220);

  --slice-color: rgb(var(--R) var(--G) var(--Bv));
  position: absolute;
  width: 100%;
  height: 100%;
  --deg: calc(var(--i) * (360deg / var(--total)));
  --slice-deg: calc(360deg / var(--total));
  transform: rotate(var(--deg));
  transform-origin: center;
  /* Use border trick to create pie slices that work for any number of segments */
  background: conic-gradient(
    from calc(-1 * var(--slice-deg) / 2),
    var(--slice-color, #ff6b6b) 0deg,
    var(--slice-color, #ff6b6b) var(--slice-deg),
    transparent var(--slice-deg)
  );
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.wheel--slice span {
  transform: rotate(90deg) translateX(80px);
  color: white;
  font-weight: bold;
  text-align: center;
  display: block;
  width: 75%;
  max-width: 75%;
  white-space: normal;
  word-break: break-word;
}

.challenge-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px auto;
}

.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px auto;
}

.wheel--result,
.wheel-result {
  min-width: 260px;
  min-height: 48px;
  padding: 10px 16px;
  text-align: center;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: linear-gradient(145deg, #111827, #0b1220);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.45);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid #0c5ffd;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, background 160ms ease;
  cursor: pointer;
}

.btn:hover {
  background: linear-gradient(135deg, #4f8dfb, #2d6df0);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

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

.login-toggle__label {
  margin-left: 8px;
}

.toggle-check {
  display: none;
}

.toggle-check_label {
  display: flex;
  gap: 4px;
  cursor: pointer;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: #0b1020;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-weight: 700;
}

.inline-image {
  height: 1em;
  display: block;
}

.filter-section .filter_toggle {
  display: inline-flex;
  justify-content: space-around;
  align-items: center;
  white-space: nowrap;
  gap: 8px;
  border: 1px solid #1f1f1f;
  border-radius: 4px;
}

.filter_label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
  gap: 4px;
}

.owned-check:checked ~ .filter_label {
  background-color: rgb(0, 107, 0);
  color: #fff;
  transition: background-color 0.1s ease;
}

.owned-check:not(:checked) ~ .filter_label {
  background-color: rgb(165, 0, 0);
  color: #fff;
}

.filter_toggle .filter_label.used {
  background-color: #ffd447 !important;
  color: #000 !important;
}
.used-check ~ .filter_label {
  cursor: pointer;
}

.filter-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  border-radius: 12px;
  border: 1px solid #1f2937;
  padding: 12px;
  background: #0f172a;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.4);
}

.filter_dropdown {
  display: grid;
  gap: 4px;
  align-items: center;
  justify-items: start;
}

.accordion {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 250ms ease, padding 250ms ease;
  background: #0b1020;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.5);
  padding: 0 12px;
}

.accordion-toggle:checked + .accordion {
  grid-template-rows: 1fr;
  border: 1px solid #1f2937;
  padding: 12px;
}

.accordion__inner {
  overflow: hidden;
}

section {
  background: #0b1020;
  color: #e2e8f0;
  border-radius: 16px;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.5);
  padding: 14px;
}

section h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px 0;
}

section h2 .btn {
  flex-shrink: 0;
}

.agent-wheels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 16px;
  padding: 12px;
}

.login-block {
  position: relative;
  display: inline-block;
  margin-left: auto;
}

.login-toggle-label[hidden],
.login-greeting[hidden] {
  display: none !important;
}

.login-toggle__label {
  margin-left: 8px;
}

.login-dropdown {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  min-width: 220px;
  padding: 14px;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: #0b1020;
  color: #e2e8f0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.login-toggle:checked ~ .login-dropdown {
  display: block;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form label {
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.login-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #1f2937;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
  font: inherit;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.wheel-controls {
  padding: 16px;
  margin: 16px auto;
  max-width: 960px;
  background: #0b1020;
  border-radius: 16px;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.5);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

footer {
  padding-top: 24px;
}

.result-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 12px;
}

.result-modal-overlay.active {
  display: flex;
}

.result-modal {
  background: #0b1020;
  border: 1px solid #1f2937;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  width: 560px;
  max-width: 95vw;
  height: 420px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

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

.result-modal__title {
  margin: 0;
  font-size: 1.4rem;
}

.result-modal__close {
  padding: 8px 12px;
}

.result-modal__body {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  overflow: auto;
}

.result-modal__challenge {
  margin: 0;
  font-weight: 700;
}

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

.result-modal__agents li {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .result-modal {
    width: 80vw;
    height: 80vh;
  }
}
@media (max-width: 640px) {
  body {
    padding: 8px;
    font-size: 16px;
  }

  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .title_text {
    font-size: 1.4rem;
  }

  .wheel,
  .wheel-container .wheel {
    width: 90vw;
    height: 90vw;
    max-width: 620px;
    max-height: 620px;
    min-width: 320px;
    min-height: 320px;
  }

  .wheel--slice span {
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }

  .wheel-controls {
    padding: 12px;
    gap: 10px;
  }

  .agent-wheels-grid {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  section {
    padding: 12px;
  }

  .filter-section {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .btn {
    width: 100%;
  }

  section h2 {
    flex-wrap: wrap;
    gap: 12px;
  }

  section h2 .btn,
  .agent-save {
    width: auto;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  body {
    padding: 12px;
  }

  .title_text {
    font-size: 1.6rem;
  }

  .wheel,
  .wheel-container .wheel {
    width: 90vw;
    height: 90vw;
  }

  .wheel-controls {
    max-width: 840px;
  }

  .agent-wheels-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (min-width: 1025px) {
  body {
    padding: 16px;
  }

  .title_text {
    font-size: 1.8rem;
  }

  .wheel,
  .wheel-container .wheel {
    width: 420px;
    height: 420px;
  }

  .wheel-controls {
    max-width: 1040px;
  }
}
