:root {
  --bg: #1b1030;
  --bg2: #2a1a4a;
  --card: #2f2151;
  --accent: #ff5da2;
  --accent2: #7b5cff;
  --gold: #ffd35c;
  --text: #f4eefb;
  --muted: #b6a8d6;
  --ok: #46d39a;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100%;
}

body { padding-bottom: 90px; }

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px;
}

h1, h2 { text-align: center; margin: 8px 0 4px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; color: var(--muted); font-weight: 600; }

.subtitle { text-align: center; color: var(--muted); margin: 0 0 16px; }

/* Person selection */
.person-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 20px;
}

.person-btn {
  padding: 18px 10px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.person-btn:active { transform: scale(0.97); }
.person-btn.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 93, 162, 0.2), var(--shadow);
  background: linear-gradient(160deg, var(--accent2), var(--card));
}

/* Wheel */
.wheel-wrap {
  position: relative;
  width: min(88vw, 360px);
  margin: 10px auto 18px;
  aspect-ratio: 1;
}
#wheel { width: 100%; height: 100%; display: block; border-radius: 50%;
  box-shadow: var(--shadow); }

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 28px solid var(--gold);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.4));
  z-index: 3;
}
.hub {
  position: absolute;
  top: 50%; left: 50%;
  width: 54px; height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold));
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  z-index: 2;
}

/* Big buttons */
.btn {
  display: block;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  padding: 14px;
}

/* Result overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 25, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay.show { display: flex; animation: fade 0.25s ease; }
.result-card {
  background: linear-gradient(160deg, var(--card), var(--bg2));
  border-radius: 24px;
  padding: 30px 24px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 2px solid var(--accent);
}
.result-emoji { font-size: 3rem; }
.result-who { color: var(--muted); margin: 6px 0; }
.result-task {
  font-size: 1.7rem;
  font-weight: 900;
  margin: 10px 0 22px;
  color: var(--gold);
  text-transform: uppercase;
}

/* Open tasks */
.open-list { margin-top: 8px; }
.person-block { margin-bottom: 14px; }
.person-block h3 { margin: 6px 0; color: var(--accent); font-size: 1.05rem; }
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 1.05rem;
  cursor: pointer;
}
.task-item .check {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid var(--muted);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: transparent;
}
.task-item.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-item.done { opacity: 0.5; text-decoration: line-through; }

.empty { text-align: center; color: var(--muted); padding: 20px; }

/* Config & history */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
input[type="text"], input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #4a3a70;
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
}
input[type="number"] { max-width: 90px; }
label.switch { display: flex; align-items: center; gap: 8px; color: var(--muted); }
input[type="checkbox"] { width: 22px; height: 22px; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}

.hist-item { border-left: 4px solid var(--accent2); }
.hist-item.done { border-left-color: var(--ok); }
.hist-time { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge.open { background: rgba(123, 92, 255, 0.25); color: #c9bcff; }
.badge.done { background: rgba(70, 211, 154, 0.2); color: var(--ok); }

/* Bottom nav */
.nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(20, 10, 40, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 14px;
  border-top: 1px solid #3a2a5e;
  z-index: 40;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 16px;
  border-radius: 12px;
}
.nav a .ico { font-size: 1.4rem; }
.nav a.active { color: var(--accent); }

.toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.result-card { animation: pop 0.35s ease; }
