:root {
  --bg: #0a1120;
  --bg-2: #0e1728;
  --surface: #14203a;
  --surface-2: #1b2a49;
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #eaf1fb;
  --muted: #93a6c6;
  --brand: #2fd4c4;      /* teal */
  --brand-ink: #063b37;
  --accent: #ff5c3c;     /* coral */
  --gold: #ffcb47;
  --ok: #34d399;
  --no: #fb6f68;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --r: 16px;
  --r-sm: 10px;
  --sp: 8px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(47, 212, 196, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(255, 92, 60, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 28px);
  background: rgba(10, 17, 32, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #1f9d95 60%, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 6px 16px rgba(47,212,196,.3);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1rem; letter-spacing: -0.02em; }
.brand-text span { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }

.who { display: flex; align-items: center; gap: 8px; }
.who label { font-size: 0.78rem; color: var(--muted); }
.who select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 7px 12px; font-size: 0.85rem; max-width: 130px;
}
.sync { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: background .3s; flex: none; }
.sync.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.sync.busy { background: var(--gold); }
.sync.err { background: var(--no); }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky; top: var(--nav-h); z-index: 30;
  display: flex; gap: 6px;
  padding: 10px clamp(14px, 4vw, 28px);
  overflow-x: auto;
  background: rgba(10, 17, 32, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  border: 1px solid transparent;
  background: transparent; color: var(--muted);
  padding: 9px 16px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: all .18s ease;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active { color: var(--brand-ink); background: var(--brand); }

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: clamp(16px, 3vw, 28px); }
.panel { display: none; animation: fade .25s ease; }
.panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.hint { color: var(--muted); font-size: 0.85rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

/* ---------- Buttons / forms ---------- */
.btn {
  cursor: pointer; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text);
  border-radius: var(--r-sm); padding: 10px 14px;
  font-size: 0.88rem; font-weight: 600; transition: all .15s ease;
  min-height: 42px;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn-primary:hover { background: #45e2d2; }

.inline-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form select {
  flex: 1 1 140px; min-width: 0;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 0.9rem; min-height: 42px;
}
.inline-form .btn-primary { flex: none; min-width: 46px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 14px 16px;
}
.stat b { display: block; font-size: 1.6rem; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 0.78rem; }
.stat.accent b { color: var(--brand); }

/* ---------- Chips / members ---------- */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 8px 6px 14px; font-size: 0.88rem;
}
.chips .avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 0.7rem; font-weight: 700;
  color: #06121f;
}
.chips button {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 4px;
}
.chips button:hover { color: var(--no); }
.empty { color: var(--muted); font-size: 0.85rem; padding: 6px 2px; }

/* ---------- Tasks ---------- */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tasks li {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px;
}
.tasks li.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-check { width: 22px; height: 22px; flex: none; cursor: pointer; accent-color: var(--brand); }
.t-title { flex: 1; font-size: 0.92rem; min-width: 0; }
.t-who { font-size: 0.75rem; color: var(--brand); font-weight: 600; white-space: nowrap; }
.t-del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.t-del:hover { color: var(--no); }

/* ---------- Progress ---------- */
.progress {
  position: relative; height: 30px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 14px;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #1f9d95);
  transition: width .4s ease;
}
.progress span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700; color: var(--text);
}

/* ---------- Category lists (pack / store) ---------- */
.pack-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pack-tools input[type=search], #store-search {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 9px 14px; font-size: 0.88rem; min-width: 160px;
}
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--brand); width: 16px; height: 16px; }
.add-item { margin-bottom: 16px; }

.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cat {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
}
.cat h3 {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 0.95rem;
}
.cat h3 .tag { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

.pack-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-top: 1px solid var(--border);
}
.pack-item:first-of-type { border-top: none; }
.pack-item.done .pi-name { text-decoration: line-through; color: var(--muted); }
.pack-item input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--brand); cursor: pointer; }
.pi-name { flex: 1; font-size: 0.88rem; min-width: 0; }
.pi-who {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 5px 8px; font-size: 0.76rem; max-width: 108px;
}
.pi-who.set { color: var(--brand); border-color: rgba(47,212,196,.4); }
.pi-del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.pi-del:hover { color: var(--no); }

/* ---------- Store rows ---------- */
.store-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 7px 4px; border-top: 1px solid var(--border);
}
.store-item:first-of-type { border-top: none; }
.si-name { font-size: 0.86rem; min-width: 0; flex: 1; }
.si-add {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--brand); font-size: 1rem; font-weight: 700; line-height: 1;
  cursor: pointer; transition: all .15s ease;
}
.si-add:hover { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.si-price { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); white-space: nowrap; }
.si-per { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 500; }

/* ---------- Lineup ---------- */
.day-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.day-btn {
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); border-radius: var(--r-sm);
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 0.85rem;
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25;
}
.day-btn small { color: var(--muted); font-weight: 500; font-size: 0.7rem; }
.day-btn.is-active { background: var(--accent); border-color: transparent; color: #2a0a03; }
.day-btn.is-active small { color: rgba(42,10,3,.7); }

.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stage {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px; box-shadow: var(--shadow);
}
.stage h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand); margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.act { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
.act-time { font-variant-numeric: tabular-nums; font-size: 0.74rem; color: var(--muted); white-space: nowrap; width: 82px; flex: none; }
.act-name { flex: 1; font-size: 0.88rem; font-weight: 600; min-width: 0; }
.fav {
  border: none; background: transparent; cursor: pointer;
  font-size: 1.05rem; color: #3a4560; line-height: 1; padding: 2px;
}
.fav.on { color: var(--gold); }
.stage-empty { color: var(--muted); font-size: 0.8rem; }

/* ---------- Rules ---------- */
.rules-grid { margin-bottom: 20px; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule-list li { padding: 9px 2px; border-top: 1px solid var(--border); font-size: 0.88rem; }
.rule-list li:first-child { border-top: none; }
.rule-list small { display: block; color: var(--muted); font-size: 0.76rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.ok { background: var(--ok); }
.dot.no { background: var(--no); }
.rule-col.allowed { border-color: rgba(52,211,153,.28); }
.rule-col.forbidden { border-color: rgba(251,111,104,.28); }
.rule-figure { margin: 0; }
.rule-figure img { width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--border); display: block; }

/* ---------- Map ---------- */
.map-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.map-visual {
  font-size: 3rem; width: 96px; height: 96px; flex: none;
  display: grid; place-items: center; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border);
}
.map-body { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---------- Footer ---------- */
.foot { text-align: center; color: var(--muted); font-size: 0.76rem; padding: 28px 16px 40px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
