:root {
  --bg: #1c1917;
  --surface: #292524;
  --surface-2: #44403c;
  --text: #fafaf9;
  --text-muted: #a8a29e;
  --accent: #f97316;
  --accent-dim: #c2410c;
  --done: #84cc16;
  --danger: #f43f5e;
  --speech-bg: #fef3c7;
  --speech-text: #1c1917;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, #431407 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, #292524 0%, transparent 50%);
  color: var(--text);
  line-height: 1.5;
}

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

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.header {
  margin-bottom: 2rem;
}

.header-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

@media (min-width: 640px) {
  .header-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
  }

  .header-titles {
    text-align: left;
  }
}

.header h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.auth-bar {
  flex-shrink: 0;
  width: 100%;
  max-width: 320px;
}

@media (min-width: 640px) {
  .auth-bar {
    width: auto;
    max-width: none;
  }
}

.auth-anon {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 640px) {
  .auth-anon {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    gap: 0.5rem 0.65rem;
  }
}

.auth-or {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  text-transform: lowercase;
}

@media (min-width: 640px) {
  .auth-or {
    padding: 0 0.15rem;
  }
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid var(--surface-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-google:hover {
  background: #f8f8f8;
}

.btn-google-icon {
  display: inline-flex;
  line-height: 0;
}

.auth-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .auth-form {
    justify-content: flex-end;
  }
}

.auth-input {
  flex: 1;
  min-width: 160px;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.auth-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-msg {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--done);
  text-align: center;
}

@media (min-width: 640px) {
  .auth-msg {
    text-align: right;
  }
}

.auth-signed-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  justify-content: center;
}

@media (min-width: 640px) {
  .auth-signed-in {
    justify-content: flex-end;
  }
}

.auth-email-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-compact {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.config-warning {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  text-align: left;
}

.config-warning code {
  font-size: 0.82em;
  color: var(--accent);
}

.sync-callout {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.12);
}

.sync-callout-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.sync-callout-sub {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.sync-callout-google {
  width: 100%;
  justify-content: center;
}

@media (min-width: 480px) {
  .sync-callout-google {
    width: auto;
    min-width: 220px;
  }
}

.app-main {
  display: contents;
}

.auth-gate-actions {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .auth-gate-actions {
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem 0.75rem;
  }
}

.auth-gate-google {
  width: 100%;
  justify-content: center;
}

@media (min-width: 480px) {
  .auth-gate-google {
    width: auto;
    min-width: 220px;
  }
}

.auth-gate-email-form {
  justify-content: center;
  flex: 1 1 auto;
  min-width: min(100%, 280px);
}

.auth-gate-msg {
  text-align: center;
  margin-top: 0.75rem;
}

.main {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 720px) {
  .main {
    grid-template-columns: 1fr 320px;
  }
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-2);
}

.add-form {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.add-form input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.add-form input::placeholder {
  color: var(--text-muted);
}

.add-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #1c1917;
}

.btn-primary:hover {
  background: #fb923c;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.65rem;
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
}

.btn-icon:hover {
  color: var(--danger);
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid transparent;
  animation: slideIn 0.28s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.todo-item.done {
  border-color: var(--surface-2);
  opacity: 0.85;
}

.todo-item.done .todo-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-check {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--done);
  cursor: pointer;
  flex-shrink: 0;
}

.todo-label {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-2);
}

.count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.empty-hint {
  margin: 0;
  padding: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}

.empty-hint[hidden] {
  display: none;
}

/* Grumpy cat (CSS illustration) */
.cat-panel {
  position: sticky;
  top: 1rem;
}

.cat-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.cat {
  position: relative;
  width: 140px;
  height: 160px;
  transition: transform 0.2s ease;
}

.cat.roast-pulse {
  animation: catShake 0.5s ease;
}

@keyframes catShake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-4deg);
  }
  40% {
    transform: rotate(4deg);
  }
  60% {
    transform: rotate(-3deg);
  }
  80% {
    transform: rotate(2deg);
  }
}

.cat-ear {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-bottom: 38px solid #57534e;
  top: 0;
  z-index: 0;
}

.cat-ear-l {
  left: 12px;
  transform: rotate(-18deg);
}

.cat-ear-r {
  right: 12px;
  transform: rotate(18deg);
}

.cat-face {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: 118px;
  height: 100px;
  background: linear-gradient(180deg, #78716c 0%, #57534e 100%);
  border-radius: 50% 50% 48% 48%;
  z-index: 1;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.15);
}

.cat-brow {
  position: absolute;
  top: 22px;
  width: 36px;
  height: 8px;
  background: #292524;
  border-radius: 4px;
}

.cat-brow-l {
  left: 14px;
  transform: rotate(-18deg);
}

.cat-brow-r {
  right: 14px;
  transform: rotate(18deg);
}

.cat-eye {
  position: absolute;
  top: 38px;
  width: 28px;
  height: 20px;
  background: #fef08a;
  border-radius: 50%;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.2);
}

.cat-eye::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 14px;
  background: #1c1917;
  border-radius: 50%;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
}

.cat-eye-l {
  left: 18px;
}

.cat-eye-r {
  right: 18px;
}

.cat-nose {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  width: 14px;
  height: 10px;
  background: #fda4af;
  border-radius: 40% 40% 50% 50%;
}

.cat-mouth {
  position: absolute;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  width: 32px;
  height: 14px;
  border: 3px solid #1c1917;
  border-top: none;
  border-radius: 0 0 50% 50%;
  background: transparent;
}

.cat-whisker {
  position: absolute;
  height: 2px;
  background: #d6d3d1;
  border-radius: 1px;
  top: 62px;
}

.cat-whisker-l1 {
  width: 28px;
  left: -8px;
  transform: rotate(-8deg);
}

.cat-whisker-l2 {
  width: 24px;
  left: -6px;
  top: 70px;
  transform: rotate(5deg);
}

.cat-whisker-r1 {
  width: 28px;
  right: -8px;
  transform: rotate(8deg);
}

.cat-whisker-r2 {
  width: 24px;
  right: -6px;
  top: 70px;
  transform: rotate(-5deg);
}

.cat-body {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100px;
  height: 52px;
  background: #57534e;
  border-radius: 40% 40% 35% 35%;
  z-index: 0;
}

.speech {
  background: var(--speech-bg);
  color: var(--speech-text);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 3px solid #1c1917;
  box-shadow: 4px 4px 0 #1c1917;
  position: relative;
}

.speech::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-bottom-color: #1c1917;
}

.speech::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: var(--speech-bg);
}

.roast {
  margin: 0;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.45;
}

/* Onboarding — two-page flow (standalone HTML) */
.onboard-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.onboard-step-badge {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.onboard-back-wrap {
  margin: 1rem 0 0;
  text-align: center;
}

.onboard-back {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.onboard-back:hover {
  color: var(--text);
}

.onboarding-card {
  width: min(100%, 420px);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem 1.5rem;
  animation: onboardPop 0.38s ease;
}

@keyframes onboardPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.onboard-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  text-align: center;
}

.onboard-sub {
  margin: 0 0 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.onboard-cat-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.onboard-cat {
  transform: scale(0.72);
  transform-origin: center top;
}

.onboard-speech {
  background: var(--speech-bg);
  color: var(--speech-text);
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 3px solid #1c1917;
  box-shadow: 3px 3px 0 #1c1917;
  margin-bottom: 1.1rem;
  position: relative;
}

.onboard-speech::before {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: #1c1917;
}

.onboard-speech::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--speech-bg);
}

.onboard-cat-line {
  margin: 0;
  font-size: 0.98rem;
  font-style: italic;
  line-height: 1.5;
}

.onboard-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.onboard-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.onboard-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.onboard-input::placeholder {
  color: var(--text-muted);
}

.onboard-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.onboard-error {
  margin: 0;
  font-size: 0.88rem;
  color: var(--danger);
}

.onboard-error[hidden] {
  display: none;
}

.onboard-submit {
  margin-top: 0.35rem;
  align-self: stretch;
}
