/* Campoff — night camp palette
   night #0B0F0E, smoke #17201D, ember #FF7A3D, moss #7FA98C, bone #EDE7DC, ash #8B948F */

:root {
  --night: #0B0F0E;
  --smoke: #17201D;
  --smoke-2: #1F2A26;
  --ember: #FF7A3D;
  --ember-deep: #C24A1A;
  --moss: #7FA98C;
  --bone: #EDE7DC;
  --ash: #8B948F;
  --danger: #E0604C;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--bone);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen { min-height: 100dvh; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

.brand {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800; font-size: 2.6rem; letter-spacing: -0.02em; margin: 0.2em 0 0;
}
.brand.small { font-size: 1.2rem; }
.tagline { color: var(--ash); margin-top: 4px; margin-bottom: 32px; }

.ember-mark {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 22px var(--ember), 0 0 44px rgba(255,122,61,.35);
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe { 50% { box-shadow: 0 0 10px var(--ember), 0 0 20px rgba(255,122,61,.2); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .ember-mark { animation: none; } }

.auth-wrap { margin: auto 0; padding: 48px 0; display: flex; flex-direction: column; gap: 12px; }
.auth-wrap h2 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.field span { font-size: .85rem; color: var(--ash); }
.field input {
  background: var(--smoke); color: var(--bone);
  border: 1px solid var(--smoke-2); border-radius: var(--radius);
  padding: 14px 16px; font-size: 1.05rem; outline: none;
}
.field input:focus-visible { border-color: var(--ember); }
#auth-code, #modal-input { letter-spacing: .25em; font-variant-numeric: tabular-nums; text-transform: uppercase; }

.btn {
  border: 1px solid var(--smoke-2); background: var(--smoke); color: var(--bone);
  border-radius: var(--radius); padding: 14px 18px; font-size: 1rem; cursor: pointer;
  transition: transform .06s ease, background .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #1A0E06; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(224,96,76,.35); }
.btn.tiny { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

.error { color: var(--danger); min-height: 1.2em; font-size: .9rem; }
.hint { color: var(--ash); font-size: .9rem; line-height: 1.5; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 8px;
}
.iconbtn { background: none; border: none; color: var(--ash); font-size: 1.3rem; cursor: pointer; padding: 6px 10px; }
.iconbtn:focus-visible { outline: 2px solid var(--ember); border-radius: 8px; }

/* -------- home -------- */
.home-main { display: flex; flex-direction: column; align-items: center; padding: 24px 0 8px; }
.start-ring {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #241812 0%, var(--smoke) 62%);
  border: 2px solid var(--ember-deep);
  color: var(--bone); cursor: pointer;
  box-shadow: 0 0 40px rgba(255,122,61,.16), inset 0 0 30px rgba(255,122,61,.08);
  transition: box-shadow .3s, transform .06s;
}
.start-ring:active { transform: scale(.97); }
.start-ring:focus-visible { outline: 3px solid var(--ember); outline-offset: 4px; }
.start-label { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 1.5rem; line-height: 1.15; }
.ritual { color: var(--ash); font-size: .85rem; letter-spacing: .04em; margin-top: 14px; }

.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px 0; }
.total { background: var(--smoke); border-radius: var(--radius); padding: 12px 8px; text-align: center; }
.total b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.total span { color: var(--ash); font-size: .72rem; }

.groups-block { padding-bottom: 32px; }
.groups-head { display: flex; align-items: center; justify-content: space-between; }
.groups-head h3 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 600; margin: 12px 0; }
.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.group-item {
  background: var(--smoke); border-radius: var(--radius); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.group-item small { color: var(--ash); }

/* -------- session: near-black, one dim timer -------- */
.session-screen { background: #000; justify-content: center; }
.session-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 0; }
.session-ring { width: 230px; height: 230px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #101010; stroke-width: 3; }
.ring-fg {
  fill: none; stroke: var(--ember-deep); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 565.5; stroke-dashoffset: 565.5; opacity: .55;
  transition: stroke-dashoffset 1s linear;
}
.session-time {
  position: absolute; font-variant-numeric: tabular-nums;
  font-size: 2.2rem; color: #5A5148; letter-spacing: .06em;
}
.session-inner { position: relative; }
.session-time { top: 50%; left: 50%; transform: translate(-50%, -130%); }
.session-hint { color: #33302B; font-size: .8rem; }
.btn.end { background: transparent; border-color: #262626; color: #6B655D; }

.done-time { font-size: 2.4rem; font-variant-numeric: tabular-nums; font-family: "Bricolage Grotesque", sans-serif; margin: 0; }

/* -------- group board -------- */
.group-title { font-family: "Bricolage Grotesque", sans-serif; font-weight: 600; }
.tabs { display: flex; gap: 6px; padding: 8px 0 16px; }
.tabs button {
  flex: 1; background: transparent; border: 1px solid var(--smoke-2); color: var(--ash);
  border-radius: 10px; padding: 9px 0; cursor: pointer; font-size: .85rem;
}
.tabs button.active { background: var(--smoke); color: var(--bone); border-color: var(--ember-deep); }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.board-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--smoke); border-radius: var(--radius); padding: 13px 16px;
}
.board-row.me { border: 1px solid var(--ember-deep); }
.presence {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: #3A423E;
}
.presence.on {
  background: var(--moss);
  box-shadow: 0 0 10px var(--moss), 0 0 20px rgba(127,169,140,.4);
}
.board-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-time { font-variant-numeric: tabular-nums; color: var(--bone); }
.board-rank { color: var(--ash); width: 1.4em; font-size: .85rem; }

.invite-box { padding: 16px 0 32px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.invite-box b { color: var(--ember); letter-spacing: .2em; }

.settings-wrap { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 32px; }
.settings-wrap hr { border: none; border-top: 1px solid var(--smoke-2); width: 100%; margin: 16px 0; }

/* -------- modal + toast -------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal-card { background: var(--smoke); border-radius: 18px; padding: 22px; width: 100%; max-width: 380px; }
.modal-card h3 { margin: 0 0 8px; font-family: "Bricolage Grotesque", sans-serif; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--smoke-2); color: var(--bone); border-radius: 12px;
  padding: 12px 20px; z-index: 60; font-size: .9rem; max-width: 90vw;
}
