:root {
  color-scheme: dark;
  --bg: #101214;
  --bg-2: #15181b;
  --panel: rgba(28, 31, 34, 0.88);
  --panel-strong: #202428;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(226, 194, 124, 0.32);
  --text: #f2efe8;
  --muted: #9fa7a6;
  --gold: #d7b56d;
  --amber: #a9793b;
  --teal: #63b8ad;
  --red: #a64747;
  --violet: #8f7ac8;
  --green: #81b67b;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 16%, rgba(215, 181, 109, 0.16), transparent 28%),
    radial-gradient(circle at 90% 4%, rgba(99, 184, 173, 0.12), transparent 25%),
    linear-gradient(135deg, #101214 0%, #161313 48%, #111719 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 78%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 36px) 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 10px 0;
  background: linear-gradient(to bottom, rgba(16, 18, 20, 0.96), rgba(16, 18, 20, 0.72));
  backdrop-filter: blur(16px);
}

.brand,
.top-actions,
.today-panel,
.panel-heading,
.quest-row,
.metrics-form label,
.journal-entry {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(215, 181, 109, 0.22), rgba(99, 184, 173, 0.1));
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted,
.today-meta span,
.quest-meta,
.badge p,
.journal-entry time {
  color: var(--muted);
}

.top-actions {
  gap: 10px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(99, 184, 173, 0.24);
  border-radius: 999px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.sync-status[data-mode="saved"] {
  border-color: rgba(129, 182, 123, 0.32);
  color: var(--green);
}

.sync-status[data-mode="offline"] {
  border-color: rgba(166, 71, 71, 0.42);
  color: #d58a8a;
}

.top-actions a,
.primary-button,
.secondary-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.top-actions a,
.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 0 13px;
}

.primary-button {
  border-color: rgba(215, 181, 109, 0.36);
  background: linear-gradient(135deg, rgba(215, 181, 109, 0.22), rgba(99, 184, 173, 0.12));
  color: var(--text);
  font-weight: 800;
}

.top-actions a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.secondary-button {
  font-size: 0.9rem;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  font-size: 1.2rem;
}

.top-actions a:hover,
.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(215, 181, 109, 0.08);
  color: var(--text);
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.view-tab {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-weight: 800;
}

.view-tab.active {
  border-color: var(--line-strong);
  background: rgba(215, 181, 109, 0.11);
  color: var(--text);
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.hero-band {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: clamp(18px, 4vw, 44px);
  align-items: end;
  min-height: clamp(340px, 48vh, 560px);
  padding: clamp(28px, 5vw, 68px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 18, 20, 0.94), rgba(16, 18, 20, 0.4)),
    repeating-linear-gradient(
      165deg,
      rgba(215, 181, 109, 0.05) 0,
      rgba(215, 181, 109, 0.05) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(135deg, rgba(78, 55, 38, 0.7), rgba(23, 48, 50, 0.82));
  box-shadow: var(--shadow);
}

.hero-band::after {
  position: absolute;
  right: -8%;
  bottom: -32%;
  width: min(620px, 72vw);
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(215, 181, 109, 0.26);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 29%, rgba(215, 181, 109, 0.08) 30% 31%, transparent 32% 48%, rgba(99, 184, 173, 0.08) 49% 50%, transparent 51%),
    conic-gradient(from 40deg, transparent, rgba(215, 181, 109, 0.22), transparent, rgba(99, 184, 173, 0.18), transparent);
  opacity: 0.72;
}

.hero-copy,
.today-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: clamp(2.35rem, 6vw, 5.7rem);
  line-height: 0.95;
}

.hero-copy p:last-child {
  max-width: 610px;
  margin-bottom: 0;
  color: #d9d2c3;
  font-size: clamp(1rem, 1.6vw, 1.24rem);
  line-height: 1.65;
}

.today-panel {
  justify-content: space-between;
  gap: 22px;
  min-height: 154px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(18, 21, 23, 0.72);
  backdrop-filter: blur(14px);
}

.score-ring {
  display: grid;
  width: 120px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #171a1d 0 58%, transparent 59%),
    conic-gradient(var(--gold) var(--score-angle, 0deg), rgba(255, 255, 255, 0.11) 0);
}

.score-ring span {
  grid-area: 1 / 1;
  font-size: 2.35rem;
  font-weight: 900;
}

.score-ring small {
  align-self: end;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.78rem;
}

.today-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.today-meta strong {
  font-size: 1.55rem;
}

.status-pill,
.compact-stat {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(215, 181, 109, 0.28);
  border-radius: 999px;
  background: rgba(215, 181, 109, 0.08);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.today-grid .journal-panel {
  grid-column: 1 / -1;
}

.progress-layout,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-page-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.progress-section {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 31, 34, 0.82);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.2);
}

.history-section {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 31, 34, 0.78);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 112px 88px minmax(0, 1fr) minmax(160px, 0.55fr);
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.032);
}

.history-date,
.history-score,
.history-measures,
.history-note {
  min-width: 0;
}

.history-date strong,
.history-date span,
.history-measures span,
.history-note span {
  display: block;
}

.history-date span,
.history-measures span,
.history-note span {
  color: var(--muted);
  font-size: 0.8rem;
}

.history-score {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(215, 181, 109, 0.28);
  border-radius: 50%;
  color: var(--gold);
  font-weight: 900;
}

.history-quests {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-quests span {
  max-width: 220px;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-note p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: #ddd7cc;
  font-size: 0.86rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.progress-card {
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.progress-card span,
.progress-card small {
  display: block;
  color: var(--muted);
}

.progress-card span {
  font-size: 0.82rem;
}

.progress-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1;
}

.progress-card small {
  font-size: 0.8rem;
}

.progress-main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.score-timeline,
.quest-frequency {
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.score-timeline {
  display: flex;
  align-items: end;
  gap: 5px;
}

.score-day {
  position: relative;
  flex: 1;
  min-width: 5px;
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(180deg, var(--gold), var(--teal));
  opacity: 0.42;
}

.score-day.active {
  opacity: 0.95;
}

.score-day.today {
  box-shadow: 0 0 0 1px rgba(215, 181, 109, 0.56);
}

.quest-frequency {
  display: grid;
  align-content: start;
  gap: 10px;
}

.frequency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.frequency-row strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frequency-bar {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.frequency-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.character-panel {
  grid-row: span 2;
}

.avatar-core {
  display: grid;
  height: 182px;
  place-items: center;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(215, 181, 109, 0.1) 49% 51%, transparent 52%),
    radial-gradient(circle, rgba(99, 184, 173, 0.28), transparent 28%),
    linear-gradient(135deg, rgba(143, 122, 200, 0.18), rgba(166, 71, 71, 0.1));
}

.avatar-core span {
  display: block;
  width: 90px;
  aspect-ratio: 1;
  border: 1px solid rgba(215, 181, 109, 0.52);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 48%, rgba(215, 181, 109, 0.8) 49% 51%, transparent 52%),
    linear-gradient(transparent 48%, rgba(215, 181, 109, 0.8) 49% 51%, transparent 52%),
    radial-gradient(circle, rgba(215, 181, 109, 0.22), transparent 62%);
  box-shadow: 0 0 46px rgba(215, 181, 109, 0.18);
}

.stats-grid {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 112px 1fr 32px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-bar,
.weekly-progress,
.trend-chart {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.stat-bar {
  height: 8px;
}

.stat-bar span,
.weekly-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--teal));
}

.quest-list,
.weekly-list,
.journal-log {
  display: grid;
  gap: 10px;
}

.quest-row {
  min-height: 68px;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.quest-row.done {
  border-color: rgba(129, 182, 123, 0.35);
  background: rgba(129, 182, 123, 0.075);
}

.quest-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.quest-row.done .quest-toggle {
  border-color: rgba(129, 182, 123, 0.58);
  background: rgba(129, 182, 123, 0.14);
  color: var(--green);
}

.quest-copy {
  min-width: 0;
}

.quest-copy strong,
.quest-copy span {
  display: block;
}

.quest-copy strong {
  margin-bottom: 3px;
}

.quest-meta {
  font-size: 0.82rem;
  line-height: 1.35;
}

.weekly-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekly-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.weekly-progress {
  height: 8px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.badge {
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.badge.unlocked {
  border-color: rgba(215, 181, 109, 0.42);
  background: linear-gradient(145deg, rgba(215, 181, 109, 0.11), rgba(99, 184, 173, 0.06));
}

.badge-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 50%;
  background: rgba(215, 181, 109, 0.12);
  color: var(--gold);
}

.badge strong,
.badge p {
  display: block;
}

.badge p {
  margin: 5px 0 0;
  font-size: 0.83rem;
  line-height: 1.42;
}

.tracker-panel,
.journal-panel {
  grid-column: span 1;
}

.metrics-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metrics-form label {
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.metrics-form span {
  white-space: nowrap;
}

.metrics-form input {
  width: 74px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
}

.goal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.goal-chip {
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.goal-chip span,
.goal-chip strong {
  display: block;
}

.goal-chip span {
  color: var(--muted);
  font-size: 0.78rem;
}

.goal-chip strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.trend-chart {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 116px;
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius);
}

.trend-bar {
  flex: 1;
  min-width: 8px;
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(180deg, var(--teal), var(--gold));
  opacity: 0.84;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  line-height: 1.5;
}

textarea:focus,
.metrics-form input:focus {
  box-shadow: 0 0 0 2px rgba(99, 184, 173, 0.24);
}

.journal-log {
  margin-top: 14px;
}

.journal-entry {
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.journal-entry p {
  margin: 0;
  color: #ddd7cc;
  line-height: 1.45;
}

.journal-entry time {
  flex: 0 0 auto;
  font-size: 0.78rem;
}

.journal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.danger-button {
  width: 30px;
  height: 30px;
  border-color: rgba(166, 71, 71, 0.36);
  color: #d58a8a;
  font-size: 1rem;
}

.danger-button:hover {
  border-color: rgba(166, 71, 71, 0.62);
  background: rgba(166, 71, 71, 0.12);
}

.auth-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
}

.wide-dialog {
  width: min(720px, calc(100% - 28px));
}

.confirm-dialog {
  width: min(380px, calc(100% - 28px));
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--panel-strong);
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-card input,
.auth-card select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.auth-card input:focus,
.auth-card select:focus {
  box-shadow: 0 0 0 2px rgba(99, 184, 173, 0.24);
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.account-list {
  display: grid;
  gap: 10px;
}

.account-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.account-list span {
  color: var(--muted);
}

.account-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.confirm-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.danger-primary {
  border-color: rgba(166, 71, 71, 0.42);
  background: linear-gradient(135deg, rgba(166, 71, 71, 0.24), rgba(215, 181, 109, 0.08));
}

.quest-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 96px 170px;
  gap: 10px;
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quest-editor-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.goals-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.goals-grid span {
  white-space: nowrap;
}

.goals-grid input {
  width: 82px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
}

.custom-quest-list {
  display: grid;
  gap: 10px;
}

.custom-quest-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.custom-quest-row.inactive {
  opacity: 0.56;
}

.custom-quest-row span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.custom-quest-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.custom-weekly {
  border-color: rgba(99, 184, 173, 0.22);
}

.custom-weekly.done {
  background: rgba(99, 184, 173, 0.08);
}

.small-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .today-grid,
  .progress-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .quest-editor-grid {
    grid-template-columns: 1fr 1fr;
  }

  .progress-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-main {
    grid-template-columns: 1fr;
  }

  .history-row {
    grid-template-columns: 96px 70px minmax(0, 1fr);
  }

  .history-note {
    grid-column: 1 / -1;
  }

  .character-panel {
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions a {
    display: none;
  }

  .sync-status {
    display: none;
  }

  .view-tabs {
    position: sticky;
    top: 66px;
    z-index: 9;
    margin-inline: -12px;
    padding: 8px 12px;
    background: rgba(16, 18, 20, 0.92);
    backdrop-filter: blur(14px);
  }

  .hero-band {
    grid-template-columns: 1fr;
    min-height: 520px;
    padding: 24px;
  }

  .custom-quest-row {
    grid-template-columns: 1fr;
  }

  .custom-quest-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .history-score {
    width: 52px;
    height: 52px;
  }

  .today-panel {
    align-self: end;
  }

  .dashboard-grid,
  .metrics-form,
  .goal-summary,
  .badge-grid,
  .progress-grid,
  .goals-grid,
  .quest-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .brand small {
    display: none;
  }

  .hero-band {
    min-height: 560px;
  }

  .today-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .today-meta {
    justify-items: start;
    text-align: left;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-row {
    grid-template-columns: 96px 1fr 28px;
  }
}
