:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #66728a;
  --line: #dce2ee;
  --red: #e33838;
  --yellow: #f2c84b;
  --green: #1e9a74;
  --blue: #2868c9;
  --shadow: 0 18px 44px rgba(31, 45, 72, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(227, 56, 56, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(40, 104, 201, 0.11), transparent 32%),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 2px 6px;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  min-width: 54px;
  min-height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--red);
  color: white;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.panel {
  border: 1px solid rgba(220, 226, 238, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.setup {
  max-width: 680px;
  padding: 24px;
}

.landing {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 24px;
  align-items: center;
  min-height: calc(100vh - 140px);
}

.landing-copy h1,
.progress-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.3rem, 5.6vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.progress-copy h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

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

.lede {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
}

.bounce-stage {
  min-height: 230px;
  display: grid;
  place-items: center;
}

.green-ball {
  width: min(190px, 42vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #e8ffe6 0 12%, #4ee24c 13% 42%, #13a824 72%, #087719 100%);
  box-shadow: 0 34px 42px rgba(8, 119, 25, 0.24), inset -18px -24px 32px rgba(0, 0, 0, 0.16);
  animation: bounceBall 1.15s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
}

@keyframes bounceBall {
  0%, 100% {
    transform: translateY(0) scale(1.08, 0.92);
  }

  45% {
    transform: translateY(-92px) scale(0.96, 1.04);
  }

  60% {
    transform: translateY(-88px) scale(1);
  }
}

.auth-card,
.log-panel,
.history-panel,
.week-panel,
.hero-panel,
.quote-panel {
  padding: 20px;
}

.auth-card h2,
.section-head h2,
.dialog-card h2 {
  margin: 0;
  font-size: 1.08rem;
}

label {
  display: block;
  margin: 15px 0 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
  padding: 12px;
}

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

.button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 850;
}

.button.primary {
  background: var(--red);
  color: white;
  box-shadow: 0 12px 24px rgba(227, 56, 56, 0.22);
}

.button.secondary,
.button.quiet {
  border: 1px solid var(--line);
  background: white;
}

.button.google {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 18px rgba(31, 45, 72, 0.07);
}

.google-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #2868c9;
  background: #f8fafc;
  font-weight: 900;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.button.quiet {
  color: var(--muted);
}

.auth-actions,
.quick-actions,
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.hint {
  min-height: 21px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.progress-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.progress-ring {
  --progress: 0%;
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.36) 0 22%, transparent 23%),
    conic-gradient(var(--red) var(--progress), #e8edf5 0);
  box-shadow: inset 0 -10px 18px rgba(21, 32, 51, 0.10), 0 16px 30px rgba(227, 56, 56, 0.18);
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line);
}

.progress-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.progress-center strong {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.progress-center span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.total {
  margin: 18px 0 0;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  line-height: 0.95;
  font-weight: 900;
}

.total small {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.bar {
  height: 18px;
  margin: 18px 0;
  border-radius: 6px;
  background: #e8edf5;
  overflow: hidden;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue));
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.stats strong {
  display: block;
  font-size: 1.4rem;
}

.stats span,
.section-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head > div {
  min-width: 0;
}

.week-panel,
.history-panel {
  margin-top: 18px;
}

.quote-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.quote-panel blockquote {
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 850;
  line-height: 1.22;
}

.quote-panel p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.calendar-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  font-weight: 850;
  white-space: nowrap;
}

.toggle-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}

.year-calendar {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.calendar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.calendar-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.year-grid-wrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.year-grid {
  min-width: 786px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  gap: 3px;
}

.year-day {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #e8edf5;
}

.year-day.spacer {
  visibility: hidden;
}

.year-day.future {
  opacity: 0.45;
}

.year-day.level-1 {
  background: rgba(30, 154, 116, 0.24);
}

.year-day.level-2 {
  background: rgba(30, 154, 116, 0.45);
}

.year-day.level-3 {
  background: rgba(30, 154, 116, 0.72);
}

.year-day.level-4 {
  background: var(--green);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.day strong {
  font-size: 0.78rem;
}

.day span {
  color: var(--muted);
  font-size: 0.8rem;
}

.day.done {
  border-color: rgba(30, 154, 116, 0.4);
  background: rgba(30, 154, 116, 0.1);
}

.custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.entries {
  display: grid;
  gap: 10px;
  max-height: 440px;
  overflow: auto;
  padding-right: 4px;
}

.entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.brick {
  width: 46px;
  height: 30px;
  border-radius: 5px;
  background: var(--blue);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.10);
  position: relative;
}

.brick::before,
.brick::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.brick::before {
  left: 9px;
}

.brick::after {
  right: 9px;
}

.entry h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.entry p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.delete {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 900;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(21, 32, 51, 0.34);
}

.dialog-card {
  width: min(420px, calc(100vw - 28px));
  padding: 20px;
  background: white;
}

@media (max-width: 880px) {
  .landing,
  .app-grid,
  .progress-layout {
    grid-template-columns: 1fr;
  }

  .landing {
    min-height: 0;
  }

  .progress-ring {
    width: 154px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1160px);
    padding: 18px 0;
  }

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

  .auth-actions,
  .quick-actions,
  .stats,
  .week-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .calendar-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-panel {
    margin-top: 18px;
  }

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

  .delete {
    grid-column: 2;
    justify-self: end;
  }
}
