:root {
  color-scheme: dark;
  --bg-top: #101712;
  --bg-bottom: #0a0f0c;
  --surface: rgba(20, 29, 24, 0.92);
  --surface-strong: rgba(29, 41, 34, 0.94);
  --surface-soft: rgba(18, 26, 21, 0.82);
  --ink: #ebf1e8;
  --ink-soft: #d6dfd3;
  --muted: #9aa99b;
  --line: rgba(168, 188, 163, 0.16);
  --line-strong: rgba(168, 188, 163, 0.28);
  --accent: #6d8f61;
  --accent-strong: #86a878;
  --accent-soft: rgba(109, 143, 97, 0.2);
  --gold: #b79d6a;
  --gold-soft: rgba(183, 157, 106, 0.18);
  --danger: #bb7668;
  --danger-soft: rgba(187, 118, 104, 0.18);
  --info: #58736a;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(112, 144, 105, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(183, 157, 106, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, #0d130f 38%, var(--bg-bottom) 100%);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Trebuchet MS", "Gill Sans", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 15% 18%, rgba(109, 143, 97, 0.1), transparent 18%),
    radial-gradient(circle at 82% 10%, rgba(183, 157, 106, 0.08), transparent 18%),
    radial-gradient(circle at 60% 85%, rgba(109, 143, 97, 0.06), transparent 22%);
}

body::after {
  background: linear-gradient(180deg, rgba(6, 10, 8, 0) 0%, rgba(6, 10, 8, 0.32) 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(134, 168, 120, 0.26);
  outline-offset: 2px;
}

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

.hero,
.auth-panel,
.profile-bar,
.goal-panel,
.summary-panel,
.history-panel {
  animation: rise-in 520ms ease both;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 260px);
  gap: 28px;
  align-items: end;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(140deg, rgba(32, 45, 37, 0.96), rgba(12, 18, 14, 0.96)),
    linear-gradient(180deg, rgba(109, 143, 97, 0.08), transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.9;
  z-index: -1;
}

.hero::before {
  top: -72px;
  right: -18px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(109, 143, 97, 0.22), transparent 70%);
}

.hero::after {
  bottom: -110px;
  left: -70px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(183, 157, 106, 0.14), transparent 72%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
.stat strong,
.goal-text {
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

h1 {
  max-width: 8ch;
  margin-bottom: 12px;
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: #f2f0e8;
}

h2 {
  margin-bottom: 0;
  font-size: 1.34rem;
  line-height: 1.2;
  color: #f0efe8;
}

.hero-copy {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

.today-pill {
  display: grid;
  gap: 5px;
  align-self: stretch;
  align-content: space-between;
  min-width: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(28, 39, 32, 0.96), rgba(15, 21, 17, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.today-pill span,
.stat span,
.week-heading span,
.profile-bar span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.today-pill strong {
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ink);
}

.auth-panel,
.profile-bar {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(18, 26, 21, 0.94), rgba(13, 19, 16, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(180px, auto) minmax(260px, 1fr);
  gap: 22px;
  align-items: start;
  padding: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(9, 13, 11, 0.54);
}

.auth-tab {
  min-height: 40px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.auth-tab.active {
  background: linear-gradient(180deg, rgba(109, 143, 97, 0.9), rgba(85, 111, 76, 0.95));
  color: #f7f9f4;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.profile-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
}

.profile-bar div {
  display: grid;
  gap: 2px;
}

.form-message {
  min-height: 1.3em;
  margin: 2px 0 0;
  color: #d79e90;
  font-size: 0.9rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}

.goal-panel,
.summary-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(18, 26, 21, 0.95), rgba(12, 17, 14, 0.98)),
    linear-gradient(180deg, rgba(109, 143, 97, 0.04), transparent);
  box-shadow: var(--shadow);
}

.goal-panel,
.summary-panel {
  padding: 24px;
}

.history-panel {
  margin-top: 20px;
  padding: 24px;
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(126, 138, 128, 0.14);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-badge.done {
  background: var(--accent-soft);
  border-color: rgba(109, 143, 97, 0.26);
  color: #c8dbc2;
}

.status-badge.missed {
  background: var(--danger-soft);
  border-color: rgba(187, 118, 104, 0.24);
  color: #dfb4ab;
}

.goal-form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 760;
}

textarea,
input[type="date"],
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(28, 39, 32, 0.9), rgba(20, 29, 24, 0.94));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

textarea::placeholder,
input::placeholder {
  color: #88958a;
}

textarea {
  resize: vertical;
  min-height: 126px;
  padding: 16px;
  line-height: 1.6;
}

input[type="date"] {
  min-height: 46px;
  margin-top: 7px;
  padding: 0 12px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  min-height: 46px;
  padding: 0 12px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(180px, 230px) auto;
  gap: 12px;
  align-items: end;
}

.primary-action,
.success-action {
  background: linear-gradient(180deg, rgba(117, 148, 106, 0.96), rgba(88, 114, 79, 0.98));
  color: #f4f8f1;
  padding: 0 18px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
}

.primary-action:hover,
.success-action:hover {
  background: linear-gradient(180deg, rgba(134, 168, 120, 0.98), rgba(97, 126, 87, 1));
}

.danger-action {
  background: rgba(187, 118, 104, 0.12);
  border: 1px solid rgba(187, 118, 104, 0.26);
  color: #ddb0a6;
  padding: 0 18px;
}

.danger-action:hover {
  background: rgba(187, 118, 104, 0.18);
}

.ghost-action {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  padding: 0 14px;
}

.ghost-action:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(168, 188, 163, 0.34);
}

.current-goal {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(26, 37, 31, 0.94), rgba(18, 25, 21, 0.98)),
    linear-gradient(90deg, rgba(109, 143, 97, 0.1), transparent);
}

.goal-date {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.goal-text {
  margin-bottom: 18px;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.35;
  color: #f1f0e8;
  overflow-wrap: anywhere;
}

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

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(28, 39, 32, 0.9), rgba(18, 26, 21, 0.96)),
    radial-gradient(circle at top right, rgba(183, 157, 106, 0.08), transparent 50%);
}

.stat strong {
  font-size: 2.3rem;
  line-height: 1;
  color: #f1efe7;
}

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

.week-box {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 15, 12, 0.38);
}

.week-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.day-dot {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.day-dot.done {
  border-color: rgba(109, 143, 97, 0.1);
  background: linear-gradient(180deg, rgba(117, 148, 106, 0.98), rgba(88, 114, 79, 0.98));
  color: #f8faf5;
}

.day-dot.missed {
  border-color: rgba(187, 118, 104, 0.1);
  background: linear-gradient(180deg, rgba(175, 110, 97, 0.96), rgba(137, 86, 74, 0.98));
  color: #fff2ee;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-empty {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(28, 39, 32, 0.86), rgba(17, 24, 20, 0.96));
}

.history-item time {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.history-item p {
  margin-bottom: 0;
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.history-item span {
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.history-item span.done {
  background: var(--accent-soft);
  color: #c8dbc2;
}

.history-item span.missed {
  background: var(--danger-soft);
  color: #dfb4ab;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 15px 16px;
  border: 1px solid rgba(132, 166, 120, 0.2);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(64, 89, 81, 0.98), rgba(45, 63, 57, 0.98));
  color: #eff5ef;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.26);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .hero,
  .layout,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 26px 22px;
    border-radius: 26px;
  }

  h1 {
    max-width: none;
  }

  .today-pill {
    min-width: 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading .ghost-action {
    width: 100%;
  }

  .profile-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .toast {
    top: 12px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .goal-panel,
  .summary-panel,
  .history-panel,
  .auth-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .actions {
    display: grid;
  }

  .week-strip {
    gap: 6px;
  }

  .history-item {
    grid-template-columns: 1fr;
  }
}
