:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #071d20;
  --panel: #102f34;
  --line: rgba(246, 240, 232, 0.14);
  --ink: #f6f0e8;
  --muted: #b7c5c0;
  --teal: #18b9ad;
  --purple: #a78bfa;
  --amber: #e9b45d;
  --coral: #ed7566;
  --green: #7fd66b;
  --blue: #6db9ff;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 10%, rgba(109, 185, 255, 0.12), transparent 26%),
    radial-gradient(circle at 94% 12%, rgba(233, 180, 93, 0.13), transparent 28%),
    linear-gradient(135deg, #071d20 0%, #102f34 56%, #241f2a 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), #8ad9cb);
  color: #042326;
  cursor: pointer;
  font-weight: 830;
  padding: 0 12px;
}

button:hover,
button:focus-visible {
  background: linear-gradient(135deg, #35c9be, #f0d08d);
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(246, 240, 232, 0.17);
  border-radius: 8px;
  outline: 0;
  background: rgba(5, 18, 21, 0.66);
  color: var(--ink);
  padding: 8px 10px;
}

input:focus {
  border-color: rgba(233, 180, 93, 0.86);
  box-shadow: 0 0 0 4px rgba(233, 180, 93, 0.14);
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.45rem, 2.2vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 29, 32, 0.86);
  padding: 12px 24px;
  backdrop-filter: blur(18px);
}

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

.brand-lockup img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.nav-link,
.nav-button,
.panel-link,
.secondary-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 240, 232, 0.04);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.nav-button,
.secondary-button {
  background: rgba(246, 240, 232, 0.04);
  color: var(--muted);
}

.nav-link.active,
.nav-link:hover,
.nav-link:focus-visible,
.nav-button:hover,
.nav-button:focus-visible,
.panel-link:hover,
.panel-link:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: rgba(233, 180, 93, 0.72);
  background: rgba(233, 180, 93, 0.1);
  color: var(--ink);
}

.home-shell,
.placeholder-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 22px 40px;
}

.today-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
  margin-bottom: 10px;
}

.today-copy,
.motivation-card,
.panel,
.quick-link,
.placeholder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.024)),
    rgba(9, 31, 35, 0.8);
  box-shadow: var(--shadow);
}

.today-copy {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.date-line {
  margin-bottom: 10px;
  color: #e8efe9;
  font-size: 0.95rem;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  margin: 0;
  border: 1px solid rgba(24, 185, 173, 0.34);
  border-radius: 8px;
  background: rgba(24, 185, 173, 0.1);
  color: #d6f5ef;
  font-size: 0.78rem;
  font-weight: 780;
  line-height: 1.25;
  padding: 4px 9px;
}

.sync-status::before {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(24, 185, 173, 0.14);
  content: "";
  flex: 0 0 auto;
}

.sync-status.waiting {
  border-color: rgba(233, 180, 93, 0.36);
  background: rgba(233, 180, 93, 0.1);
  color: #f3dfbd;
}

.sync-status.waiting::before {
  background: var(--amber);
}

.sync-status.error {
  border-color: rgba(237, 117, 102, 0.38);
  background: rgba(237, 117, 102, 0.1);
  color: #ffd3cc;
}

.sync-status.error::before {
  background: var(--coral);
}

.motivation-card {
  position: relative;
  min-height: 190px;
  margin: 0;
  overflow: hidden;
}

.motivation-card img {
  width: 100%;
  height: 100%;
  min-height: 190px;
  display: block;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.78);
}

.motivation-card::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 29, 32, 0.86), rgba(7, 29, 32, 0.14));
  content: "";
}

.motivation-card figcaption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 1;
}

.motivation-card span,
.quick-link span,
.money-snapshot span,
.rate-lines span,
.weather-day span,
.watch-row span,
.placeholder-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 780;
}

.motivation-card strong {
  display: block;
  margin-top: 4px;
  max-width: 360px;
  font-size: 1.25rem;
  line-height: 1.12;
}

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

.quick-link {
  min-height: 76px;
  padding: 13px 14px;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.quick-link:hover,
.quick-link:focus-visible {
  transform: translateY(-1px);
}

.quick-link strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  line-height: 1.15;
}

.accounting-link {
  border-color: rgba(233, 180, 93, 0.34);
}

.task-link {
  border-color: rgba(109, 185, 255, 0.34);
}

.fitness-link {
  border-color: rgba(24, 185, 173, 0.34);
}

.contact-link {
  border-color: rgba(167, 139, 250, 0.34);
}

.home-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 0.85fr 1fr;
  grid-auto-flow: dense;
  gap: 10px;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.weather-panel,
.accounting-panel {
  grid-column: span 2;
}

.chess-panel {
  grid-row: span 2;
}

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

.metric {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(1.3rem, 2.1vw, 1.95rem);
  line-height: 1;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.38;
}

.inline-form,
.town-form {
  display: grid;
  gap: 8px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 12px;
}

.town-form {
  grid-template-columns: 118px auto;
}

.positive-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: #b8f3dd;
  font-size: 0.78rem;
  font-weight: 760;
}

.weather-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.weather-day {
  min-height: 92px;
  border: 1px solid rgba(246, 240, 232, 0.11);
  border-radius: 8px;
  background: rgba(5, 18, 21, 0.38);
  padding: 12px;
}

.weather-day strong {
  display: block;
  margin: 6px 0;
  font-size: 1.35rem;
}

.small-pill,
.status-pill {
  width: fit-content;
  border: 1px solid rgba(246, 240, 232, 0.14);
  border-radius: 999px;
  background: rgba(246, 240, 232, 0.06);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 820;
  padding: 4px 8px;
}

.status-pill.online {
  border-color: rgba(127, 214, 107, 0.45);
  background: rgba(127, 214, 107, 0.12);
  color: #cbffc2;
}

.status-pill.playing {
  border-color: rgba(233, 180, 93, 0.56);
  background: rgba(233, 180, 93, 0.14);
  color: #ffe5ad;
}

.status-pill.recent {
  border-color: rgba(109, 185, 255, 0.45);
  background: rgba(109, 185, 255, 0.12);
  color: #cfe8ff;
}

.rate-lines,
.money-snapshot {
  display: grid;
  gap: 8px;
}

.rate-lines {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rate-lines div,
.money-snapshot div {
  border: 1px solid rgba(246, 240, 232, 0.11);
  border-radius: 8px;
  background: rgba(5, 18, 21, 0.34);
  padding: 11px;
}

.rate-lines strong,
.money-snapshot strong {
  display: block;
  margin-top: 5px;
  font-size: 1.15rem;
  line-height: 1;
}

.rate-panel .muted,
.accounting-panel p {
  margin-top: 9px;
}

.watch-list {
  display: grid;
  gap: 8px;
}

.watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(246, 240, 232, 0.11);
  border-radius: 8px;
  background: rgba(5, 18, 21, 0.34);
  padding: 10px;
  text-decoration: none;
}

.watch-row:hover,
.watch-row:focus-visible {
  border-color: rgba(233, 180, 93, 0.55);
}

.watch-row strong {
  display: block;
  margin-top: 2px;
  font-size: 0.93rem;
}

.daily-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #e3ece6;
  font-size: 0.86rem;
  line-height: 1.35;
}

.placeholder-shell {
  display: grid;
  gap: 10px;
}

.placeholder-card {
  padding: 18px;
}

.placeholder-card strong {
  display: block;
  margin: 7px 0;
  font-size: 1.35rem;
}

.placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

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

@media (max-width: 1120px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chess-panel {
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .app-topbar,
  .today-band,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .app-topbar {
    padding: 12px 14px;
  }

  .section-nav {
    justify-content: flex-start;
  }

  .home-shell,
  .placeholder-shell {
    padding: 14px 12px 28px;
  }

  .today-band,
  .quick-links,
  .home-grid,
  .weather-days,
  .rate-lines,
  .money-snapshot {
    grid-template-columns: 1fr;
  }

  .weather-panel,
  .accounting-panel {
    grid-column: auto;
  }

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

@media (max-width: 520px) {
  .nav-link,
  .nav-button {
    flex: 1 1 auto;
    min-width: 96px;
  }

  .inline-form,
  .town-form {
    grid-template-columns: 1fr;
  }
}
