/* Theme variables are set on <html> by themes.js. Fallbacks match the Plain theme. */
:root {
  --primary-bg: #23262b;
  --accent-color: #c9ccd1;
  --highlight-color: #6f8fb0;
  --text-light: #ffffff;
  --text-gold: #d9d2c3;
  --link-color: #2b3a4a;
  --border-accent: #8a8f96;
  --bg-image: none;
  --on-highlight: #ffffff;
  /* Borders of fields and buttons: strong enough to see (3:1) on any theme; cards keep the softer --border-accent. */
  --control-border: color-mix(in srgb, var(--text-light) 55%, var(--primary-bg));

  --bar-height: 56px;
  --page-max: 960px;      /* how wide a page's content column may be */
  --page-gutter: 18px;    /* the least space left and right of it */
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --surface: color-mix(in srgb, color-mix(in srgb, #fff 8%, var(--primary-bg)) 80%, transparent);
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

* { box-sizing: border-box; }

/* ---- Scrollbars: slim and in the theme's colors, instead of the browser's bright default ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent-color) 55%, transparent) transparent;
}
/* older Safari and Chromium */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--accent-color) 55%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent-color) 85%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

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

body {
  display: flex;
  flex-direction: column;
  background: var(--primary-bg);
  color: var(--text-light);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--text-gold); outline-offset: 2px; }

/* ---- Header ---- */
#header { flex: none; position: relative; z-index: 10; }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--bar-height);
  padding: env(safe-area-inset-top) 18px 0;
  background: var(--primary-bg);
  border-bottom: 1px solid var(--border-accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  color: var(--text-gold);
}

.top-left, .top-right { display: flex; align-items: center; gap: 10px; }

.theme-icon { display: none; width: 24px; height: 24px; flex: none; }

.disney-word { display: none; font-family: var(--font-display); font-style: italic; font-size: 1.15rem; }
.disney-location { font-size: .8rem; font-weight: 600; letter-spacing: .18em; }

.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-gold);
  opacity: .65;
  border-radius: 50%;
  transition: opacity .2s, background .2s, transform .3s;
}
.settings-btn:hover { opacity: 1; background: var(--surface); transform: rotate(45deg); }
.settings-btn svg { width: 22px; height: 22px; }

/* ---- Main ---- */
main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  /* The scrolling area is the full width of the window, so its scrollbar is at the window's edge.
     The content column is centered by padding (percentages here are of the window's width). */
  padding: 20px max(var(--page-gutter), calc((100% - var(--page-max)) / 2)) 28px;
}

.page-note { opacity: .75; }

/* Hero image with a caption fading in from the bottom */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 52vh;
  overflow: hidden;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-image) center / cover no-repeat, var(--surface);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .65), transparent 55%);
}
.hero-caption { position: relative; z-index: 1; padding: 20px; }
.hero-caption h2 { margin: 0; font-size: 1.6rem; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.hero-caption p { margin: 4px 0 0; max-width: 46ch; font-size: .9rem; color: rgba(255, 255, 255, .9); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }

.card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---- Footer ---- */
#footer { flex: none; position: relative; z-index: 10; }

.bottom-bar {
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--accent-color);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .3);
}

.bottom-bar a {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 2px 8px;
  text-decoration: none;
  font-size: .72rem;
  font-weight: 500;
  color: var(--link-color);
  opacity: .8;
  transition: opacity .2s, background .2s;
}
.bottom-bar a svg { width: 22px; height: 22px; }
.bottom-bar a:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

/* Active tab: works with any color scheme (no dependence on highlight vs accent) */
.bottom-bar a.activePage { opacity: 1; font-weight: 700; background: rgba(0, 0, 0, .1); }
.bottom-bar a.activePage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--link-color);
}

/* ---- Buttons and modal ---- */
.btn {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--highlight-color);
  color: var(--on-highlight);
  font: inherit;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  transition: transform .15s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn-quiet { background: var(--surface); color: var(--text-light); box-shadow: none; border: 1px solid var(--control-border); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(90vw, 380px);
  padding: 28px 24px 22px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background: var(--primary-bg);
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop .18s ease-out;
}
.modal h2 { margin: 0 0 8px; color: var(--text-gold); }
.modal p { margin: 0; }
.modal-btns { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }

@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (min-width: 700px) {
  .hero { min-height: 60vh; }
  .bottom-bar a { flex-direction: row; justify-content: center; gap: 8px; font-size: .85rem; padding: 14px 4px; }
}

/* ---- Hide page content until signed in (app.js adds .hearth-ready) ---- */
html:not(.hearth-ready) main { visibility: hidden; }

/* ---- Sign-in / family setup gate ---- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .75)), var(--bg-image) center / cover no-repeat, var(--primary-bg);
}
.gate-card {
  width: min(100%, 400px);
  margin: auto;
  padding: 28px 24px 22px;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background: var(--primary-bg);
  box-shadow: var(--shadow);
  text-align: center;
  transition: opacity .15s;
}
.gate-card-in { animation: pop .25s ease-out; }
.gate.busy .gate-card { opacity: .6; pointer-events: none; }
.gate-logo { border-radius: 20px; }
.gate-card h1 { margin: 10px 0 4px; font-size: 1.9rem; color: var(--text-gold); }
.gate-sub { margin: 0 0 18px; opacity: .85; font-size: .95rem; }
.gate-error { margin: 12px 0 0; color: #ffb4a8; font-size: .9rem; min-height: 1.2em; }
.gate-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.gate-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-accent); text-align: left; }
.gate-section h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--text-gold); }
.gate-section .btn { width: 100%; }
.link-btn { margin-top: 14px; border: 0; background: none; color: var(--text-gold); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; opacity: .8; }

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #fff;
  color: #3c4043;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  transition: transform .15s, filter .15s;
}
.btn-google svg { width: 20px; height: 20px; }
.btn-google:hover { filter: brightness(.96); }
.btn-google:active { transform: scale(.98); }

/* ---- Form fields ---- */
.field { margin-bottom: 12px; text-align: left; }
.field label { display: block; margin-bottom: 4px; font-size: .8rem; letter-spacing: .04em; color: var(--text-gold); }
.field input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--text-light);
  font: inherit;
}
.field input[type="text"]::placeholder { color: var(--text-light); opacity: .4; }

/* ---- Settings page ---- */
.card h2 { margin: 0 0 12px; font-size: 1.15rem; color: var(--text-gold); }
.settings-grid { display: grid; gap: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface); }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.profile-head .who { min-width: 0; }
.profile-head .who strong, .profile-head .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-head .who span { font-size: .85rem; opacity: .75; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 16px; }
.swatch { position: relative; width: 34px; height: 34px; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.swatch input:checked + span { border-color: #fff; box-shadow: 0 0 0 2px var(--highlight-color); }
.swatch input:focus-visible + span { outline: 2px solid var(--text-gold); outline-offset: 3px; }

.code-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px; border: 1px dashed var(--border-accent); border-radius: 10px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.6rem; letter-spacing: .14em; color: var(--text-gold); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-small { padding: 7px 14px; font-size: .85rem; }
.hint { margin: 10px 0 0; font-size: .85rem; opacity: .75; }

.member-list { margin: 0; padding: 0; list-style: none; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-accent); }
.member-row:first-child { border-top: 0; padding-top: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { padding: 2px 10px; border: 1px solid var(--border-accent); border-radius: 999px; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.status { min-height: 1.2em; margin: 8px 0 0; font-size: .85rem; }
.status.error { color: #ffb4a8; }

/* ---- Smooth page changes: the header and footer stay put while the page content crossfades ---- */
@view-transition { navigation: auto; }
#header { view-transition-name: site-header; }
#footer { view-transition-name: site-footer; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }

/* ---- Home: a full-size hero with the clock, date and weather in the middle ---- */
main.home { display: flex; flex-direction: column; padding: 12px 12px 8px; }
main.home .hero { flex: 1; min-height: 320px; align-items: center; justify-content: center; text-align: center; }
main.home .hero::after { background: radial-gradient(ellipse at center, rgba(0, 0, 0, .5), rgba(0, 0, 0, .15) 70%); }
.hero-center { position: relative; z-index: 1; padding: 20px; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.clock { font-size: clamp(3.4rem, 15vw, 8rem); font-weight: 300; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.date { margin-top: 8px; font-family: var(--font-display); font-size: clamp(1.1rem, 4vw, 1.9rem); }
.weather { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; min-height: 2.6rem; margin-top: 18px; }
.weather-icon svg { display: block; width: 38px; height: 38px; }
.weather-temp { font-size: 1.8rem; font-weight: 600; }
.weather-label { font-size: .95rem; opacity: .95; }
.weather-note { flex-basis: 100%; font-size: .85rem; }
.weather-setup { text-shadow: none; background: rgba(0, 0, 0, .35); color: #fff; border: 1px solid rgba(255, 255, 255, .5); }

/* ---- The pet: a figure (face + accessory + cue) used on the floating button and the Pomodoro page ---- */
.pet-btn {
  position: fixed;
  right: 16px;
  bottom: calc(var(--footer-h, 64px) + 14px);
  z-index: 40;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform .15s;
}
.pet-btn.pet-left { right: auto; left: 16px; }
.pet-btn:hover { transform: scale(1.06); }
.pet-btn:active { transform: scale(.96); }

/* ---- Offline notice ---- */
.offline-note { padding: 6px 16px; text-align: center; font-size: .85rem; font-weight: 600; background: var(--highlight-color); color: var(--on-highlight); }

/* ---- Keyboard: skip link, and text for screen readers only ---- */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 400; padding: 10px 16px; border-radius: 999px;
  background: var(--highlight-color); color: var(--on-highlight); font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow); transform: translateY(-200%); transition: none;
}
.skip-link:focus { transform: none; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- The pet's speech bubble ---- */
.pet-bubble {
  position: fixed; right: 16px; bottom: calc(var(--footer-h, 64px) + 14px + 68px + 12px); z-index: 41;
  max-width: min(260px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 16px;
  background: var(--text-light); color: var(--primary-bg); font-size: .95rem; line-height: 1.3;
  box-shadow: var(--shadow); border: 2px solid var(--accent-color);
  opacity: 0; transform: translateY(6px); transition: opacity .4s, transform .4s; pointer-events: none;
}
.pet-bubble:empty { display: none; }
.pet-bubble.pet-left { right: auto; left: 16px; }
.pet-bubble::after { /* the little tail, pointing down at the pet */
  content: ""; position: absolute; bottom: -9px; right: 26px; width: 14px; height: 14px; transform: rotate(45deg);
  background: var(--text-light); border-right: 2px solid var(--accent-color); border-bottom: 2px solid var(--accent-color);
}
.pet-bubble.pet-left::after { right: auto; left: 26px; }
.pet-bubble.show { opacity: 1; transform: none; }
.gallery-page .pet-bubble { display: none; }
@media (prefers-reduced-motion: reduce) { .pet-bubble { transition: opacity .2s; transform: none; } }
.pet-says {
  margin: 4px 0 12px; padding: 10px 14px; border-radius: 14px; font-style: italic;
  background: color-mix(in srgb, var(--accent-color) 18%, transparent); border-left: 3px solid var(--accent-color);
}

.pet-figure { position: relative; display: block; width: 100%; height: 100%; }
.pet-face {
  display: block; width: 100%; height: 100%; overflow: hidden; border: 3px solid var(--accent-color);
  border-radius: 50%; background: var(--primary-bg); box-shadow: var(--shadow); transform-origin: 50% 90%;
}
.pet-face img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.pet-acc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pet-acc:empty { display: none; }

/* what it is doing: sleeping when idle, working during focus, playing on a break */
.pet-figure[data-activity="sleeping"] .pet-face { animation: pet-breathe 4s ease-in-out infinite; }
.pet-figure[data-activity="working"] .pet-face { animation: pet-focus 2.4s ease-in-out infinite; }
.pet-figure[data-activity="playing"] .pet-face { animation: pet-hop .8s ease-in-out infinite; }
.pet-figure[data-activity="sleeping"] .pet-face img { filter: saturate(.8) brightness(.92); }

.pet-cue { position: absolute; top: -6px; right: -4px; font-weight: 700; line-height: 1; pointer-events: none; color: var(--text-gold); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.pet-figure[data-activity="sleeping"] .pet-cue::before { content: "z"; font-size: .95rem; animation: pet-zzz 3s ease-in infinite; display: inline-block; }
.pet-figure[data-activity="sleeping"] .pet-cue::after { content: "Z"; font-size: 1.2rem; animation: pet-zzz 3s ease-in 1.2s infinite; display: inline-block; margin-left: 2px; }
.pet-figure[data-activity="working"] .pet-cue::before { content: "\2605"; font-size: 1rem; animation: pet-twinkle 1.6s ease-in-out infinite; display: inline-block; }
.pet-figure[data-activity="playing"] .pet-cue::before { content: "\266A"; font-size: 1.15rem; animation: pet-float 1.4s ease-in-out infinite; display: inline-block; }

@keyframes pet-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes pet-focus { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 color-mix(in srgb, var(--accent-color) 55%, transparent); } 50% { box-shadow: var(--shadow), 0 0 0 7px color-mix(in srgb, var(--accent-color) 0%, transparent); } }
@keyframes pet-hop { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-9px) rotate(-4deg); } 50% { transform: translateY(0); } 75% { transform: translateY(-6px) rotate(4deg); } }
@keyframes pet-zzz { 0% { opacity: 0; transform: translate(0, 4px) scale(.7); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -10px) scale(1.15); } }
@keyframes pet-twinkle { 0%, 100% { opacity: .35; transform: scale(.85) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes pet-float { 0%, 100% { transform: translateY(2px); opacity: .6; } 50% { transform: translateY(-5px); opacity: 1; } }

/* ---- Day panel (bottom sheet) ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}
.sheet {
  width: min(100%, 520px);
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--border-accent);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--primary-bg);
  box-shadow: var(--shadow);
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font-size: 1.4rem; color: var(--text-gold); }
.sheet-head p { margin: 0; font-size: .9rem; opacity: .8; }
.sheet-pet { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-color); }
.sheet-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface); color: var(--text-light); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.sheet-section { padding: 12px 0; border-top: 1px solid var(--border-accent); }
.sheet-section h3 { margin: 0 0 4px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-gold); }
.sheet-section div { opacity: .9; }

/* ---- Segmented choices and pet picker in Settings ---- */
.setting-row { margin-bottom: 16px; }
.setting-row > label, .setting-row > .label { display: block; margin-bottom: 6px; font-size: .8rem; letter-spacing: .04em; color: var(--text-gold); }
.segmented { display: inline-flex; border: 1px solid var(--control-border); border-radius: 999px; overflow: hidden; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 18px; font-size: .9rem; }
.segmented input:checked + span { background: var(--highlight-color); color: var(--on-highlight); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--text-gold); outline-offset: -2px; }
.pet-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.pet-choice { position: relative; text-align: center; font-size: .8rem; cursor: pointer; }
.pet-choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pet-choice img { display: block; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; object-fit: cover; border: 3px solid transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.pet-choice input:checked + img { border-color: var(--accent-color); box-shadow: 0 0 0 2px var(--highlight-color); }
.pet-choice input:focus-visible + img { outline: 2px solid var(--text-gold); outline-offset: 3px; }

/* ---- Theme manager (Settings) ---- */
.palette { display: inline-flex; gap: 3px; }
.palette i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }

.theme-current { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.theme-current .tile-thumb { width: 130px; height: 80px; flex: none; }
.theme-current-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.theme-current-info strong { font-family: var(--font-display); font-size: 1.15rem; }
.theme-current-info p { margin: 4px 0 6px; font-size: .85rem; opacity: .85; }
.theme-type { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-gold); }
.tile-thumb { display: block; object-fit: cover; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.tile-thumb-plain { background-image: linear-gradient(135deg, rgba(255, 255, 255, .12), transparent); }

.theme-group { border-top: 1px solid var(--border-accent); }
.theme-group summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; cursor: pointer; font-weight: 600; color: var(--text-gold); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding-bottom: 14px; }
.theme-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border: 2px solid transparent; border-radius: 12px;
  background: var(--surface); color: var(--text-light); font: inherit; text-align: left; cursor: pointer;
}
.theme-tile .tile-thumb { width: 100%; aspect-ratio: 16 / 10; height: auto; }
.theme-tile .tile-name { font-size: .85rem; line-height: 1.25; }
.theme-tile[aria-pressed="true"] { border-color: var(--accent-color); box-shadow: 0 0 0 2px var(--highlight-color); }
.theme-tile:hover { background: rgba(255, 255, 255, .1); }

.sheet-wide { width: min(100%, 760px); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.image-card { position: relative; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.image-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--surface); }
.image-card.is-hidden img { opacity: .35; filter: grayscale(.6); }
.image-badge { position: absolute; top: 8px; left: 8px; background: var(--primary-bg); }
.image-card .btn { width: 100%; }

/* ---- Gallery: fullscreen slideshow, chrome fades out and a tap brings it back ---- */
body.gallery-page { display: block; overflow: hidden; }
.gallery-page #header, .gallery-page #footer { position: fixed; left: 0; right: 0; z-index: 30; transition: opacity .6s, transform .6s; }
.gallery-page #header { top: 0; }
.gallery-page #footer { bottom: 0; }
.gallery-page .top-bar { background: color-mix(in srgb, var(--primary-bg) 88%, transparent); backdrop-filter: blur(6px); }
.gallery-page.chrome-hidden #header { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.gallery-page.chrome-hidden #footer { opacity: 0; transform: translateY(12px); pointer-events: none; }
.gallery-page.chrome-hidden .pet-btn { opacity: 0; pointer-events: none; }
.gallery-page .pet-btn { transition: opacity .6s, transform .15s; }
.gallery-page.chrome-hidden .gallery-controls { opacity: 0; pointer-events: none; }

main.gallery { position: fixed; inset: 0; z-index: 1; padding: 0; overflow: hidden; background: var(--primary-bg); }
.slide { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transition-property: opacity; transition-timing-function: ease-in-out; }
.slide.is-showing { opacity: 1; }

.gallery-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; }
.gallery-empty[hidden] { display: none; }
.gallery-empty a { color: var(--text-gold); }

.gallery-clock {
  position: absolute; left: 0; right: 0; bottom: 28px; z-index: 5; text-align: center; color: #fff; pointer-events: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .75); transition: bottom .6s;
}
.gallery-clock[hidden] { display: none; }
.gallery-clock .clock { font-size: clamp(2.6rem, 11vw, 6rem); }
.gallery-clock .date { font-size: clamp(1rem, 3.5vw, 1.6rem); }
.gallery-page:not(.chrome-hidden) .gallery-clock { bottom: calc(var(--footer-h, 64px) + 24px); }
main.gallery::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; z-index: 3; pointer-events: none; background: linear-gradient(to top, rgba(0, 0, 0, .45), transparent); }

.gallery-controls { position: absolute; z-index: 20; left: 0; right: 0; top: calc(var(--header-h, 56px) + 12px); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; transition: opacity .6s; }
.gallery-buttons { display: flex; gap: 10px; padding: 8px 12px; border-radius: 999px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.gal-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.gal-btn:hover { background: rgba(255, 255, 255, .26); }
.gal-btn[hidden] { display: none; }
.gal-btn svg { width: 22px; height: 22px; }
.gal-btn svg[hidden] { display: none; }
.gallery-options { width: min(100%, 360px); padding: 16px; border: 1px solid var(--border-accent); border-radius: var(--radius); background: var(--primary-bg); box-shadow: var(--shadow); }
.gallery-options[hidden] { display: none; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--highlight-color); flex: none; }

/* ---- Calendar ---- */
.calendar-page { --page-max: 1100px; padding-bottom: 110px; }
.cal-modes { margin-bottom: 12px; }
.segmented label.is-disabled { opacity: .45; cursor: not-allowed; }
.segmented label.is-disabled input { cursor: not-allowed; }

.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-bottom: 14px; }
.cal-nav, .cal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { margin: 0 0 0 6px; font-size: 1.25rem; color: var(--text-gold); }
.cal-btn { width: 36px; height: 36px; font-size: 1.5rem; line-height: 1; background: var(--surface); color: var(--text-light); border: 1px solid var(--control-border); }
.cal-actions .segmented span { padding: 6px 12px; font-size: .85rem; }

/* month */
.month { border: 1px solid var(--border-accent); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.month-head, .month-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head span { padding: 8px 4px; text-align: center; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); border-bottom: 1px solid var(--border-accent); }
.day {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 64px; padding: 6px 4px;
  border: 0; border-right: 1px solid color-mix(in srgb, var(--border-accent) 50%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border-accent) 50%, transparent);
  background: transparent; color: var(--text-light); font: inherit; text-align: left; cursor: pointer; overflow: hidden;
}
.month-week .day:nth-child(7) { border-right: 0; }
.month-week:last-child .day { border-bottom: 0; }
.day:hover { background: rgba(255, 255, 255, .06); }
.day .num { align-self: flex-start; min-width: 24px; padding: 1px 4px; border-radius: 12px; font-size: .85rem; text-align: center; }
.day.other-month { opacity: .45; }
.day.today .num { background: var(--highlight-color); color: var(--on-highlight); font-weight: 700; }
.day.selected { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px var(--accent-color); }
.chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip { display: block; padding: 1px 5px; border-radius: 4px; background: var(--c); color: #111; font-size: .68rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { font-size: .68rem; opacity: .8; padding-left: 2px; }

@media (max-width: 599px) {
  /* narrow screens: chips become dots, tap a day to see its list */
  .day { min-height: 52px; align-items: center; }
  .day .num { align-self: center; }
  .chips { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .chip { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; }
  .more { display: none; }
}

/* lists of events */
.day-list { margin-top: 16px; }
.day-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.day-list-head h3, .agenda-day h3 { margin: 0; font-size: 1rem; color: var(--text-gold); font-family: var(--font-display); }
.event-rows { display: flex; flex-direction: column; gap: 6px; }
.event-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; border-left: 5px solid var(--c); border-radius: 8px;
  background: var(--surface); color: var(--text-light); font: inherit; text-align: left; cursor: pointer;
}
.event-row:hover { background: rgba(255, 255, 255, .12); }
.event-time { flex: none; min-width: 5.5em; font-size: .8rem; opacity: .8; font-variant-numeric: tabular-nums; }
.event-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.repeat-mark { opacity: .7; }

/* week */
.week { display: grid; gap: 10px; }
.week-day { padding: 10px; border: 1px solid var(--border-accent); border-radius: var(--radius); background: var(--surface); }
.week-day.today { box-shadow: inset 0 0 0 2px var(--accent-color); }
.week-day-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.week-day-name { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); }
.week-day-num { font-size: 1.3rem; font-family: var(--font-display); }
.icon-add { margin-left: auto; width: 30px; height: 30px; border: 1px solid var(--control-border); border-radius: 50%; background: transparent; color: var(--text-light); font-size: 1.1rem; cursor: pointer; }
.hint.empty { margin: 0; }
@media (min-width: 900px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .week-day .event-row { flex-wrap: wrap; gap: 2px 6px; padding: 7px 8px; }
  .week-day .event-time { min-width: 0; width: 100%; }
}

/* agenda */
.agenda { display: flex; flex-direction: column; gap: 16px; }
.agenda-day h3 { margin-bottom: 6px; }
.agenda-more { text-align: center; }

/* event detail and form */
.sheet .event-detail, .sheet .event-form, .sheet .scope-body { padding-top: 6px; }
.detail-row { padding: 10px 0; border-top: 1px solid var(--border-accent); }
.detail-row .label { display: block; margin-bottom: 2px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); }
.details-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.audit { margin: 12px 0; }
.form-actions, .scope-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-danger { color: #ffb4a8; border-color: #ffb4a8; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row[hidden], .field[hidden] { display: none; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input { width: 5.5em; }
.field select, .field input[type="date"], .field input[type="time"], .field input[type="number"], .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--control-border); border-radius: 10px;
  background: var(--primary-bg); color: var(--text-light); font: inherit; color-scheme: dark;
}
.field textarea { resize: vertical; }
.sheet .field { margin-bottom: 12px; }
@media (max-width: 420px) { .form-row.two { grid-template-columns: 1fr; } }
.calendar-toggles { padding-top: 6px; }

.day-events { margin: 0; padding: 0; list-style: none; }
.day-events li { padding: 3px 0; }
.day-events .event-time { display: inline-block; min-width: 5.5em; }

/* ---- Calendar manager and sharing ---- */
.calendar-row { padding: 10px 0; border-top: 1px solid var(--border-accent); }
.calendar-row:first-child { border-top: 0; padding-top: 0; }
.calendar-row .check-row { padding: 2px 0; }
.calendar-name { font-weight: 600; }
.calendar-access { margin: 2px 0 6px 30px; }
.calendar-row .row-actions { margin-left: 30px; }
.share-rows { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-name { flex: 1; min-width: 6em; font-weight: 600; }
.share-row .segmented span { padding: 6px 10px; font-size: .8rem; }

/* The hidden attribute always wins, even over a class that sets display. */
[hidden] { display: none !important; }

/* ---- Meal plan ---- */
.meal-week { display: grid; gap: 10px; }
.meal-day { padding: 10px 12px; border: 1px solid var(--border-accent); border-radius: var(--radius); background: var(--surface); }
.meal-day.today { box-shadow: inset 0 0 0 2px var(--accent-color); }
.meal-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.meal-slot { display: grid; grid-template-columns: 5.6em 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.meal-slot label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-gold); }
.meal-box { display: flex; align-items: center; gap: 6px; min-width: 0; }
.meal-box input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--control-border); border-radius: 8px;
  background: var(--primary-bg); color: var(--text-light); font: inherit;
}
.meal-box input::placeholder { color: var(--text-light); opacity: .35; }
.meal-link { flex: none; padding: 5px 10px; border: 1px solid var(--accent-color); border-radius: 999px; background: transparent; color: var(--accent-color); font: inherit; font-size: .75rem; cursor: pointer; }
@media (min-width: 900px) {
  .meal-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .meal-slot { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- Recipe box ---- */
.recipes-page { --page-max: 760px; padding-bottom: 110px; }
.back-link { margin: 0 0 4px; font-size: .9rem; }
.back-link a { color: var(--text-gold); text-decoration: none; }
.recipe-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 10px; }
.recipe-tools input[type="search"] {
  flex: 1; min-width: 160px; padding: 10px 12px; border: 1px solid var(--control-border); border-radius: 10px;
  background: var(--primary-bg); color: var(--text-light); font: inherit;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip-btn { padding: 6px 14px; border: 1px solid var(--control-border); border-radius: 999px; background: transparent; color: var(--text-light); font: inherit; font-size: .85rem; cursor: pointer; }
.chip-btn[aria-pressed="true"], .chip-btn[aria-selected="true"] { background: var(--highlight-color); color: var(--on-highlight); border-color: transparent; font-weight: 600; }
.recipe-list-cards { display: flex; flex-direction: column; gap: 8px; }
.recipe-card { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; padding: 12px 14px; border: 1px solid var(--border-accent); border-radius: 10px; background: var(--surface); color: var(--text-light); font: inherit; text-align: left; cursor: pointer; }
.recipe-card:hover { background: rgba(255, 255, 255, .12); }
.recipe-name { flex: 1; min-width: 8em; font-weight: 600; }
.badge-accent { background: var(--accent-color); color: var(--link-color); border-color: transparent; }
.recipe-block { padding: 10px 0; border-top: 1px solid var(--border-accent); }
.recipe-block h3 { margin: 0 0 6px; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); }
.recipe-list { margin: 0; padding-left: 1.3em; }
.recipe-list li { padding: 2px 0; overflow-wrap: anywhere; }
.recipe-fields[hidden] { display: none; }
.import-preview { margin: 8px 0; }
.import-list { margin: 0 0 8px; padding: 0; list-style: none; }
.import-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; }
.section-editor { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 12px; }
.section-row { padding: 10px; border: 1px solid var(--border-accent); border-radius: 10px; background: var(--surface); }
.section-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.section-top input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--primary-bg); color: var(--text-light); font: inherit; }
.section-row textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--primary-bg); color: var(--text-light); font: inherit; resize: vertical; }
.icon-add:disabled { opacity: .35; cursor: default; }
.template-panel .chip-row { margin-top: 0; }
.field input[type="text"], .field input[type="search"] { color-scheme: dark; }

/* ---- The theme's picture behind every page, dimmed so text stays readable ----
   --scrim is how much of the theme's dark color covers the picture (higher = dimmer, flatter);
   --bg-blur softens it. Panels and cards sit on solid "glass" (see --surface) so reading text
   never depends on the picture. The Gallery shows the picture itself, so it is left out. */
:root { --scrim: 66%; --bg-blur: 1.5px; }
body:not(.gallery-page)::before {
  content: "";
  position: fixed;
  inset: -12px; /* a little past the edges so the blur never shows a pale rim */
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(color-mix(in srgb, var(--primary-bg) var(--scrim), transparent), color-mix(in srgb, var(--primary-bg) var(--scrim), transparent)),
    var(--bg-image) center / cover no-repeat;
  background-color: var(--primary-bg);
  filter: blur(var(--bg-blur));
}
@media (prefers-reduced-transparency: reduce) { body:not(.gallery-page)::before { filter: none; background: var(--primary-bg); } }

/* the glass panels also blur whatever picture is behind them */
.card, .month, .week-day, .meal-day, .recipe-card, .section-row, .event-row, .calendar-row { backdrop-filter: blur(8px); }

/* ---- Day panel sections that go somewhere ---- */
a.sheet-section-link {
  display: block; position: relative; margin: 0 -8px; padding: 12px 28px 12px 8px;
  border-top: 1px solid var(--border-accent); color: inherit; text-decoration: none;
}
a.sheet-section-link + a.sheet-section-link, .sheet-section + a.sheet-section-link, a.sheet-section-link + .sheet-section { margin-top: 0; }
a.sheet-section-link::after {
  content: "\203A"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; opacity: .55;
}
a.sheet-section-link:hover, a.sheet-section-link:focus-visible { background: rgba(255, 255, 255, .08); }
a.sheet-section-link:hover::after { opacity: 1; }
a.sheet-section-link h3 { margin: 0 0 4px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-gold); }
a.sheet-section-link div { opacity: .9; }

/* ---- Traditions ---- */
.traditions-page { --page-max: 760px; padding-bottom: 110px; }
.tradition-card { align-items: baseline; }
.tradition-when { flex-basis: 100%; font-size: .9rem; opacity: .9; }
.tradition-rule { flex-basis: 100%; margin: 0; }
.memories { padding-top: 12px; border-top: 1px solid var(--border-accent); }
.memories-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.memories-head h3 { margin: 0; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); }
.memory-year h4 { margin: 14px 0 6px; font-family: var(--font-display); font-size: 1.1rem; color: var(--text-gold); }
.memory { padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid var(--accent-color); border-radius: 6px; background: var(--surface); }
.memory p { margin: 0 0 4px; }
.rule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.rule-row select, .rule-row input[type="number"] {
  padding: 9px 10px; border: 1px solid var(--control-border); border-radius: 10px;
  background: var(--primary-bg); color: var(--text-light); font: inherit; color-scheme: dark;
}
.rule-row input[type="number"] { width: 5em; }
.rule-row[hidden], .event-form div[hidden] { display: none; }
.rule-preview { min-height: 1.4em; margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface); font-size: .9rem; }
.rule-preview:empty { display: none; }
.holiday-list { display: flex; flex-direction: column; }
.holiday-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-accent); }
.holiday-row:first-of-type { border-top: 0; }
.holiday-row .hint { margin: 2px 0 0; }

/* ---- Kanban ---- */
.kanban-page { --page-max: 100%; --page-gutter: 14px; padding-bottom: 110px; }
.board-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.board-chips { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.board-chips .chip-btn { flex: none; white-space: nowrap; }
.board-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: 6px 0 12px; }
.board-title { margin: 0; font-size: 1.6rem; }
.board-access { margin: 0; }
.board-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.board-actions .check-row { padding: 0; }

.kboard { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding-bottom: 16px; scroll-snap-type: x proximity; }
.klist {
  flex: 0 0 min(300px, 84vw); scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--border-accent); border-radius: var(--radius); background: var(--surface); backdrop-filter: blur(8px);
}
.klist-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.klist-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; color: var(--text-gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.klist-menu { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-light); font-size: 1.2rem; cursor: pointer; }
.klist-menu:hover { background: rgba(255, 255, 255, .12); }
.klist-cards { display: flex; flex-direction: column; gap: 8px; min-height: 12px; }
.klist-hidden { margin: 0; text-align: center; }

.kcard {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px;
  border: 1px solid var(--border-accent); border-radius: 10px; background: var(--primary-bg); color: var(--text-light);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.kcard:hover { border-color: var(--accent-color); }
.kcard.is-done .kcard-title { text-decoration: line-through; opacity: .6; }
.kcard.is-dragging { opacity: .3; }
.kcard-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kcard-check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; padding: 0; border: 2px solid var(--border-accent); border-radius: 50%;
  background: transparent; color: var(--on-highlight); font-size: .8rem; line-height: 1; cursor: pointer;
}
.kcard-check[aria-checked="true"] { background: var(--highlight-color); border-color: var(--highlight-color); }
.kcard-check:disabled { cursor: default; opacity: .6; }
.kdue { flex-basis: 100%; padding-left: 32px; font-size: .75rem; opacity: .85; }
.kdue-overdue { color: #ffb4a8; font-weight: 600; opacity: 1; }
.kdue-today { color: var(--text-gold); font-weight: 600; opacity: 1; }
.kdue-done { text-decoration: line-through; opacity: .5; }

.kadd { width: 100%; padding: 9px; border: 1px dashed var(--border-accent); border-radius: 10px; background: transparent; color: var(--text-light); font: inherit; opacity: .8; cursor: pointer; }
.kadd:hover { opacity: 1; background: rgba(255, 255, 255, .06); }
.kadd-row { display: flex; flex-wrap: wrap; gap: 6px; }
.kadd-input { flex: 1 1 100%; padding: 9px 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--primary-bg); color: var(--text-light); font: inherit; }

/* dragging */
body.is-dragging-card { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.kghost { position: fixed; left: 0; top: 0; z-index: 400; margin: 0; pointer-events: none; box-shadow: 0 12px 28px rgba(0, 0, 0, .5); opacity: .95; cursor: grabbing; }
.kdrop { height: 4px; margin: -2px 0; border-radius: 2px; background: var(--accent-color); box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }

.board-row-top { display: flex; align-items: center; gap: 4px; }
.board-open { font-weight: 600; font-size: 1rem; text-decoration: none; opacity: 1; }
.board-open .badge { margin-left: 8px; }
.sheet-subhead { margin: 16px 0 6px; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-gold); }

/* ---- Rich text, checklists, card badges (Kanban part 2) ---- */
.rich-wrap { border: 1px solid var(--control-border); border-radius: 10px; background: var(--primary-bg); }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border-accent); }
.rich-btn { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-light); font: inherit; font-size: .9rem; cursor: pointer; }
.rich-btn:hover { background: rgba(255, 255, 255, .1); }
.rich-btn[aria-pressed="true"] { background: var(--highlight-color); color: var(--on-highlight); }
.rich-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--border-accent); }
.rich-link-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 6px 0; }
.rich-link-input { flex: 1 1 200px; min-width: 0; padding: 8px 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--primary-bg); color: var(--text-light); font: inherit; }
.rich-wrap .status { margin: 4px 8px 0; }
.rich-editor { min-height: 7em; padding: 10px 12px; outline: none; overflow-wrap: anywhere; line-height: 1.5; }
.rich-editor:focus-visible { box-shadow: inset 0 0 0 2px var(--text-gold); border-radius: 0 0 10px 10px; }
.rich-editor ul, .rich-editor ol, .rich-view ul, .rich-view ol { margin: 4px 0; padding-left: 1.4em; }
.rich-editor a, .rich-view a { color: var(--text-gold); text-decoration: underline; }
.rich-view { overflow-wrap: anywhere; line-height: 1.5; }

.checklists { margin: 10px 0 4px; }
.checklist { margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--border-accent); border-radius: 10px; background: var(--surface); }
.checklist-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.checklist-head strong, .checklist-name { flex: 1; min-width: 0; }
.checklist-name { padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-light); font: inherit; font-weight: 600; }
.checklist-name:focus, .check-item input:focus { border-color: var(--border-accent); background: var(--primary-bg); outline: none; }
.checklist-count { flex: none; font-size: .8rem; opacity: .8; }
.progress { height: 8px; margin-bottom: 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--highlight-color); transition: width .25s; }
.check-items { display: flex; flex-direction: column; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 8px; }
.check-item input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-light); font: inherit; }
.check-item.is-done input, .check-item.is-done .check-text { text-decoration: line-through; opacity: .6; }
.check-item .kcard-check { margin-top: 0; }
.check-text { flex: 1; min-width: 0; padding: 6px 8px; overflow-wrap: anywhere; }
.check-del { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-light); font-size: 1.1rem; cursor: pointer; opacity: .6; }
.check-del:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.check-add { width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--border-accent); border-radius: 8px; background: transparent; color: var(--text-light); font: inherit; }
.checklist-new { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.checklist-new input { flex: 1 1 180px; min-width: 0; padding: 8px 10px; border: 1px solid var(--border-accent); border-radius: 8px; background: var(--primary-bg); color: var(--text-light); font: inherit; }

.kbadges { flex-basis: 100%; display: flex; gap: 8px; padding-left: 32px; font-size: .75rem; opacity: .85; }
.kbadge { padding: 0 6px; border: 1px solid var(--border-accent); border-radius: 999px; }
.kbadge-done { background: var(--highlight-color); color: var(--on-highlight); border-color: transparent; }
.dot-card { background: repeating-linear-gradient(45deg, var(--accent-color), var(--accent-color) 3px, transparent 3px, transparent 6px); border: 1px solid var(--accent-color); }

/* ---- Pomodoro: the header button ---- */
.pomo-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 999px; color: var(--text-gold); text-decoration: none; opacity: .7; transition: opacity .2s, background .2s; }
.pomo-btn:hover, .pomo-btn:focus-visible { opacity: 1; background: var(--surface); }
.pomo-btn svg { width: 22px; height: 22px; flex: none; }
.pomo-btn.is-active { opacity: 1; padding: 0 12px 0 10px; border: 1px solid var(--border-accent); background: var(--surface); font-variant-numeric: tabular-nums; font-weight: 600; }
.pomo-btn.is-active[data-mode="focus"] { color: var(--text-gold); border-color: var(--accent-color); }
.pomo-btn.is-active[data-mode="short"], .pomo-btn.is-active[data-mode="long"] { color: var(--text-light); border-color: var(--highlight-color); }
.pomo-btn[data-status="paused"] .pomo-time { opacity: .6; }
.pomo-time { font-size: .9rem; }

/* ---- Pomodoro page ---- */
.pomo-page { --page-max: 560px; padding-bottom: 110px; }
.pomo-card { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.pomo-pet .pet-figure { width: 132px; height: 132px; }
.pomo-pet .pet-face { border-width: 4px; }
.ring-box { position: relative; width: min(280px, 78vw); aspect-ratio: 1; }
.ring { display: block; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--accent-color); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
[data-mode="short"] .ring-fill, [data-mode="long"] .ring-fill { stroke: var(--highlight-color); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-time { font-size: clamp(2.6rem, 14vw, 3.8rem); font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label { font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-gold); }
.pomo-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pomo-main { min-width: 9em; font-size: 1.05rem; padding: 12px 24px; }
.pomo-dots { display: flex; gap: 10px; }
.pomo-dot { width: 14px; height: 14px; border: 2px solid var(--border-accent); border-radius: 50%; }
.pomo-dot.is-done { background: var(--accent-color); border-color: var(--accent-color); }
.pomo-dot.is-now { border-color: var(--highlight-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--highlight-color) 35%, transparent); }
.pomo-dots-text { margin: 0; }
.pomo-stats { margin: 0 0 4px; font-size: 1.05rem; }
.pomo-wrap .card { margin-top: 16px; }
.pomo-wrap .card:first-child { margin-top: 0; }
