@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #f5f2ff;
  --fg: #1b1636;
  --muted: #7a739b;
  --accent: #6b4cff;
  --accent-fg: #fff;
  --accent-tint: #ebe6ff;
  --accent2: #ffb627;
  --accent2-fg: #241a00;
  --accent2-tint: #fff1d0;
  --border: #e6e1fa;
  --card-bg: #fff;
  --danger: #b3261e;
  --stale: #c25b3d;
  --pinned: var(--accent);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Space Grotesk", sans-serif;
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.4rem; font-family: "Space Grotesk", sans-serif; font-weight: 700; color: var(--accent); text-decoration: none; font-size: 1.1rem; }
.brand svg { flex-shrink: 0; }

.topbar nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: min(18rem, 85vw);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4.25rem 1rem 1rem;
  overflow-y: auto;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  /* Slides out from the left; hidden when closed so links leave the tab order. */
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.topbar.nav-open nav { transform: none; visibility: visible; transition: transform 0.25s ease; }
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.5);
  animation: nav-fade 0.25s ease;
}
.nav-backdrop[hidden] { display: none; }
@keyframes nav-fade { from { opacity: 0; } }
.nav-toggle { position: relative; z-index: 40; }
.topbar nav .nav-extra { display: none; }
@media (prefers-reduced-motion: reduce) {
  .topbar nav, .topbar.nav-open nav { transition: none; }
  .nav-backdrop { animation: none; }
}
.topbar nav a { color: var(--fg); text-decoration: none; padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--border); font-weight: 600; }
.topbar nav a:hover { color: var(--accent); }
.topbar nav .nav-label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: 1rem 0.25rem 0.25rem; border-bottom: 1px solid var(--border); }

.log-session-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 6px 14px -6px rgba(107, 76, 255, 0.5);
}
.log-session-cta:hover { opacity: 0.9; }
.log-bar { display: none; }
.log-session-cta-sm { font-size: 0.9rem; padding: 0.3rem 0.8rem; margin-left: auto; }
a.location-badge { text-decoration: none; color: inherit; outline: 2px solid var(--accent-tint); }
a.location-badge:hover { outline-color: var(--accent); }
.log-session-cta-large { font-size: 1.15rem; padding: 0.85rem 1.6rem; border-radius: 999px; box-shadow: 0 10px 20px -8px rgba(107, 76, 255, 0.45); }

.dog-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.3rem 0.8rem 0.3rem 0.3rem;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: 0 2px 10px -4px rgba(51, 54, 31, 0.18);
}
.dog-chip-avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.dog-chip select {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--fg);
  padding: 0;
  cursor: pointer;
}
.dog-chip select option {
  color: var(--fg);
  background: var(--card-bg);
}

.dog-switcher { margin-left: auto; }
.account { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; max-width: none; }
.account .link-button {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--accent);
  padding: 0.25rem;
  font-weight: 700;
}
.account .link-button:hover { text-decoration: underline; }
.account-email { color: var(--muted); font-size: 0.85rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-link { color: var(--muted); font-size: 0.85rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.report-link:hover { color: var(--accent); text-decoration: underline; }
.report-kinds { display: flex; gap: 1rem; flex-wrap: wrap; border: none; padding: 0; margin: 0; }
.report-kinds label { display: inline-flex; flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 600; }
.login-card { max-width: 440px; margin: 3rem auto; display: flex; flex-direction: column; gap: 0.75rem; }
.login-card .google-signin { text-align: center; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 100%; height: 2px; background: var(--fg); border-radius: 2px; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.container { max-width: 900px; margin: 0 auto; padding: 1.5rem; }

h1 { margin-top: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); }

.muted { color: var(--muted); }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  margin-left: 0.4rem;
}

.item-list { list-style: none; padding: 0; }
.item-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.item-list li.archived { opacity: 0.6; }

/* Command cards: one per command so they don't blur together. Used on the
   commands list, set pages and the dashboard. */
.command-cards { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; max-width: 640px; }
.command-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 10px -4px rgba(51, 54, 31, 0.1);
}
.command-card.archived { opacity: 0.6; border-left-color: var(--border); }
.command-card-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.command-card-name:hover { color: var(--accent); }
.command-card-progress {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  white-space: nowrap;
}
.command-card-progress:hover { color: var(--accent); filter: brightness(0.95); }
/* Anything under the name and button (progress, stale pills) takes a full row. */
.command-card-body { flex-basis: 100%; min-width: 0; }
.command-card-body .location-grid { margin-bottom: 0; }
.dashboard-section .command-card { margin-bottom: 0.6rem; }

.filter-bar a { text-decoration: none; font-weight: 600; }
.filter-bar a.active { font-weight: 800; text-decoration: underline; }

form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 480px; }
form label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 700; }
form input, form select, form textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
form textarea { min-height: 4rem; }
fieldset { border: 1.5px solid var(--border); border-radius: 14px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.4rem !important; font-weight: 400; }
.event-severity-input { width: 3.5rem; padding: 0.2rem 0.4rem; }
.event-pick { margin-bottom: 0.6rem; }
.event-pick.ev { padding: 0.55rem 0.8rem; margin: 0 0 0.6rem; }
.event-pick .ev-name { font-size: 0.8rem; }
.event-pick[hidden] { display: none; }
.event-pick-head { display: flex; align-items: center; gap: 0.5rem; }
.event-pick-head strong { flex: 1; }
.event-remove { background: none; border: 0; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 0.3rem; cursor: pointer; width: auto; min-height: 0; box-shadow: none; }
.event-options { list-style: none; margin: 0.5rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.event-options li[hidden] { display: none; }
.event-options button[class*="ev-"] { background: var(--ev-tint); color: var(--ev); border-left: 4px solid var(--ev); }
.event-options button { width: auto; min-height: 0; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--accent2-tint); color: var(--accent2); border: 0; font-size: 0.85rem; font-weight: 700; box-shadow: none; }
.event-note-input { margin: 0.3rem 0 0; width: 100%; padding: 0.3rem 0.5rem; }
.event-note { margin: 0.3rem 0 0; font-size: 0.85rem; }
.form-error {
  max-width: 480px;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--danger);
  border-radius: 12px;
  color: var(--danger);
  font-weight: 600;
}

#command-rows { display: flex; flex-direction: column; gap: 0.75rem; max-width: 640px; }
.session-command-row {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 2px 10px -4px rgba(51, 54, 31, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.session-command-row-top { display: flex; align-items: center; justify-content: space-between; }
.command-picker { position: relative; flex: 1; min-width: 0; }
.command-picker-toggle {
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--fg);
  box-shadow: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.command-picker-toggle { position: relative; padding-right: 2.2rem; }
.command-picker-toggle::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-70%) rotate(45deg);
}
.command-picker-toggle[aria-expanded="true"]::after { transform: translateY(-30%) rotate(-135deg); }
.command-picker-toggle.is-placeholder { color: var(--muted); font-weight: 600; }
.session-command-row-top .command-picker-toggle {
  font-size: 1rem;
  padding: 0.7rem 2.2rem 0.7rem 0.9rem;
  border-color: var(--accent);
  background: var(--bg);
}
.command-picker-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 24px -8px rgba(51, 54, 31, 0.35);
  padding: 0.4rem;
  margin-top: 0.3rem;
}
.command-picker-panel:not([hidden]) { display: flex; flex-direction: column; }
.command-picker-search {
  position: sticky;
  top: 0;
  z-index: 1;
  order: -1;
  font: inherit;
  font-size: 16px; /* >=16px stops iOS zooming on focus */
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.2rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--fg);
  width: 100%;
  box-sizing: border-box;
}
.command-picker-empty { padding: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.command-picker-option.active { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-tint); }
.command-picker-group-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 0.5rem 0.5rem 0.2rem;
}
.command-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--fg);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
}
.command-picker-option:hover { background: var(--accent-tint); }
.command-picker-option.selected { background: var(--accent); color: var(--accent-fg); }
.stage-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stage-pill-btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  width: auto;
}
.stage-pill-btn.selected { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.session-command-row .rating-input { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; }
.session-command-row .rating-input input { width: 4.5rem; }
.session-command-row .rating-input input[name="reps"] { width: 6rem; }
.session-command-row input[type="text"] { width: 100%; }
.session-command-row .remove-row { background: transparent; color: var(--muted); padding: 0.2rem 0.5rem; box-shadow: none; }
.add-command-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 2px dashed var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8rem;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  width: 100%;
}

button, .link-button {
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  width: fit-content;
  box-shadow: 0 4px 10px -4px rgba(107, 76, 255, 0.4);
}
button:hover, .link-button:hover { opacity: 0.9; }
a.link-button, a.link-button:hover { color: var(--accent-fg); display: inline-block; }

/* Secondary actions (Edit, Pin) sit as quiet text links so the page's main
   button stands out. */
.quiet-actions .link-button {
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
}
/* Match the Edit link beside it. */
.quiet-actions a { font-weight: 600; }
.quiet-actions .link-button:hover { text-decoration: underline; opacity: 1; }

/* Archive on an edit page: a quiet link set apart below Save so the two
   buttons never crowd each other on a phone. */
.archive-form { margin-top: 1.25rem; }
.archive-form .link-button {
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
}
.archive-form .link-button:hover { text-decoration: underline; opacity: 1; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.card-tint-primary { background: var(--accent-tint); border: none; }
.card-tint-secondary { background: var(--accent2-tint); border: none; }

.focus-highlight {
  background: var(--card-bg);
  border: 1.5px solid var(--accent);
  border-left-width: 6px;
  box-shadow: 0 8px 20px -8px rgba(107, 76, 255, 0.4);
}
.focus-highlight-heading { display: flex; align-items: center; gap: 0.5rem; }
.focus-highlight-heading svg { color: var(--accent); flex-shrink: 0; }
.focus-dates { margin: 0 0 0.75rem; font-size: 0.9rem; }

.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}
.profile-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1.2; }
.profile-stat-label { font-weight: 700; }

.dashboard-section h2 { margin-bottom: 0.5rem; font-size: 1.05rem; }

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--border);
  margin-right: 0.3rem;
}
.status-pill.stale { background: var(--stale); color: #fff; }
.status-pill.pinned { background: var(--pinned); color: #fff; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); }

.location-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.location-badge {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.5rem 0.7rem;
  background: var(--card-bg);
  min-width: 90px;
}
.location-badge .loc-name { font-weight: 700; display: block; }
.location-badge .loc-stage { color: var(--muted); }
.stage-ladder { display: flex; gap: 3px; margin: 0.35rem 0; }
.stage-ladder-rung { flex: 1; height: 5px; border-radius: 3px; background: var(--border); }
.stage-ladder-rung.reached { background: var(--accent); }

.empty-state { color: var(--muted); font-style: italic; padding: 1rem 0; }

.event-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent2-tint);
  color: var(--accent2);
  margin-left: 0.4rem;
}

.timeline { display: flex; flex-direction: column; gap: 0; padding-left: 1.4rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; }
.timeline-item .card { margin-left: 1rem; }
.timeline-dot {
  position: absolute;
  left: -1.9rem;
  top: 1.3rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--muted);
}
.timeline-dot-session { background: var(--accent); }
.timeline-dot-diary { background: var(--accent2); }

.edit-link {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.85rem;
}

@media (max-width: 880px) {
  /* Phone and small-tablet header: menu button, brand and dog switcher on
     one row, the log-session button full width below; Report an issue and
     Sign out move into the menu. */
  .topbar { padding: 0.6rem 1rem; gap: 0.6rem 0.75rem; }
  .brand { flex-shrink: 0; }
  .dog-switcher { order: 1; flex: 1 1 0; min-width: 0; display: flex; justify-content: flex-end; }
  .dog-chip { max-width: 100%; }
  .dog-switcher select { min-width: 0; max-width: 100%; padding: 0; text-overflow: ellipsis; }
  .nav-toggle { flex-shrink: 0; width: 2.25rem; height: 2.25rem; padding: 0.45rem; }
  .topbar .log-cta-top { display: none; }
  /* Log a session lives at the bottom on phones, where the thumb is. */
  .log-bar { display: flex; justify-content: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0.7rem 1rem 0.9rem; background: linear-gradient(transparent, var(--bg) 35%); pointer-events: none; }
  .log-bar .log-session-cta { pointer-events: auto; width: 100%; max-width: 640px; justify-content: center; }
  .container { padding-bottom: 6rem; }
  .topbar > .report-link, .topbar > .account { display: none; }
  .topbar nav a.nav-extra { display: block; }
  .topbar nav .nav-account { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.25rem 0; }
  .topbar nav .nav-account .link-button { padding: 0.5rem 0; background: none; box-shadow: none; color: var(--accent); }
  .topbar nav .account-email { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
}

@media (max-width: 1024px) {
  .account-email { display: none; }
}

@media (max-width: 640px) {
  .container { padding: 1rem; }

  button, .link-button, form input, form select, form textarea {
    padding: 0.65rem 0.8rem;
  }

  form { max-width: none; }

  .location-badge { flex: 1 1 45%; }

  .table-scroll table { min-width: 480px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0a1f;
    --fg: #f1eeff;
    --muted: #9b94c4;
    --accent: #9a82ff;
    --accent-fg: #120a33;
    --accent-tint: #241d4a;
    --accent2: #ffc94d;
    --accent2-fg: #2a2210;
    --accent2-tint: #332c17;
    --border: #2a2350;
    --card-bg: #18132f;
    --danger: #ff8a80;
  }
  form input, form select, form textarea { background: #120e26; color: var(--fg); }
  .session-command-row select, .session-command-row input { background: #120e26; color: var(--fg); }
  .command-picker-toggle { background: #120e26; }
  .session-command-row-top .command-picker-toggle { background: #120e26; }
}
.command-picker-option[hidden], .command-picker-group-label[hidden], .command-picker-empty[hidden] { display: none; }
.add-command-row[hidden] { display: none; }
#event-filter { width: 100%; }

/* Level-up celebration and achievements */
.celebrate-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0, 0, 0, 0.55); animation: nav-fade 0.25s ease; }
.celebrate-card { position: relative; overflow: hidden; width: min(24rem, 100%); max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--card-bg); border: 1px solid var(--border); border-radius: 22px; padding: 1.4rem 1.2rem; text-align: center; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.35); animation: celebrate-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
.celebrate-card h2 { margin: 0.3rem 0 0; font-size: 1.6rem; color: var(--accent); }
.celebrate-burst { font-size: 3.2rem; line-height: 1; animation: celebrate-bounce 0.8s ease 0.2s; }
.celebrate-levelup { margin-top: 0.9rem; }
.celebrate-what { font-weight: 700; }
.celebrate-ladder { display: flex; gap: 6px; margin: 0.5rem 0 0.3rem; }
.celebrate-ladder span { flex: 1; height: 12px; border-radius: 6px; background: var(--border); }
.celebrate-ladder .on { background: var(--accent); }
.celebrate-ladder .new { background: var(--accent2); box-shadow: 0 0 0 4px var(--accent2-tint); animation: celebrate-pulse 1s ease 0.4s 2; }
.celebrate-stage { font-weight: 800; color: var(--accent2); }
.celebrate-badge { display: flex; gap: 0.7rem; align-items: center; text-align: left; margin-top: 0.9rem; padding: 0.7rem; border-radius: 14px; background: var(--accent2-tint); }
.celebrate-badge .badge-icon { width: 2.6rem; height: 2.6rem; line-height: 2.6rem; font-size: 1.5rem; background: var(--card-bg); flex-shrink: 0; }
.celebrate-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.celebrate-actions > * { flex: 1; text-align: center; justify-content: center; }
.celebrate-actions a { border: 1px solid var(--border); border-radius: 999px; padding: 0.6rem; font-weight: 700; color: var(--fg); text-decoration: none; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 2px; opacity: 0; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(520px) rotate(540deg); } }
@keyframes celebrate-pop { from { transform: scale(0.85); opacity: 0; } }
@keyframes celebrate-bounce { 30% { transform: scale(1.3) rotate(-8deg); } 60% { transform: scale(0.95) rotate(4deg); } }
@keyframes celebrate-pulse { 50% { box-shadow: 0 0 0 9px var(--accent2-tint); } }
@media (prefers-reduced-motion: reduce) {
  .celebrate-backdrop, .celebrate-card, .celebrate-burst, .celebrate-ladder .new { animation: none; }
  .confetti { display: none; }
}

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.6rem; max-width: 640px; }
.badge-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 0.8rem 0.4rem; text-align: center; }
.badge-tile b { display: block; font-size: 0.85rem; line-height: 1.2; }
.badge-tile small { display: block; color: var(--muted); font-size: 0.7rem; margin-top: 0.15rem; }
.badge-icon { width: 3.4rem; height: 3.4rem; line-height: 3.4rem; margin: 0 auto 0.3rem; border-radius: 50%; background: var(--accent2-tint); font-size: 2rem; text-align: center; }
.badge-tile.locked { opacity: 0.7; }
.badge-tile.locked .badge-icon { filter: grayscale(1); background: var(--border); }
.badge-bar { height: 6px; border-radius: 3px; background: var(--border); margin: 0.4rem 0.5rem 0; overflow: hidden; }
.badge-bar i { display: block; height: 100%; background: var(--accent); }
.celebrate-card > :not(.confetti) { position: relative; }

/* Event-type colours: `.ev-<key>` sets --ev (strong) and --ev-tint for the
   key stored in event_types.color (see app/event_colors.py). */
.ev-red { --ev: #c0392b; --ev-tint: #fbe3df; }
.ev-blue { --ev: #1f7fa6; --ev-tint: #dcf0f8; }
.ev-purple { --ev: #7a4fb5; --ev-tint: #ece3f8; }
.ev-pink { --ev: #c2185b; --ev-tint: #fbe0ec; }
.ev-orange { --ev: #b8661a; --ev-tint: #fbe8d3; }
.ev-teal { --ev: #17806f; --ev-tint: #d8f1ec; }
.ev-green { --ev: #3f8a2e; --ev-tint: #e1f0d8; }
.ev-brown { --ev: #8a5a3b; --ev-tint: #efe3da; }
@media (prefers-color-scheme: dark) {
  .ev-red { --ev: #ff8a7a; --ev-tint: #3a1f1c; }
  .ev-blue { --ev: #6cc4e8; --ev-tint: #14303b; }
  .ev-purple { --ev: #c4a2f5; --ev-tint: #2b1f3d; }
  .ev-pink { --ev: #f48fb8; --ev-tint: #3a1a29; }
  .ev-orange { --ev: #f5a962; --ev-tint: #3a2714; }
  .ev-teal { --ev: #62d0bb; --ev-tint: #123530; }
  .ev-green { --ev: #8fd673; --ev-tint: #1f3318; }
  .ev-brown { --ev: #d2a583; --ev-tint: #33261c; }
}

/* Diary entries: tinted date header, event blocks, one boxed card per command. */
.timeline { gap: 1.25rem; }
.timeline-item .card.diary-card { margin: 0 0 0 1rem; padding: 0 0 0.8rem; overflow: hidden; }
.diary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; background: var(--accent-tint); padding: 0.8rem 1rem; }
.diary-head .edit-link { float: none; margin-top: 0.15rem; }
.diary-date { font-family: "Space Grotesk", sans-serif; font-size: 1.1rem; margin-right: 0.2rem; }
.entry-events { padding: 0.5rem 0.8rem 0; }
.ev { margin: 0.4rem 0; padding: 0.55rem 0.8rem; border-radius: 12px; background: var(--ev-tint); border-left: 4px solid var(--ev); }
.ev-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.ev-name { font-weight: 800; color: var(--ev); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ev-score { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--ev); }
.ev-dots { display: flex; gap: 3px; }
.ev-dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--border); }
.ev-dots i.on { background: var(--ev); }
.ev-note { font-size: 0.92rem; margin-top: 0.15rem; }
.diary-notes { margin: 0.6rem 1rem 0; }
.diary-cmd { margin: 0.7rem 0.7rem 0; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.diary-cmd-top { display: flex; justify-content: space-between; }
.diary-rate { font-weight: 800; color: var(--accent); }
.diary-cmd-meta { font-size: 0.85rem; }
.diary-cmd-note { margin-top: 0.25rem; font-size: 0.92rem; }

/* Colour picker on the event type form. */
.color-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.8rem 0; }
.color-swatch { position: relative; cursor: pointer; }
.color-swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.color-swatch span { display: flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--ev); border: 3px solid transparent; }
.color-swatch.color-auto span { width: auto; padding: 0 0.8rem; border-radius: 999px; background: var(--border); color: var(--fg); font-size: 0.85rem; font-weight: 700; }
.color-swatch input:checked + span { border-color: var(--fg); }
.color-swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--ev); margin-right: 0.4rem; }
/* What's new: sheet from the bottom on phones, centred card on wide screens. */
.wn-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-end; justify-content: center; }
.wn { background: var(--card-bg); width: 100%; max-width: 30rem; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; padding: 1.2rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2); }
.wn h2 { margin: 0 0 0.2rem; color: var(--accent); }
.wn-dismiss { width: 100%; }
.wn-more { text-align: center; margin: 0.6rem 0 0; font-size: 0.85rem; }
.wn-date { color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0 0.2rem; }
.wn-items { list-style: none; margin: 0 0 1rem; padding: 0; }
.wn-items li { display: flex; gap: 0.6rem; padding: 0.5rem 0; border-top: 1px solid var(--border); }
.wn-tag { flex: none; align-self: flex-start; margin-top: 0.15rem; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 999px; padding: 0.1rem 0.55rem; }
.wn-tag-new { background: var(--accent-tint); color: var(--accent); }
.wn-tag-better { background: var(--border); color: var(--fg); }
.wn-tag-fixed { background: var(--accent2-tint); color: var(--accent2); }
@media (min-width: 600px) {
  .wn-backdrop { align-items: center; }
  .wn { border-radius: 18px; }
}

/* Intro tutorial: a bottom sheet like the What's New popup */
.tour-backdrop { background: rgba(0, 0, 0, 0.35); z-index: 60; }
.tour-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.tour-dots { display: flex; gap: 0.35rem; }
.tour-dots i { width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--border); }
.tour-dots i.on { background: var(--accent); width: 1.3rem; }
.tour-skip { background: none; border: 0; color: var(--muted); font-weight: 700; width: auto; min-height: 0; box-shadow: none; padding: 0.2rem; cursor: pointer; }
.tour-emoji { font-size: 2rem; line-height: 1; }
.tour-step p { margin: 0 0 0.9rem; }
.tour-nav { display: flex; gap: 0.6rem; }
.tour-nav button { flex: 1; }
.tour-back { background: var(--accent-tint); color: var(--accent); box-shadow: none; }
.tour-ring { outline: 3px solid var(--accent2); outline-offset: 3px; border-radius: 14px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.tour-replay { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1.5px solid var(--border); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; text-decoration: none; }
/* Event Types first-visit tour: a coach card above the tab bar */
.events-tour { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 5rem; z-index: 45; max-width: 30rem; margin: 0 auto; background: var(--card-bg); border: 2px solid var(--accent); border-radius: 16px; padding: 0.8rem 0.95rem; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.et-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.et-skip { background: none; box-shadow: none; color: var(--muted); font-weight: 700; width: auto; min-height: 0; padding: 0.2rem; }
.et-step strong { color: var(--accent); }
.et-step p { margin: 0.1rem 0 0.6rem; font-size: 0.9rem; }
.et-next { width: auto; min-height: 0; padding: 0.45rem 1.1rem; }

/* Sets and commands: first-run guidance */
.how-card { background: var(--accent-tint); border-radius: 14px; padding: 0.9rem 1rem; margin: 0 0 1rem; }
.how-card h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.how-step { display: flex; gap: 0.65rem; align-items: flex-start; margin: 0.45rem 0; }
.how-step b { display: block; line-height: 1.25; }
.how-step span:not(.how-num) { color: var(--muted); font-size: 0.92rem; }
.how-num { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 800; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; }
.how-num.todo { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.first-run { border: 1.5px dashed var(--border); border-radius: 14px; padding: 1.1rem; text-align: center; background: var(--card-bg); margin: 1rem 0; }
.first-run h3 { margin: 0.2rem 0 0.3rem; }
.first-run p { margin: 0 0 0.4rem; }
a.first-run-btn, a.first-run-btn:hover { display: inline-block; background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 0.55rem 1.1rem; font-weight: 800; text-decoration: none; margin-top: 0.6rem; }

/* Log a session: date and location share a row; the rating key sits tight under its heading. */
.form-row-2 { display: flex; gap: 0.6rem; }
.form-row-2 > label { flex: 1; min-width: 0; }
.session-rating-hint { margin: 0 0 0.5rem; font-size: 0.85rem; }

/* Diary export page */
.range-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.25rem; }
.range-chips a { padding: 0.45rem 1rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--card-bg); color: var(--fg); font-weight: 700; font-size: 0.9rem; }
.range-chips a.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.export-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.export-dates .export-update { grid-column: 1 / -1; }
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 1rem 0 0.5rem; }
.export-actions > * { text-align: center; padding: 0.8rem; border-radius: 12px; font-weight: 800; font-size: 1rem; box-sizing: border-box; }
.export-actions #export-copy { grid-column: 1 / -1; }
.export-actions a.export-secondary, .export-actions button.export-secondary { background: var(--accent-tint); color: var(--accent); border: 0; }
.export-actions [hidden] { display: none; }
.export-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.78rem; line-height: 1.5; background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 1rem; max-height: 24rem; overflow: auto; margin: 0.5rem 0 1.5rem; }

/* Getting started checklist and the coach hint */
.checklist { border: 2px solid var(--accent); margin-bottom: 1rem; }
.checklist-head { display: flex; justify-content: space-between; align-items: center; }
.checklist-head strong { color: var(--accent); font-size: 1.05rem; }
.checklist-items { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.checklist-items li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-top: 1px solid var(--border); }
.checklist-items li:first-child { border-top: 0; }
.checklist-tick { width: 1.3rem; height: 1.3rem; flex: none; border-radius: 50%; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; }
.checklist-items li.done { color: var(--muted); }
.checklist-items li.done .checklist-label { text-decoration: line-through; }
.checklist-items li.done .checklist-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.checklist-items li.next .checklist-label { font-weight: 800; }
.checklist-label { color: inherit; text-decoration: none; }
.checklist-items li:not(.done) .checklist-label { color: var(--fg); font-weight: 700; }
.checklist-go { margin-left: auto; color: var(--accent); }
.checklist-foot { margin: 0.5rem 0 0; font-size: 0.85rem; }
.checklist-hide { display: inline; padding: 0; background: none; box-shadow: none; color: var(--accent); width: auto; min-height: 0; }
.coach { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; z-index: 45; max-width: 30rem; margin: 0 auto; display: flex; gap: 0.75rem; align-items: center; background: var(--card-bg); border: 2px solid var(--accent); border-radius: 16px; padding: 0.7rem 0.9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.coach-text { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.9rem; }
.coach-text strong { color: var(--accent); }
.coach-skip { flex: none; width: auto; min-height: 0; background: none; box-shadow: none; color: var(--muted); font-weight: 700; padding: 0.3rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Sessions logged for several dogs at once */
.with-dog { display: inline-block; font-size: 0.75rem; font-weight: 800; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--accent2-tint); color: var(--accent2-fg); text-decoration: none; margin-left: 0.4rem; }
@media (prefers-color-scheme: dark) { .with-dog { color: var(--accent2); } }
.dogs-pick { border: none; padding: 0; margin: 0 0 0.75rem; }
.dogs-pick legend { font-weight: 700; padding: 0; margin-bottom: 0.35rem; }
.dogs-pick-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dogs-pick label { flex-direction: row; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.8rem 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card-bg); font-weight: 700; cursor: pointer; }
.dogs-pick label:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); }
.dogs-pick input { position: absolute; opacity: 0; pointer-events: none; }
.dogs-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.dogs-pick .dog-av, .dog-block-head .dog-av { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: inline-grid; place-items: center; font-size: 0.8rem; }
.dogs-pick-hint { margin: 0.4rem 0 0; font-size: 0.85rem; }
.dog-block { display: flex; flex-direction: column; gap: 0.5rem; }
.dog-block + .dog-block { border-top: 1px dashed var(--border); padding-top: 0.6rem; }
.dog-block[hidden] { display: none; }
.dog-block-head { display: none; align-items: center; gap: 0.45rem; font-weight: 800; }
.dog-block-head label { flex-direction: row; align-items: center; gap: 0.45rem; font-weight: 800; }
.dog-block-head .dog-av { width: 1.3rem; height: 1.3rem; font-size: 0.7rem; }
.multi-dogs .dog-block-head { display: flex; }
.dog-block.sat-out > :not(.dog-block-head) { opacity: 0.4; pointer-events: none; }
.event-dogs { display: none; gap: 0.3rem; flex-wrap: wrap; }
.multi-dogs .event-dogs { display: flex; }
.event-dogs label { flex-direction: row; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 800; padding: 0.15rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.event-dogs label:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); }
.event-dogs label[hidden] { display: none; }
.event-dogs input { position: absolute; opacity: 0; pointer-events: none; }

/* Bottom tab bar (phones and small tablets): Home, Diary, Log, Commands, More. */
.tabbar { display: none; }
@media (max-width: 880px) {
  .log-bar { display: none; }
  .tabbar { display: flex; align-items: flex-end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 0.35rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom)); background: var(--card-bg); border-top: 1px solid var(--border); }
  .tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.3rem 0; background: none; border: 0; box-shadow: none; border-radius: 0; font: inherit; font-size: 0.7rem; font-weight: 700; color: var(--muted); text-decoration: none; cursor: pointer; }
  .tabbar .tab svg { width: 24px; height: 24px; }
  .tabbar .tab.on { color: var(--accent); }
  .tabbar .tab-log span { display: grid; place-items: center; width: 48px; height: 48px; margin-top: -22px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-size: 1.9rem; line-height: 1; box-shadow: 0 6px 16px -4px rgba(107, 76, 255, 0.55); }
  .tabbar .tab-log { color: var(--fg); }
  .topbar .nav-toggle { display: none; }
  .container { padding-bottom: 6.5rem; }
}

/* Deck-style Home: big rounded cards, focus commands in a violet-to-pink gradient. */
.dashboard-section .command-card { border-radius: 26px; border-left-width: 1px; padding: 1.1rem 1.1rem 1rem; box-shadow: 0 12px 30px -14px rgba(80, 50, 200, 0.3); }
.dashboard-section .command-card .command-card-name { font-size: 1.5rem; letter-spacing: -0.02em; }
.dashboard-section .command-card.focus-highlight { background: linear-gradient(140deg, #6b4cff, #e0457a); border: 0; color: #fff; }
.dashboard-section .command-card.focus-highlight .command-card-name,
.dashboard-section .command-card.focus-highlight .muted { color: #fff; }
.dashboard-section .command-card.focus-highlight .log-session-cta { background: #fff; color: #5b3de0; box-shadow: none; }
.dashboard-section .command-card.focus-highlight .command-card-progress { background: rgba(255, 255, 255, 0.22); color: #fff; }
.dashboard-section .command-card.focus-highlight .location-badge { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.dashboard-section .command-card.focus-highlight .loc-stage { color: rgba(255, 255, 255, 0.85); }
.dashboard-section .command-card.focus-highlight .stage-ladder-rung { background: rgba(255, 255, 255, 0.3); }
.dashboard-section .command-card.focus-highlight .stage-ladder-rung.reached { background: #fff; }
.dashboard-section .command-card.focus-highlight a.location-badge { outline: none; }
.dashboard-section .command-card.focus-highlight p.muted { opacity: 0.85; }

/* Log a session, Deck style: four big stage buttons, tappable rating faces. */
.session-command-row { border-radius: 26px; border: 1px solid var(--border); box-shadow: 0 12px 30px -14px rgba(80, 50, 200, 0.3); }
.stage-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.stage-pill-btn { padding: 0.7rem 0.1rem; border-radius: 16px; font-size: 0.78rem; text-align: center; background: var(--bg); }
.rating-faces { display: flex; justify-content: space-between; gap: 0.25rem; }
.rating-face { flex: 1; font-size: 1.7rem; line-height: 1; padding: 0.4rem 0; background: transparent; border: 2px solid transparent; border-radius: 16px; box-shadow: none; opacity: 0.4; cursor: pointer; }
.rating-face.selected { opacity: 1; border-color: var(--accent); background: var(--accent-tint); transform: scale(1.08); }
.rating-input .rating-number { display: none; }
.rating-input { flex-direction: column; align-items: stretch !important; }
.session-command-row .rating-input input[name="reps"] { width: 100%; }

/* Diary, Deck style: bigger cards, face ratings. */
.timeline-item .card.diary-card { border-radius: 28px; box-shadow: 0 12px 30px -14px rgba(80, 50, 200, 0.3); }
.diary-cmd { border-radius: 20px; }
.diary-rate { font-size: 1.4rem; line-height: 1; }

/* Commands list, Deck style: two-column tiles. */
.command-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; max-width: none; }
.command-cards .command-card { flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 0.8rem; min-height: 7.5rem; border-left-width: 1px; border-radius: 26px; padding: 1rem; box-shadow: 0 12px 30px -14px rgba(80, 50, 200, 0.3); }
.command-cards .command-card-name { font-size: 1.25rem; letter-spacing: -0.02em; }
.command-cards .command-card-progress { margin-left: 0; }
.command-cards .muted { grid-column: 1 / -1; }
/* Achievements, Deck style: rounder tiles. */
.badge-tile { border-radius: 24px; }

/* Deck style, everywhere else: rounder cards and fields, calmer shadows. */
.card, .how-card, .first-run, .profile-stat { border-radius: 24px; }
form input, form select, form textarea { border-radius: 14px; }

/* Home deck: on phones the command cards sit side by side and swipe, the next one peeking in. */
@media (max-width: 880px) {
  .deck { display: flex; gap: 0.75rem; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -1rem; padding: 0.25rem 1rem 1rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .deck::-webkit-scrollbar { display: none; }
  .deck > .command-card, .dashboard-section .deck > .command-card { flex: 0 0 86%; scroll-snap-align: center; margin-bottom: 0; }
  .deck > .command-card:only-child, .deck > .empty-state { flex-basis: 100%; }
}

/* Level: a chip beside the brand, and a thin progress line along the header's bottom edge. */
.xp-chip { background: var(--accent2); color: var(--accent2-fg); border-radius: 10px; padding: 0.05rem 0.5rem; font-weight: 800; font-size: 0.8rem; text-decoration: none; white-space: nowrap; }
.topbar { position: relative; }
.topbar::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 3px; width: var(--xp, 0%); border-radius: 0 3px 3px 0; background: linear-gradient(90deg, var(--accent), #ff5c8a); }
@media (max-width: 880px) { .topbar { gap: 0.6rem; } }

/* Command detail history and Settings, Deck style. */
.history-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; max-width: 640px; }
.history-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 22px; padding: 0.8rem 1rem; }
.history-top { display: flex; align-items: center; gap: 0.5rem; }
.history-top b { font-size: 1.05rem; }
.history-rate { margin-left: auto; font-size: 1.5rem; line-height: 1; }
.history-notes { margin-top: 0.3rem; }
.settings-card { max-width: 640px; margin-bottom: 0.75rem; }
.settings-card p.muted { margin: 0.4rem 0 0; }

/* Achievements: level ring. */
.xp-card { display: flex; align-items: center; gap: 1rem; max-width: 640px; margin-bottom: 1rem; }
.xp-card h2 { margin: 0; }
.xp-card p { margin: 0.2rem 0 0; font-size: 0.9rem; }
.xp-ring { flex: 0 0 6.5rem; height: 6.5rem; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border) 0); display: grid; place-items: center; }
.xp-ring > div { width: 5rem; height: 5rem; border-radius: 50%; background: var(--card-bg); display: grid; place-content: center; text-align: center; line-height: 1.1; }
.xp-ring b { font-size: 1.6rem; }
.xp-ring small { color: var(--muted); font-size: 0.7rem; }

/* Setup lists (sets, locations, event types): one rounded row each. */
.item-list { display: flex; flex-direction: column; gap: 0.5rem; max-width: 640px; }
.item-list li { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 0.85rem 1rem; font-weight: 700; }

/* Optional event extras on the log forms and diary, and the Progress graphs. */
.event-extras-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.4rem; }
.event-extras-row label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.event-extra-input { width: 5rem; padding: 0.2rem 0.4rem; }
.event-extras .muted { margin: 0.2rem 0 0.5rem; }
.ev-extras { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.ev-chip { background: var(--accent-tint); color: var(--accent); border-radius: 99px; padding: 0.05rem 0.6rem; font-size: 0.82rem; font-weight: 700; }
.progress-card { max-width: 640px; margin-bottom: 0.75rem; }
.progress-card h2 { margin: 0; font-size: 1.05rem; }
.progress-card p.muted { margin: 0.1rem 0 0; font-size: 0.85rem; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.progress-latest { font-size: 1.2rem; white-space: nowrap; }
.progress-chart { width: 100%; height: auto; margin-top: 0.5rem; }
.progress-chart .axis { stroke: var(--border); stroke-width: 1; }
.progress-chart .tick { fill: var(--muted); font-size: 9px; }
.progress-chart .pt { cursor: pointer; outline: none; }
.progress-chart .pt-hit { fill: transparent; }
.progress-chart .pt.on .pt-dot, .progress-chart .pt:focus-visible .pt-dot { r: 6; stroke: var(--card-bg); stroke-width: 2; }
.pt-pop { margin-top: 0.4rem; padding: 0.6rem 0.8rem; background: var(--accent-tint); border-radius: 12px; font-size: 0.9rem; }
.pt-pop ul { margin: 0.3rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.pt-pop a { font-weight: 700; }
.pt-note { display: block; color: var(--text); white-space: pre-wrap; }
.progress-percent, .progress-amount { color: var(--accent); }
.progress-recovery { color: #d63b5e; }
.progress-rating { color: #1a9a6c; }

/* Share session: story-sized card preview, options and buttons (reuses .export-actions). */
.share-stage { display: flex; justify-content: center; margin: 1rem 0; }
.share-stage canvas { width: min(15.75rem, 70vw); aspect-ratio: 9 / 16; height: auto; border-radius: 20px; box-shadow: 0 8px 28px rgba(27, 22, 54, 0.25); }
.share-options { padding: 0.25rem 1rem; }
.share-opt { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 0; font-weight: 700; }
.share-opt + .share-opt { border-top: 1px solid var(--border); }
.share-opt small { display: block; font-weight: 400; color: var(--muted); }
.share-opt select { flex: none; padding: 0.4rem 0.6rem; font: inherit; }
.share-opt input { width: 1.4rem; height: 1.4rem; accent-color: var(--accent); flex: none; }
.diary-actions { display: flex; gap: 0.75rem; align-items: center; }
.diary-actions .edit-link { float: none; }
.export-actions #share-go, .export-actions #share-save { grid-column: 1 / -1; }
.export-actions #share-go, .export-actions #share-save { width: 100%; }
.streak-chip { display: inline-block; margin-bottom: 0.75rem; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--accent2); color: var(--accent2-fg); font-weight: 800; font-size: 0.85rem; text-decoration: none; }
.streak-chip.at-risk { background: var(--card-bg); color: var(--muted); border: 1px dashed var(--border); }
.streak-card { max-width: 640px; margin-bottom: 1rem; }

.badge-share { display: inline-block; margin-top: 0.3rem; font-size: 0.8rem; font-weight: 700; color: var(--accent); }
