/* ===== WolfQuest V1.0 - Milestone 1 styles =====
   Mobile-first: the base styles are for phones.
   The @media (min-width: 768px) block at the bottom adds the desktop sidebar. */

:root {
  --bg: #07070a;
  --surface: #121218;
  --surface-2: #1a1a24;
  --border: #2a2a3a;
  --violet: #8b5cf6;
  --violet-bright: #a78bfa;
  --neon: #c084fc;
  --text: #ececf4;
  --muted: #a0a0b8;
  --warn-bg: #2a1d0a;
  --warn-border: #b7791f;
  --warn-text: #fbd38d;
  --glow: 0 0 12px rgba(139, 92, 246, 0.35);
  --nav-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, rgba(139, 92, 246, 0.12), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Layout ---------- */
.app {
  min-height: 100vh;
}

.main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
}

/* Make sure the "hidden" attribute always wins over other display rules. */
[hidden] {
  display: none !important;
}

/* ---------- Navigation (mobile = bottom bar) ---------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: rgba(10, 10, 16, 0.96);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.brand {
  display: none;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nav-btn {
  width: 100%;
  min-height: var(--nav-height);
  background: none;
  border: 0;
  border-top: 2px solid transparent;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  cursor: pointer;
}

.nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-label {
  font-size: 0.75rem;
}

.nav-btn[aria-current="page"] {
  color: var(--neon);
  border-top-color: var(--violet);
  background: linear-gradient(to bottom, rgba(139, 92, 246, 0.18), transparent);
}

.nav-btn:focus-visible,
.quest-check:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

/* ---------- Page header ---------- */
.page-head {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet-bright);
}

h1 {
  margin: 4px 0 2px;
  font-size: 1.75rem;
  line-height: 1.2;
  text-shadow: 0 0 18px rgba(139, 92, 246, 0.5);
}

.date {
  margin: 0;
  color: var(--muted);
}

/* ---------- Notice banner ---------- */
.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

/* ---------- Summary ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary-wrap {
  margin-bottom: 20px;
}

.summary-wrap .date {
  margin-bottom: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 4px;
  text-align: center;
  min-width: 0;
}

.stat-sub {
  display: block;
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.9rem, 4.6vw, 1.15rem);
  font-weight: 700;
  color: var(--neon);
  overflow-wrap: anywhere;
}

.bar {
  position: relative;
  height: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* Thin line showing the 80% daily requirement */
.bar-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 80%;
  width: 2px;
  background: var(--text);
  opacity: 0.7;
}

.req {
  margin: 0;
  font-weight: 600;
  color: var(--warn-text);
}

.req.is-met {
  color: var(--neon);
}

.counts {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hint {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Accountability card ---------- */
.acct {
  margin-bottom: 14px;
  padding: 10px 14px 12px;
  border-style: dashed;
  border-color: var(--violet-bright);
}

.acct .quest-label {
  padding-left: 0;
  padding-right: 0;
  min-height: 56px;
}

.acct-hint {
  margin-top: 0;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--neon));
  box-shadow: var(--glow);
  transition: width 0.3s ease;
}

/* ---------- Quest cards ---------- */
.quest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.quest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quest-card.is-done {
  border-color: var(--violet);
  box-shadow: var(--glow);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.14), var(--surface));
}

.quest-label {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 14px;
  cursor: pointer;
}

.quest-check {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin: 0;
  border: 2px solid var(--violet-bright);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.quest-check:checked {
  background-color: var(--violet);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-size: 80%;
  background-position: center;
  background-repeat: no-repeat;
}

.quest-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quest-card.is-done .quest-text {
  color: var(--muted);
}

.quest-xp {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon);
  white-space: nowrap;
}

/* ---------- Side quest form ---------- */
.side-form {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.side-row {
  display: flex;
  gap: 8px;
}

.side-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.side-input[aria-invalid="true"] {
  border-color: var(--warn-border);
}

.side-input:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
}

.btn {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 48px;
  padding: 8px 18px;
  background: var(--violet);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn:active {
  background: var(--violet-bright);
}

.form-error {
  min-height: 1.25em;
  margin: 6px 0 0;
  color: var(--warn-text);
  font-size: 0.9rem;
}

.empty {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

/* ---------- Desktop: left sidebar ---------- */
@media (min-width: 768px) {
  .app {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .nav {
    position: sticky;
    top: 0;
    height: 100vh;
    border-top: 0;
    border-right: 1px solid var(--border);
    padding: 24px 12px;
  }

  .brand {
    display: block;
    margin: 0 8px 24px;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-shadow: var(--glow);
  }

  .brand span {
    color: var(--neon);
  }

  .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 8px 14px;
    border-top: 0;
    border-left: 3px solid transparent;
    border-radius: 8px;
  }

  .nav-btn:hover {
    background: var(--surface-2);
  }

  .nav-btn[aria-current="page"] {
    border-left-color: var(--violet);
    background: linear-gradient(to right, rgba(139, 92, 246, 0.22), transparent);
  }

  .nav-label {
    font-size: 1rem;
  }

  .main {
    padding: 32px 32px 48px;
  }

  h1 {
    font-size: 2.1rem;
  }
}

/* ---------- Respect reduced-motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
