* {
  box-sizing: border-box;
}

:root {
  --bg: #12102a;
  --card: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.14);
  --text: #f4f2ff;
  --muted: #b6b1d8;
  --pink: #ff4d6d;
  --violet: #7b61ff;
  --yellow: #ffd60a;
  --cyan: #4cc9f0;
  --radius: 26px;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.42);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'SN Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 15% -10%, #3b1d7a 0%, transparent 60%),
    radial-gradient(1000px 700px at 110% 20%, #0b3d5c 0%, transparent 55%),
    radial-gradient(900px 900px at 50% 130%, #7a1d55 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- фоновые пятна ---------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  animation: float 14s ease-in-out infinite;
}
.blob--1 {
  width: 340px;
  height: 340px;
  background: #ff4d6d;
  top: -80px;
  left: -60px;
}
.blob--2 {
  width: 300px;
  height: 300px;
  background: #4cc9f0;
  bottom: -90px;
  right: -50px;
  animation-delay: -5s;
}
.blob--3 {
  width: 260px;
  height: 260px;
  background: #ffd60a;
  top: 45%;
  left: 55%;
  opacity: 0.22;
  animation-delay: -9s;
}
@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(30px, -35px, 0) scale(1.12);
  }
}

/* ---------- раскладка ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 20px 60px;
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.title__accent {
  background: linear-gradient(92deg, var(--yellow) 0%, var(--pink) 45%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ---------- колесо ---------- */
.wheel-card {
  padding: 30px 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}

.wheel-wrap {
  position: relative;
  width: min(78vw, 440px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  animation: pointer-bob 1.8s ease-in-out infinite;
}
@keyframes pointer-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(5px);
  }
}

.hub-glow {
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 60px 10px rgba(255, 214, 10, 0.25);
  opacity: 0.85;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
kbd {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 3px;
  border-radius: 8px;
  padding: 2px 9px;
  font-family: inherit;
  font-size: 0.85rem;
}

/* ---------- кнопки ---------- */
.btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  padding: 15px 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  user-select: none;
}
.btn:active {
  transform: translateY(4px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--spin {
  background: linear-gradient(180deg, #ff7a45 0%, var(--pink) 55%, #d61d5b 100%);
  box-shadow: 0 8px 0 #97113f, 0 16px 30px rgba(255, 77, 109, 0.45);
  font-size: 1.25rem;
  padding: 17px 44px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.btn--spin:hover {
  filter: brightness(1.08);
}
.btn--spin:active {
  box-shadow: 0 3px 0 #97113f, 0 8px 18px rgba(255, 77, 109, 0.4);
}

.btn--add {
  background: linear-gradient(180deg, #37e0c0 0%, #12b39a 100%);
  box-shadow: 0 5px 0 #0a7d6b;
  font-size: 1.4rem;
  padding: 10px 18px;
  line-height: 1;
}
.btn--add:active {
  box-shadow: 0 2px 0 #0a7d6b;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
  font-size: 0.95rem;
  padding: 12px 22px;
}
.btn--ghost:active {
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.icon-btn {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: inherit;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease;
  flex-shrink: 0;
}
.icon-btn:hover {
  transform: translateY(-2px) scale(1.05);
}
.icon-btn:active {
  transform: translateY(2px);
}

/* ---------- панель действий ---------- */
.panel {
  padding: 24px 20px 20px;
}
.panel__title {
  margin: 0 0 16px;
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge {
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 3px 11px;
  box-shadow: 0 4px 12px rgba(123, 97, 255, 0.5);
}

.add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.add-form__input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.add-form__input::placeholder {
  color: #8f8ab5;
}
.add-form__input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(76, 201, 240, 0.18);
}

.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.action-list::-webkit-scrollbar {
  width: 8px;
}
.action-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
}

.action {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 9px 10px 9px 12px;
  animation: pop-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.action__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.3), 0 0 10px currentColor;
}

.action__text {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action__input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--cyan);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 7px 10px;
  outline: none;
}

.action__btn {
  border: 0;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 0.95rem;
  line-height: 1;
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
  flex-shrink: 0;
}
.action__btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}
.action__btn--edit {
  background: linear-gradient(180deg, #6db8ff, #2f7fe0);
  box-shadow: 0 3px 0 #1b4f96;
}
.action__btn--del {
  background: linear-gradient(180deg, #ff7b8f, #ef3e63);
  box-shadow: 0 3px 0 #9c1737;
}
.action__btn--ok {
  background: linear-gradient(180deg, #37e0c0, #12b39a);
  box-shadow: 0 3px 0 #0a7d6b;
}

.panel__footer {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 18px 8px;
  font-size: 0.95rem;
}

/* ---------- модалка результата ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 6, 24, 0.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade 0.25s ease;
}
.modal[hidden] {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal__card {
  position: relative;
  width: min(560px, 100%);
  text-align: center;
  padding: 56px 30px 34px;
  border-radius: 34px;
  background: linear-gradient(160deg, #2b1d63 0%, #451a67 55%, #7a1d55 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), 0 0 80px rgba(255, 77, 109, 0.28);
  animation: bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bounce-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.85);
  }
}

.modal__burst {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 62px;
  animation: burst 1.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}
@keyframes burst {
  0%,
  100% {
    transform: translateX(-50%) rotate(-8deg) scale(1);
  }
  50% {
    transform: translateX(-50%) rotate(8deg) scale(1.14);
  }
}

.modal__label {
  margin: 0;
  color: #ffd8e6;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal__result {
  margin: 14px 0 26px;
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(92deg, var(--yellow), #fff 55%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(255, 214, 10, 0.35);
  word-break: break-word;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ---------- конфетти, тост ---------- */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 40;
  background: linear-gradient(180deg, #2c2a4d, #1c1a38);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-weight: 700;
  padding: 13px 22px;
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast[hidden] {
  display: none;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
