* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy);
  background: linear-gradient(180deg, var(--yellow-soft) 0%, var(--cream) 55%, var(--blue-soft) 100%);
}
.wrap { max-width: 720px; margin: 0 auto; padding: 22px 14px 56px; overflow-wrap: anywhere; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.mark { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: var(--navy); padding: 0; border: 1px solid var(--border); }
.brand h1 { margin: 0; font-size: 18px; }
.brand p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }
.eyebrow { margin: 0 0 6px; color: var(--g-highlight); font: 800 12px/1.4 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--text-muted); line-height: 1.5; font-size: 14px; }
.loading { text-align: center; color: var(--text-muted); padding: 40px 0; }
.text-button { border: 0; background: none; color: var(--blue-dark); font: 800 13px/1.3 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; min-height: 44px; padding: 8px 4px; text-align: left; }
.text-button:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 14px; font: 900 15px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; text-decoration: none; cursor: pointer;
  background: var(--blue); color: var(--cream);
}
.btn-gold { background: var(--g-gold); color: var(--g-ink); box-shadow: 0 4px 0 var(--yellow-shadow); }
.btn-gold:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--yellow-shadow); }
.btn-ghost { background: transparent; color: var(--g-cream); border: 1px solid var(--navy-border); }
.btn-done { background: var(--navy-panel); color: var(--g-highlight); box-shadow: none; cursor: default; border: 1px solid var(--g-highlight); }

.panel {
  color: var(--g-cream);
  background: var(--g-ink);
  border: 1px solid var(--g-line);
  border-radius: 20px;
  padding: 18px;
}
.empty-pass { text-align: center; padding: 30px 20px; }
.empty-pass h2 { margin: 0 0 8px; }
.empty-pass p { color: var(--light-muted); line-height: 1.55; }

/* ---------- Barista Card ---------- */
.barista-card {
  color: var(--g-cream);
  background: radial-gradient(circle, var(--mix-cream-9-transparent) 1px, transparent 1px) 0 0 / 12px 12px, linear-gradient(135deg, var(--g-ink), var(--navy-gradient));
  border: 2px solid var(--g-gold);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 6px 6px 0 var(--navy-deep);
}
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-outlet { color: var(--light-muted); font-size: 13px; font-weight: 700; }
.card-main { display: flex; align-items: center; gap: 16px; margin: 10px 0 16px; }
.card-bean { flex: none; padding: 8px; background: var(--navy-deep); border: 1px solid var(--navy-border); border-radius: 16px; }
.card-bean svg { display: block; }
.card-id { min-width: 0; }
.card-id h2 { margin: 0 0 4px; font-size: 30px; line-height: 1.1; }
.card-level { margin: 0; color: var(--g-gold); font: 800 15px/1.3 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .04em; }
.card-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.card-stats div { background: var(--navy-deep); border: 1px solid var(--navy-border); border-radius: 12px; padding: 10px 6px; text-align: center; }
.card-stats dt { color: var(--g-highlight); font: 700 11px/1.3 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; }
.card-stats dd { margin: 4px 0 0; font: 900 20px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

/* ---------- Sections ---------- */
.section { margin-top: 22px; }
.section-title { margin: 0 0 10px; font-size: 17px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.section-count { color: var(--blue); font: 800 13px/1 ui-monospace, monospace; }
.panel .section-title { color: var(--g-cream); }

.challenge-card {
  padding: 14px 16px; border: 1px dashed var(--yellow-shadow); border-left: 4px solid var(--yellow); border-radius: 12px; background: var(--yellow-soft);
}
.challenge-card h3 { margin: 0 0 6px; color: var(--navy); font: 850 13px/1.4 ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; }
.challenge-card p { margin: 0; color: var(--navy); white-space: pre-wrap; line-height: 1.5; }

.quest-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.quest-head h2 { margin: 0; font-size: 18px; }
.quest-count { padding: 6px 10px; border-radius: 8px; background: var(--navy-deep); color: var(--g-gold); font: 800 15px/1.2 ui-monospace, monospace; white-space: nowrap; }
.quest-copy { margin: 10px 0 0; color: var(--light-muted); line-height: 1.5; font-size: 14px; }
.quest-complete { border-color: var(--g-gold); }

.skill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.skill-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: var(--cream); border: 1px solid var(--border);
}
.skill-name { font-weight: 700; font-size: 14px; }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 12px; height: 12px; border-radius: 3px; background: var(--border-soft); border: 1px solid var(--border); }
.pip-on { background: var(--blue); border-color: var(--blue-dark); }
.skill-level { color: var(--blue); font: 800 12px/1 ui-monospace, monospace; min-width: 34px; text-align: right; }

.badge-grid { background: var(--g-ink); padding: 12px; border-radius: 18px; }

.history { display: grid; gap: 8px; }
.history-item { border: 1px solid var(--border); border-radius: 14px; background: var(--cream); }
.history-item summary {
  display: flex; justify-content: space-between; gap: 10px; padding: 14px; cursor: pointer; font-weight: 800; min-height: 48px; align-items: center;
}
.history-meta { color: var(--blue); font: 750 13px/1.3 ui-monospace, monospace; text-align: right; }
.history-body { padding: 0 14px 14px; }
.history-body .xp-list li { background: var(--navy); }
.history-feedback { padding: 12px; border-radius: 12px; background: var(--blue-soft); border: 1px solid var(--border); }
.history-feedback h4 { margin: 0 0 6px; font-size: 13px; color: var(--blue-dark); }
.history-feedback p { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.history-sealed { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--yellow-soft); color: var(--navy); font-size: 14px; }
.answers { margin-top: 12px; }
.answer { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.answer:last-child { border-bottom: 0; }
.answer h4 { margin: 0 0 4px; font-size: 13px; color: var(--text-muted); }
.answer p { margin: 0; white-space: pre-wrap; line-height: 1.5; }

.rules summary { cursor: pointer; font-weight: 850; min-height: 32px; }
.rules-note { color: var(--light-muted); margin: 12px 0; }
.level-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.level-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; background: var(--navy-deep); border-radius: 10px; font: 700 13px/1.3 ui-monospace, monospace; }
.level-list li b { color: var(--g-gold); }

.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

@media (max-width: 520px) {
  .card-id h2 { font-size: 24px; }
  .card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-actions { grid-template-columns: 1fr; }
  .card-bean svg { width: 60px; height: 60px; }
}

.empty-actions { display: grid; gap: 10px; justify-items: center; margin-top: 6px; }

/* Owner: outlet switcher */
.outlet-switch { margin: 0 0 16px; padding: 14px 16px; border-radius: 18px; background: var(--g-ink); color: var(--g-cream); border: 2px solid var(--yellow); }
.outlet-switch[hidden] { display: none; }
.outlet-switch label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 800; font-size: 14px; }
.owner-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--yellow); color: var(--navy); font-size: 12px; font-weight: 900; }
.outlet-switch select { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--navy-border); background: var(--cream); color: var(--navy); font: 700 16px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; }
.outlet-switch select:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
.outlet-switch-note { margin: 8px 0 0; color: var(--light-muted); font-size: 12px; line-height: 1.45; }
