/*
 * Themes. Each one sets the same variables. With no data-theme attribute ("Automatic") the page is
 * dark graphite, or Paper when the device is set to light. A chosen theme sets data-theme on <html>
 * (see theme.js); the cards in Settings set it on a small preview element to show their colors.
 */

:root {
  --touch: 44px;
}

:root,
[data-theme="graphite"] {
  color-scheme: dark;
  --bg: #0e1012;
  --surface: #181b1f;
  --text: #ede9e2;
  --muted: #9b968d;
  --border: #2b2f34;
  --accent: #f2a431;
  --accent-text: #1c1403;
  --danger: #f28b82;
  --banner-bg: #3b2a0d;
  --banner-text: #f6d79b;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ebe8e1;
    --surface: #f8f6f1;
    --text: #1e2023;
    --muted: #66615a;
    --border: #d9d5cc;
    --accent: #b45309;
    --accent-text: #ffffff;
    --danger: #b42318;
    --banner-bg: #fdeccb;
    --banner-text: #6b3a05;
  }
}

[data-theme="paper"] {
  color-scheme: light;
  --bg: #ebe8e1;
  --surface: #f8f6f1;
  --text: #1e2023;
  --muted: #66615a;
  --border: #d9d5cc;
  --accent: #b45309;
  --accent-text: #ffffff;
  --danger: #b42318;
  --banner-bg: #fdeccb;
  --banner-text: #6b3a05;
}

[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #070b14;
  --surface: #0f1624;
  --text: #e6ecf5;
  --muted: #8e9bb2;
  --border: #223049;
  --accent: #38bdf8;
  --accent-text: #04202e;
  --danger: #f87171;
  --banner-bg: #10304a;
  --banner-text: #bfe6ff;
}

[data-theme="forest"] {
  color-scheme: dark;
  --bg: #0a100c;
  --surface: #121a15;
  --text: #e4eee6;
  --muted: #8fa394;
  --border: #25332a;
  --accent: #4ade80;
  --accent-text: #052e16;
  --danger: #f87171;
  --banner-bg: #1d3a24;
  --banner-text: #c6f0cf;
}

[data-theme="ember"] {
  color-scheme: dark;
  --bg: #120c0b;
  --surface: #1c1412;
  --text: #f3e8e4;
  --muted: #ab9a94;
  --border: #35241f;
  --accent: #ff7a59;
  --accent-text: #2a0d05;
  --danger: #fca5a5;
  --banner-bg: #4a2312;
  --banner-text: #ffd9c2;
}

[data-theme="sand"] {
  color-scheme: light;
  --bg: #e9e2d3;
  --surface: #f6f1e6;
  --text: #26231c;
  --muted: #6c6455;
  --border: #d8cfbb;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --danger: #b42318;
  --banner-bg: #dcefe9;
  --banner-text: #0b4a43;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* App layout: a centered column, full height */

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.placeholder {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

/* Top: track selector */

.track-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 8px
    calc(8px + env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.track-info {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.track-name {
  overflow: hidden;
  font-size: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-position {
  color: var(--muted);
  font-size: 0.875rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  background: var(--border);
}

.icon-btn:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.4;
}

.icon-btn svg,
.nav svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* Bottom: navigation bar */

.nav {
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  border-top: 1px solid var(--border);
}

.nav a {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.nav svg {
  width: 24px;
  height: 24px;
}

/* Banners, messages and forms */

.offline-banner {
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: 0.875rem;
  text-align: center;
}

/* The banner already clears the notch, so the bar below needs no extra inset. */
.offline-banner:not([hidden]) + .track-bar {
  padding-top: 8px;
}

.load-error {
  padding: 48px 0;
  text-align: center;
}

.load-error p {
  margin-bottom: 16px;
  color: var(--danger);
}

.primary-btn {
  min-height: var(--touch);
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}

.login {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 480px;
  padding: 16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.login-form h1 {
  margin-bottom: 8px;
  font-size: 2rem;
  text-align: center;
}

.login-form input {
  min-height: var(--touch);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.form-error {
  color: var(--danger);
}

/* Calendar */

.cal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented {
  display: flex;
  flex: 1;
  padding: 2px;
  border-radius: 10px;
  background: var(--border);
}

.segmented button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
}

.text-btn {
  min-height: var(--touch);
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.cal-nav {
  display: flex;
  align-items: center;
  margin: 4px 0;
}

.cal-title {
  flex: 1;
  margin: 0;
  font-size: 1.0625rem;
  text-align: center;
}

.cal-body {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.cal-body button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cal-error {
  padding: 32px 0;
  color: var(--danger);
  text-align: center;
}

.markers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.marker {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.marker-more {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

/* Month */

.month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  /* The 1px gaps show this color: that is what draws the grid lines. */
  background: var(--border);
}

.month-weekday {
  padding: 8px 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.month-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 68px;
  padding: 6px 0 4px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.month-day:hover {
  background: var(--bg);
}

.month-day:focus-visible {
  outline-offset: -3px;
}

.month-day.is-outside {
  background: var(--bg);
}

.month-day.is-outside .month-number {
  color: var(--muted);
}

.month-day.is-outside.is-today .month-number {
  color: var(--accent-text);
}

.month-day.is-outside .markers {
  opacity: 0.5;
}

.month-day .markers {
  gap: 2px;
}

.month-number {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 0.9375rem;
}

.is-today .month-number {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* Week */

.week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.week-row.is-today {
  border-color: var(--accent);
}

.week-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.week-weekday {
  color: var(--muted);
  font-size: 0.75rem;
}

.week-number {
  font-size: 1.125rem;
  font-weight: 600;
}

.is-today .week-number {
  color: var(--accent);
}

.markers-large {
  flex: 1;
  justify-content: flex-start;
  gap: 4px;
}

.markers-large .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

/* Day */

.day-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-height: 160px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.day-panel.is-today {
  border-color: var(--accent);
}

.day-empty {
  margin: auto;
  color: var(--muted);
}

.day-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.day-entry .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.day-entry-name {
  font-weight: 600;
}

.day-entry-note {
  flex-basis: 100%;
  padding-left: 32px;
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* Day editor (bottom sheet) */

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  color: var(--text);
}

.sheet[open] {
  display: flex;
  flex-direction: column;
}

.sheet::backdrop {
  background: rgb(0 0 0 / 50%);
}

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] {
    animation: sheet-in 160ms ease-out;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(24px);
      opacity: 0;
    }
  }
}

.sheet-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border);
}

.sheet-title {
  flex: 1;
  margin: 0;
  font-size: 1.0625rem;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.editor-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.editor-list:empty {
  display: none;
}

.editor-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
  min-height: var(--touch);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.editor-entry.is-editing {
  border-color: var(--accent);
  background: var(--bg);
}

.editor-entry .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.editor-entry-name {
  font-weight: 600;
}

.editor-entry-note {
  flex-basis: 100%;
  padding-left: 32px;
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

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

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-form-title {
  margin: 0;
  font-size: 1rem;
}

.editor-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.editor-types legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.chip {
  position: relative;
}

.chip-input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip-body {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 14px 0 10px;
  border: 2px solid var(--border);
  border-radius: 22px;
}

.chip-body .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.chip-input:checked + .chip-body {
  border-color: var(--accent);
  background: var(--bg);
  font-weight: 600;
}

.chip-input:focus-visible + .chip-body {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.editor-note {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

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

.editor-actions .danger-btn {
  margin-right: auto;
}

.danger-btn {
  min-height: var(--touch);
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Settings */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.settings-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-heading {
  margin: 12px 0 0;
  font-size: 1rem;
}

.settings-heading:first-child {
  margin-top: 0;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.settings-row-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding: 4px 4px 4px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.settings-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-detail {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.reorder {
  display: flex;
  flex: none;
}

.reorder .icon-btn {
  width: 40px;
}

.badge {
  align-self: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input,
.text-input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.settings-status {
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.secondary-btn {
  min-height: var(--touch);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn:hover {
  background: var(--bg);
}

.back-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: var(--touch);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.settings-screen > .danger-btn {
  align-self: flex-start;
}

.danger-fill-btn {
  min-height: var(--touch);
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: #b91c1c;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

/* Event type editor */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marker-large {
  flex: none;
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  position: relative;
  width: var(--touch);
  height: var(--touch);
}

.swatch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.swatch span {
  display: block;
  width: 100%;
  height: 100%;
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}

.swatch input:checked + span {
  box-shadow: 0 0 0 3px var(--accent);
}

.swatch input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.swatch-group-label {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.settings-row-main .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.settings-status.is-error {
  color: var(--danger);
}

/* Statistics */

.stats-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.stats-section-title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.stat-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat-card + .stat-card {
  margin-top: 8px;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-head .marker {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.stat-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-count {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.stat-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 8px 0 0;
}

.stat-facts dt {
  color: var(--muted);
  font-size: 0.6875rem;
}

.stat-facts dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-bar {
  fill: var(--accent);
}

.chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-text {
  fill: var(--muted);
  font-size: 10px;
}

.chart-value {
  fill: var(--text);
  font-size: 10px;
  font-weight: 600;
}

.heatmap {
  padding-bottom: 8px;
  overflow-x: auto;
}

.heatmap .chart {
  margin: 0 auto;
}

.heat {
  fill: var(--accent);
}

.heat-0 {
  fill: var(--border);
}

.heat-1 {
  fill-opacity: 0.3;
}

.heat-2 {
  fill-opacity: 0.55;
}

.heat-3 {
  fill-opacity: 0.8;
}

.stats-empty {
  padding: 16px 0;
  color: var(--muted);
  text-align: center;
}

.stat-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-count-label {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Emoji picker */

.emoji-button {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
}

.emoji-current {
  font-size: 1.5rem;
  line-height: 1;
}

.emoji-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.emoji-group-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
}

.emoji-option {
  min-height: var(--touch);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.625rem;
  line-height: 1;
  cursor: pointer;
}

.emoji-option:hover {
  background: var(--bg);
}

.emoji-option[aria-pressed="true"] {
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--accent);
}

#type-icon-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Accounts, account and about sections */

.login-form label {
  color: var(--muted);
  font-size: 0.875rem;
}

.login-subtitle {
  margin-bottom: 8px;
  color: var(--muted);
  text-align: center;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-hint {
  color: var(--muted);
  font-size: 0.8125rem;
}

.login-form .text-btn {
  align-self: center;
}

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

.credits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.credits-label {
  display: inline-block;
  min-width: 64px;
  color: var(--muted);
}

.credits a {
  color: var(--accent);
}

/* Appearance: theme picker */

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px;
}

.theme-option {
  position: relative;
}

.theme-input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 12px;
}

.theme-input:checked + .theme-card {
  border-color: var(--accent);
  background: var(--bg);
  font-weight: 600;
}

.theme-input:focus-visible + .theme-card {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.theme-swatch {
  display: flex;
  flex: none;
  width: 44px;
  height: 32px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border);
}

.theme-chip {
  position: relative;
  flex: 1;
  background: var(--bg);
}

.theme-chip::before {
  position: absolute;
  inset: 8px 6px 6px;
  border-radius: 3px;
  background: var(--surface);
  content: "";
}

.theme-chip::after {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.theme-option-wide {
  grid-column: 1 / -1;
}

.theme-option-wide .theme-swatch {
  width: 88px;
}

/* Default view and version in Settings */

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  color: var(--muted);
  font-size: 0.875rem;
}

.app-version {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}
