:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #17202a;
  --muted: #5d6b7a;
  --line: #dce3ea;
  --primary: #246bfe;
  --primary-strong: #174ed2;
  --secondary: #14b8a6;
  --success: #248a5a;
  --warning: #b76e00;
  --danger: #c43d3d;
  --button-text: #ffffff;
  --shadow: 0 14px 34px rgba(23, 32, 42, 0.08);
  --radius: 8px;
  --tap: 44px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #10151c;
  --surface: #161d26;
  --surface-2: #1d2733;
  --text: #eef4fb;
  --muted: #aebccc;
  --line: #2b3847;
  --primary: #7aa2ff;
  --primary-strong: #9ab8ff;
  --secondary: #2dd4bf;
  --success: #55c98f;
  --warning: #f0b35a;
  --danger: #ff7a7a;
  --button-text: #07111f;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  transition: background 180ms ease, color 180ms ease;
}

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

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

button,
.button {
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--button-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1rem;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.1;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover,
.button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button.secondary,
button.secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover {
  background: var(--surface-2);
}

.button.ghost,
button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid rgba(36, 107, 254, 0.35);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 248, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

:root[data-theme="dark"] .site-header {
  background: rgba(16, 21, 28, 0.92);
}

.nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.78rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-button {
  min-height: 38px;
  padding: 0.55rem 0.72rem;
  font-size: 0.85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--button-text);
  font-weight: 900;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.2rem;
}

.nav-links a {
  padding: 0.56rem 0.72rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 720;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(23, 32, 42, 0.08);
}

.mobile-nav a {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 0.1rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.mobile-nav a strong {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.mobile-nav a[aria-current="page"] {
  color: var(--primary);
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1rem 1rem 5.8rem;
}

.hero {
  padding: 1.7rem 0 1.1rem;
}

.hero-grid {
  display: grid;
  gap: 1rem;
}

.eyebrow {
  color: var(--primary);
  font-weight: 850;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 8vw, 4.6rem);
}

h2 {
  font-size: clamp(1.42rem, 4.4vw, 2.2rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 68ch;
}

.search-wrap {
  margin: 1.15rem 0 0;
  position: relative;
}

.search {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 1rem;
  box-shadow: var(--shadow);
}

.search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  animation: fade-up 160ms ease both;
}

.search-results a {
  display: block;
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--line);
}

.search-results a:last-child {
  border-bottom: 0;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two,
.grid.three,
.grid.four {
  grid-template-columns: 1fr;
}

.section {
  margin: 1.25rem 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-head p {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
  animation: fade-up 220ms ease both;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 180ms ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--primary), var(--line) 68%);
  box-shadow: var(--shadow);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  padding: 1rem;
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.25rem;
}

.card.soft {
  background: var(--surface-2);
}

.tool-card,
.post-card,
.room-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tool-card p,
.post-card p,
.room-card p,
.muted {
  color: var(--muted);
}

.tag-row,
.action-row,
.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.tag.success {
  background: rgba(36, 138, 90, 0.1);
  color: var(--success);
}

.tag.warning {
  background: rgba(183, 110, 0, 0.12);
  color: var(--warning);
}

:root[data-theme="dark"] .tag.success {
  background: rgba(85, 201, 143, 0.16);
}

:root[data-theme="dark"] .tag.warning {
  background: rgba(240, 179, 90, 0.16);
}

.stat {
  display: grid;
  gap: 0.2rem;
}

.stat strong {
  font-size: 1.5rem;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7ef;
}

:root[data-theme="dark"] .progress {
  background: #273548;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0.66rem 0.74rem;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.result-box,
pre {
  background: #101923;
  color: #edf6ff;
  border-radius: var(--radius);
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
}

:root[data-theme="dark"] .result-box,
:root[data-theme="dark"] pre {
  background: #0b1119;
  color: #eaf2fb;
}

.timer-face {
  display: grid;
  place-items: center;
  min-height: 210px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #eaf0ff, #edf8f6);
  border: 1px solid var(--line);
  text-align: center;
}

:root[data-theme="dark"] .timer-face {
  background: linear-gradient(145deg, #182a47, #173733);
}

.timer-card:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  display: grid;
  align-content: center;
  padding: 2rem;
  background: var(--surface);
}

.timer-card:fullscreen .timer-face {
  min-height: 60vh;
}

.timer-face strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 16vw, 5.5rem);
  line-height: 1;
}

.check-list {
  display: grid;
  gap: 0.55rem;
}

.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.check-item input {
  width: auto;
  min-height: auto;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.heat {
  border: 1px solid var(--line);
  border-left: 6px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--surface);
}

.heat.strong {
  border-left-color: var(--success);
}

.heat.weak {
  border-left-color: var(--warning);
}

.heat.untouched {
  border-left-color: var(--muted);
}

.article {
  max-width: 820px;
}

.article h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  margin-bottom: 0.6rem;
}

.article h2 {
  margin-top: 1.5rem;
}

.article p,
.article li {
  color: var(--muted);
}

.article a {
  color: var(--primary);
  font-weight: 750;
}

.article ul,
.article ol {
  padding-left: 1.3rem;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
}

.ad-slot {
  min-height: 72px;
  display: grid;
  place-items: center;
  margin: 1rem 0;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2), transparent 18%);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.quote-card,
.sync-nudge {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
  padding: 1rem;
  animation: fade-up 220ms ease both;
}

.quote-card p {
  margin: 0.3rem 0 0.4rem;
  color: var(--text);
  font-size: 1.03rem;
}

.quote-card strong {
  color: var(--muted);
}

.sync-nudge {
  display: grid;
  gap: 0.85rem;
  align-items: center;
}

.sync-nudge h2 {
  font-size: 1.2rem;
  margin-top: 0.2rem;
}

.sync-nudge p {
  color: var(--muted);
}

.local-code {
  width: 156px;
  height: 156px;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 3px;
  padding: 8px;
  margin: 0.75rem 0;
  background: #fff;
  border-radius: 8px;
}

:root[data-theme="dark"] .local-code {
  background: #eaf2fb;
}

.local-code span {
  background: #e5e9ef;
  border-radius: 2px;
}

.local-code .on {
  background: #101923;
}

.markdown-preview {
  color: var(--text);
}

.focus-shell {
  min-height: calc(100vh - 84px);
  display: grid;
  align-content: center;
  gap: 1rem;
}

.post-card + form {
  margin-top: -0.7rem;
}

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

.faq summary {
  cursor: pointer;
  font-weight: 820;
}

.toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 4.8rem;
  z-index: 30;
  display: none;
  padding: 0.78rem 1rem;
  border-radius: var(--radius);
  background: #101923;
  color: #fff;
  box-shadow: var(--shadow);
}

.confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  background: var(--primary);
  animation: fall 900ms ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(240deg);
    opacity: 0.2;
  }
}

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

@media (min-width: 720px) {
  .container {
    padding-bottom: 2rem;
  }

  .nav-links {
    display: flex;
  }

  .mobile-nav {
    display: none;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    align-items: center;
  }

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

  .grid.three {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid.four {
    grid-template-columns: repeat(4, 1fr);
  }

  .sync-nudge {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .form-grid.two {
    grid-template-columns: repeat(2, 1fr);
  }

  .heatmap {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
