:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #1b1a18;
  --panel-strong: #23211e;
  --text: #f7f4ed;
  --muted: #b8b0a3;
  --line: #36312a;
  --gold: #d6a03d;
  --gold-strong: #f0bb52;
  --red: #e25b4d;
  --green: #7ccf82;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(214, 160, 61, 0.12), transparent 340px),
    radial-gradient(circle at top right, rgba(226, 91, 77, 0.14), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 24px;
  padding: 34px 0 26px;
}

.header-logo {
  grid-column: 2;
  width: clamp(132px, 18vw, 208px);
  aspect-ratio: 1;
  object-fit: contain;
  justify-self: center;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.42));
}

.hero-content {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 820px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "League Spartan", Inter, system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.4rem, 5vw, 5.4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.35rem;
}

.hero-copy {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.date-pill {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(27, 26, 24, 0.72);
}

.date-control,
.dashboard {
  display: grid;
  gap: 16px;
}

.date-control {
  grid-template-columns: 44px minmax(190px, auto) 44px auto;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 26, 24, 0.72);
}

.date-picker-wrap {
  position: relative;
  display: grid;
}

.date-display {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  background: #12110f;
  color: var(--text);
  font-family: "League Spartan", Inter, system-ui, sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  font-weight: 800;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-picker-wrap input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.date-arrow {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 800;
}

.date-arrow:hover,
.date-display:hover {
  border-color: var(--gold);
  color: var(--gold-strong);
}

.achievement-strip {
  width: fit-content;
  max-width: 100%;
  margin: -18px auto 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 17, 15, 0.72);
}

.achievement-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
}

.achievement-badge {
  width: auto;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(240, 187, 82, 0.44);
  border-radius: 50%;
  padding: 0 8px;
  background:
    linear-gradient(135deg, rgba(214, 160, 61, 0.24), rgba(124, 207, 130, 0.08)),
    var(--panel-strong);
  color: var(--gold-strong);
  font-family: "League Spartan", Inter, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
}

.achievement-badge[data-achievement-id^="streak:"] {
  border-radius: 999px;
  border-color: rgba(240, 187, 82, 0.68);
}

.badge-flame {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.achievement-badge:hover,
.achievement-badge.active {
  border-color: var(--gold-strong);
  background:
    linear-gradient(135deg, rgba(214, 160, 61, 0.88), rgba(124, 207, 130, 0.45)),
    var(--gold);
  color: #17110a;
}

.achievement-subtitle {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.achievement-empty {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.log-panel,
.progress-panel,
.history-panel {
  margin-bottom: 16px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 26, 24, 0.9);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 146px;
  padding: 22px;
}

.metric.primary {
  background:
    linear-gradient(135deg, rgba(214, 160, 61, 0.24), rgba(226, 91, 77, 0.08)),
    var(--panel);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--text);
  font-family: "League Spartan", Inter, system-ui, sans-serif;
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  font-weight: 800;
  line-height: 1;
}

.panel {
  padding: 22px;
}

.log-panel {
  border-color: rgba(240, 187, 82, 0.36);
  background:
    linear-gradient(135deg, rgba(214, 160, 61, 0.13), rgba(124, 207, 130, 0.05)),
    rgba(27, 26, 24, 0.94);
}

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

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 1.4rem;
}

.quick-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.log-time-control {
  display: grid;
  gap: 8px;
  max-width: 180px;
  margin-bottom: 20px;
}

.quick-buttons button,
.custom-entry button,
.today-button,
.panel-actions button {
  min-height: 48px;
  border-radius: 6px;
  background: var(--gold);
  color: #17110a;
  font-weight: 800;
}

.quick-buttons button:hover,
.custom-entry button:hover,
.today-button:hover,
.panel-actions button:hover {
  background: var(--gold-strong);
}

.custom-entry {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.custom-entry-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: end;
  gap: 10px;
}

.custom-entry-fields div {
  display: grid;
  gap: 8px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #12110f;
  color: var(--text);
}

.goal-input {
  min-width: 150px;
}

.goal-progress {
  display: grid;
  gap: 10px;
}

.goal-progress span {
  color: var(--green);
  font-weight: 800;
}

.goal-status {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f0e0d;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 180ms ease;
}

.streak-card {
  border-color: rgba(240, 187, 82, 0.34);
}

.streak-card span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.streak-icon {
  width: 15px;
  height: 15px;
  fill: var(--gold-strong);
}

.streak-card small {
  max-width: 280px;
  line-height: 1.35;
}

.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.celebration-overlay[aria-hidden="false"] {
  display: grid;
}

.celebration-overlay.milestone {
  background:
    radial-gradient(circle at center, rgba(240, 187, 82, 0.24), transparent 34%),
    linear-gradient(135deg, rgba(214, 160, 61, 0.32), rgba(124, 207, 130, 0.16)),
    rgba(0, 0, 0, 0.9);
}

.celebration-overlay.broken {
  background:
    radial-gradient(circle at center, rgba(226, 91, 77, 0.14), transparent 36%),
    rgba(0, 0, 0, 0.88);
}

.celebration-card {
  width: min(560px, 100%);
  border: 1px solid rgba(240, 187, 82, 0.58);
  border-radius: 8px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(214, 160, 61, 0.18), rgba(124, 207, 130, 0.08)),
    #181613;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
  text-align: center;
  animation: celebration-in 220ms ease-out both;
}

.celebration-overlay.milestone .celebration-card {
  width: min(860px, 100%);
  min-height: min(620px, calc(100vh - 48px));
  display: grid;
  align-content: center;
  gap: 18px;
  border-color: var(--gold-strong);
  background:
    radial-gradient(circle at top, rgba(240, 187, 82, 0.2), transparent 42%),
    #151310;
}

.celebration-card h2 {
  font-size: clamp(2.3rem, 7vw, 5.7rem);
  line-height: 0.9;
}

.celebration-card p:not(.eyebrow) {
  max-width: 620px;
  margin: 14px auto 22px;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.55;
}

.celebration-scripture {
  max-width: 680px;
  margin: 0 auto 8px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
}

.celebration-reference {
  margin: 0 auto 22px;
  color: var(--gold-strong);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.celebration-card button {
  min-width: 148px;
  justify-self: center;
  padding: 0 18px;
}

@keyframes celebration-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chart {
  display: grid;
  grid-template-columns: repeat(var(--history-days, 14), minmax(44px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 240px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.bar-wrap {
  display: grid;
  grid-template-rows: 18px 178px 18px;
  align-items: end;
  gap: 8px;
  min-width: 44px;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.bar {
  align-self: end;
  width: 100%;
  min-height: 6px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.bar-wrap:hover .bar,
.bar-wrap.active .bar {
  filter: brightness(1.18);
  transform: translateY(-2px);
}

.bar-wrap.active .bar-label {
  color: var(--gold-strong);
}

.bar-label,
.bar-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.entries-panel {
  margin-bottom: 24px;
  padding: 16px;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.panel-actions button {
  padding: 0 14px;
  background: var(--panel-strong);
  color: var(--text);
}

.panel-actions .danger {
  color: #ffb2aa;
}

.entries-list {
  display: grid;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entries-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(35, 33, 30, 0.64);
}

.entries-list li > div {
  display: grid;
  gap: 2px;
}

.entries-list strong {
  font-size: 0.96rem;
}

.entries-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-edit-button,
.entry-save-button,
.entry-cancel-button,
.entry-delete-button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
}

.entry-save-button {
  background: var(--gold);
  color: #17110a;
}

.entry-delete-button {
  color: #ffb2aa;
}

.entry-edit-row {
  align-items: end;
}

.entry-edit-fields {
  display: grid;
  grid-template-columns: minmax(88px, 120px) minmax(110px, 150px);
  gap: 10px;
}

.entry-edit-fields label {
  display: grid;
  gap: 6px;
}

.entry-actions {
  display: flex;
  gap: 8px;
}

.range-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  font-weight: 800;
}

.app-footer {
  padding: 6px 0 88px;
  text-align: center;
}

.app-footer a {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--gold-strong);
}

@media (max-width: 1024px) {
  .date-control {
    grid-template-columns: 42px minmax(180px, 1fr) 42px auto;
  }

  .custom-entry-fields {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .range-controls {
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
  }
}

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

  .hero,
  .panel-heading {
    align-items: stretch;
  }

  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .header-logo,
  .hero-content,
  .date-pill {
    grid-column: 1;
  }

  .date-pill {
    grid-row: auto;
    justify-self: center;
  }

  .achievement-strip {
    margin: -10px auto 16px;
  }

  .achievement-icons {
    justify-content: center;
  }

  .achievement-subtitle {
    text-align: center;
  }

  .panel-heading {
    flex-direction: column;
  }

  .date-control,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .date-control {
    grid-template-columns: 42px minmax(0, 1fr) 42px auto;
    justify-content: stretch;
  }

  .date-display {
    width: 100%;
  }

  .metric {
    min-height: 128px;
  }

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

  .custom-entry-fields,
  .entry-edit-fields {
    grid-template-columns: 1fr;
  }

  .log-time-control {
    max-width: none;
  }

  .entries-list li,
  .entry-edit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-actions {
    width: 100%;
  }

  .entry-actions button,
  .entry-edit-button {
    width: 100%;
  }

  .chart {
    gap: 5px;
    grid-template-columns: repeat(var(--history-days, 14), 44px);
  }

  .range-controls {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2.1rem, 14vw, 3.4rem);
  }

  .panel,
  .metric {
    padding: 16px;
  }

  .date-control {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .date-control .today-button {
    grid-column: 1 / -1;
  }

  .quick-buttons button {
    min-height: 54px;
  }

  .celebration-overlay {
    padding: 14px;
  }

  .celebration-overlay.milestone .celebration-card {
    min-height: calc(100vh - 28px);
  }
}
