/* Team-Up — playful, student-friendly design system (Kahoot/Quizlet energy). */

:root {
  --purple: #6c5ce7;
  --purple-dark: #5641e0;
  --pink: #ff5c8a;
  --yellow: #ffd54a;
  --green: #22c58b;
  --red: #ff5252;
  --blue: #2f9bff;
  --ink: #1c1830;
  --muted: #7a748f;
  --card: #ffffff;
  --bg-1: #7b6cf6;
  --bg-2: #b06cf6;
  --radius: 22px;
  --shadow: 0 10px 0 rgba(0, 0, 0, 0.12);
  --shadow-soft: 0 12px 30px rgba(28, 24, 48, 0.18);
  --font: 'Baloo 2', 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(140deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

body {
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app { width: 100%; max-width: 720px; }
.app.wide { max-width: 980px; }

/* --- Blobs / playful background --------------------------------------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(6px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.blob.b1 { width: 220px; height: 220px; background: var(--yellow); top: -60px; left: -40px; }
.blob.b2 { width: 260px; height: 260px; background: var(--pink); bottom: -80px; right: -60px; }
.blob.b3 { width: 160px; height: 160px; background: var(--green); top: 40%; right: -40px; opacity: 0.25; }

/* --- Cards ------------------------------------------------------------- */
.card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 26px;
  margin: 0 auto 18px;
}

.brand {
  text-align: center;
  color: #fff;
  margin: 8px 0 22px;
  position: relative;
  z-index: 1;
}
.brand h1 {
  font-size: clamp(34px, 8vw, 56px);
  margin: 0;
  letter-spacing: -1px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}
.brand h1 .pop { color: var(--yellow); }
.brand p { margin: 4px 0 0; opacity: 0.9; font-weight: 600; }

h2 { margin: 0 0 14px; font-size: 24px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* --- Inputs ------------------------------------------------------------ */
label { display: block; font-weight: 700; margin: 14px 0 6px; font-size: 15px; }
input[type='text'], input[type='number'], input[type='time'], input[type='password'], input[type='email'], input:not([type]), select {
  width: 100%;
  padding: 15px 16px;
  font-size: 18px;
  font-family: inherit;
  font-weight: 600;
  border: 3px solid #ece9f6;
  border-radius: 16px;
  background: #faf9ff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--purple); }
.code-input { text-transform: uppercase; letter-spacing: 3px; text-align: center; font-size: 24px; }

/* --- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  background: var(--purple);
  border: none;
  border-radius: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12); }
.btn:disabled { filter: grayscale(0.5) opacity(0.6); cursor: not-allowed; }
.btn.pink { background: var(--pink); }
.btn.green { background: var(--green); }
.btn.blue { background: var(--blue); }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.ghost { background: #efecfb; color: var(--purple-dark); box-shadow: 0 6px 0 #dcd6f5; }
.btn.small { width: auto; padding: 10px 16px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 120px; }

/* --- Chips (student picking) ------------------------------------------ */
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip {
  padding: 11px 16px;
  border-radius: 999px;
  background: #f1eefc;
  border: 3px solid transparent;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s;
}
.chip:active { transform: scale(0.95); }
.chip.selected { background: var(--purple); color: #fff; border-color: var(--purple-dark); }
.chip.taken { background: #eee; color: #b3aec2; cursor: not-allowed; text-decoration: line-through; }
.chip .num { font-size: 12px; opacity: 0.8; }

/* --- Countdown --------------------------------------------------------- */
.countdown-wrap { text-align: center; padding: 20px 0; }
.countdown-label { font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.countdown {
  font-size: clamp(90px, 30vw, 200px);
  font-weight: 900;
  line-height: 1;
  color: var(--purple);
  animation: pop 1s ease-in-out infinite;
}
.countdown.small { font-size: clamp(48px, 12vw, 90px); }
@keyframes pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.clock-time { font-size: clamp(40px, 12vw, 72px); font-weight: 900; color: var(--purple); }

/* --- Team cards -------------------------------------------------------- */
.team-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.team {
  border-radius: 18px;
  padding: 16px;
  background: #f7f5ff;
  border: 3px solid #eee;
}
.team.mine { border-color: var(--green); background: #eefdf6; box-shadow: 0 0 0 4px rgba(34, 197, 139, 0.15); }
.team h3 { margin: 0 0 10px; font-size: 18px; display: flex; justify-content: space-between; }
.team .badge { font-size: 12px; background: var(--green); color: #fff; padding: 2px 10px; border-radius: 999px; }
.member { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-weight: 700; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800; flex: none;
}

/* --- Stats ------------------------------------------------------------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 120px; background: #f6f4ff; border-radius: 16px; padding: 14px; text-align: center; }
.stat .n { font-size: 34px; font-weight: 900; color: var(--purple); }
.stat .l { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

/* --- Code display ------------------------------------------------------ */
.code-badge {
  display: inline-block;
  font-size: clamp(30px, 9vw, 46px);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--purple);
  background: #f1eefc;
  padding: 10px 22px;
  border-radius: 16px;
  border: 3px dashed var(--purple);
}

/* --- Pills / segmented ------------------------------------------------- */
.seg { display: flex; gap: 8px; background: #f1eefc; padding: 6px; border-radius: 16px; }
.seg button {
  flex: 1; padding: 12px; border: none; border-radius: 12px;
  font-family: inherit; font-weight: 800; font-size: 16px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.seg button.on { background: #fff; color: var(--purple-dark); box-shadow: var(--shadow-soft); }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

/* --- Toast ------------------------------------------------------------- */
.toast-wrap { position: fixed; bottom: 20px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 14px;
  font-weight: 700; box-shadow: var(--shadow-soft); max-width: 90%;
  animation: slideUp 0.25s ease;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.hidden { display: none !important; }
.lottie { width: 180px; height: 180px; margin: 0 auto; }
.divider { height: 3px; background: #f0edfa; border: none; border-radius: 3px; margin: 20px 0; }

canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

.hint { font-size: 14px; color: var(--muted); font-weight: 600; }

/* --- Password field with show/hide toggle ---------------------------- */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap .pw-input { width: 100%; padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 6px; border-radius: 10px;
}
.pw-toggle:hover { background: #efecfb; }

/* --- Team editor (faculty drag/tap-to-move) --------------------------- */
.editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.zone {
  border-radius: 18px;
  padding: 12px;
  background: #f7f5ff;
  border: 3px dashed #e2ddf3;
  min-height: 96px;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.zone.over { border-color: var(--purple); background: #efeafd; }
.zone.armed { border-style: solid; border-color: var(--green); background: #eefdf6; cursor: pointer; }
.zone.full { border-color: #cfeadd; }
.zone.full.armed { opacity: 0.55; }
input.team-name-input {
  font-family: inherit; font-weight: 800; font-size: 16px; color: var(--ink);
  background: transparent; border: none; border-bottom: 2px dashed transparent;
  padding: 2px; width: 100%; min-width: 0; border-radius: 6px; outline: none;
}
input.team-name-input:hover { border-bottom-color: #d7cff2; }
input.team-name-input:focus { border-bottom-color: var(--purple); background: #faf9ff; }
input.team-name-input::placeholder { color: var(--ink); opacity: 0.85; }
.zone.unassigned { background: #fff7ef; border-color: #ffd9b0; }
.zone-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 800; }
.zone-head .del { cursor: pointer; color: var(--red); font-weight: 900; padding: 0 6px; border-radius: 8px; }
.zone-head .del:hover { background: #ffe5e5; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin: 4px 4px 0 0;
  border-radius: 999px; background: #fff; border: 2px solid #ece9f6;
  font-weight: 700; font-size: 15px; cursor: grab; user-select: none;
}
.mchip:active { cursor: grabbing; }
.mchip.picked { background: var(--purple); color: #fff; border-color: var(--purple-dark); }
.mchip.dragging { opacity: 0.4; }
.mchip .sc { font-size: 11px; opacity: 0.65; }
.editor-hint { font-size: 13px; color: var(--muted); font-weight: 700; margin: 4px 0 12px; }
.link-line { display: flex; gap: 8px; align-items: center; }
.link-line input { font-size: 14px; }
