:root {
  --bg: #070708;
  --panel: #111116;
  --panel-2: #15151c;
  --line: rgba(230, 184, 86, 0.18);
  --line-strong: rgba(230, 184, 86, 0.36);
  --gold: #e4b654;
  --gold-bright: #ffd760;
  --gold-deep: #9e7428;
  --text: #f3efe7;
  --muted: #a69984;
  --quiet: #6e6456;
  --green: #52d484;
  --blue: #87b7ff;
  --red: #ff766a;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 5%, rgba(230, 184, 86, 0.1), transparent 31rem),
    radial-gradient(circle at 12% 78%, rgba(82, 212, 132, 0.06), transparent 24rem),
    linear-gradient(160deg, #050505, #0b0b0f 52%, #070707);
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: linear-gradient(rgba(255,255,255,0.8) 1px, transparent 1px);
  background-size: 100% 6px;
  z-index: 1;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ambientCanvas {
  z-index: 0;
}

#coinCanvas {
  z-index: 3;
}

.shell {
  position: relative;
  z-index: 2;
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 2rem 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.8rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kicker,
.section-label,
.metric-card span,
.footer-line span,
.field span {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
.amount,
.count-num,
.metric-card strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

h1 {
  margin: 0.25rem 0 0;
  color: var(--gold);
  font-size: 1.15rem;
  letter-spacing: 0.18em;
}

.icon-button {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: rgba(17, 17, 22, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: rgba(230, 184, 86, 0.1);
}

.icon-button svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero {
  text-align: center;
  padding-top: 0.8rem;
}

.section-label {
  margin-bottom: 0.8rem;
}

.amount-wrap {
  position: relative;
  display: inline-grid;
  justify-items: center;
  gap: 0.7rem;
}

.amount-wrap::before {
  content: "";
  position: absolute;
  inset: -2.5rem -4rem;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 215, 96, 0.14), transparent 66%);
  filter: blur(2px);
  z-index: -1;
}

.amount-wrap::after {
  content: "";
  position: absolute;
  width: 110%;
  height: 120%;
  border: 1px solid rgba(230, 184, 86, 0.1);
  border-radius: 50%;
  animation: slow-ring 4s ease-out infinite;
  z-index: -1;
}

@keyframes slow-ring {
  from {
    opacity: 0.9;
    transform: scale(0.92);
  }
  to {
    opacity: 0;
    transform: scale(1.24);
  }
}

.amount {
  color: var(--gold-bright);
  font-size: clamp(2.6rem, 10vw, 4.75rem);
  font-weight: 900;
  line-height: 0.95;
  text-shadow: 0 0 30px rgba(255, 215, 96, 0.2);
  font-variant-numeric: tabular-nums;
}

.currency {
  margin-right: 0.12em;
  color: var(--gold);
  font-size: 0.45em;
  vertical-align: super;
}

.cents {
  color: rgba(255, 215, 96, 0.62);
  font-size: 0.42em;
}

.tick {
  animation: tick 300ms ease;
}

@keyframes tick {
  50% {
    transform: translateY(-2px);
    opacity: 0.78;
  }
}

.status-pill {
  min-height: 1.55rem;
  padding: 0.28rem 0.72rem;
  color: var(--gold);
  border: 1px solid var(--line-strong);
  border-radius: 0.35rem;
  background: rgba(230, 184, 86, 0.08);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.status-pill.working {
  color: var(--green);
  border-color: rgba(82, 212, 132, 0.36);
  background: rgba(82, 212, 132, 0.1);
}

.status-pill.resting {
  color: var(--blue);
  border-color: rgba(135, 183, 255, 0.3);
  background: rgba(135, 183, 255, 0.08);
}

.divider {
  width: min(100%, 480px);
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  position: relative;
}

.divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 0.08rem;
}

.countdown {
  text-align: center;
}

.countdown-grid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.45rem;
  min-height: 4.15rem;
}

.count-unit {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.count-num {
  min-width: 3.2rem;
  padding: 0.48rem 0.55rem;
  color: var(--text);
  background: rgba(17, 17, 22, 0.9);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.count-text {
  color: var(--muted);
  font-size: 0.66rem;
}

.count-sep {
  margin-top: 0.54rem;
  color: var(--gold);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.payday-message {
  color: var(--gold-bright);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 1.35rem;
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric-card {
  min-height: 4.25rem;
  padding: 0.8rem 0.9rem;
  background: rgba(17, 17, 22, 0.82);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  display: grid;
  align-content: center;
  gap: 0.45rem;
}

.metric-card.accent {
  border-color: var(--line-strong);
}

.metric-card.wide {
  grid-column: 1 / -1;
  text-align: center;
}

.metric-card strong {
  color: var(--text);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.metric-card.accent strong,
.metric-card.wide strong {
  color: var(--gold-bright);
}

.metric-card small {
  color: var(--quiet);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
}

.footer-line {
  margin-top: 0.6rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-line p {
  margin: 0 0 0.45rem;
  color: var(--gold-bright);
  font-size: 0.95rem;
  font-weight: 700;
}

.footer-line em {
  color: var(--gold);
  font-style: normal;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.settings-panel {
  width: min(100%, 430px);
  padding: 2rem;
  background: linear-gradient(180deg, rgba(21, 21, 28, 0.98), rgba(13, 13, 17, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.55);
}

.settings-panel h2 {
  margin: 0 0 1.6rem;
  color: var(--gold);
  text-align: center;
  font-size: 0.98rem;
  letter-spacing: 0.16em;
}

.field {
  display: grid;
  gap: 0.48rem;
  margin-bottom: 1.2rem;
}

.settings-panel .field > span {
  font-size: 0.88rem;
  letter-spacing: 0.1em;
}

.field input,
.field select {
  width: 100%;
  height: 3rem;
  padding: 0 0.85rem;
  color: var(--text);
  background: #08080a;
  border: 1px solid var(--line);
  border-radius: 0.42rem;
  outline: none;
  font: 700 1rem ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(230, 184, 86, 0.13);
}

.field input:disabled {
  color: var(--quiet);
  background: rgba(8, 8, 10, 0.42);
  border-color: rgba(230, 184, 86, 0.08);
  cursor: not-allowed;
  opacity: 0.62;
}

.field small {
  color: var(--quiet);
  font-size: 0.72rem;
  line-height: 1.6;
}

.time-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: -0.15rem 0 1rem;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.check-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.error {
  display: none;
  color: var(--red);
  font-size: 0.72rem;
  font-style: normal;
}

.error.show {
  display: block;
}

.standalone {
  margin: -0.6rem 0 1.1rem;
}

.save-button {
  width: 100%;
  height: 3.1rem;
  border: 0;
  border-radius: 0.48rem;
  color: #161109;
  background: linear-gradient(135deg, #d7a73d, #ffdf74);
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
}

@media (max-width: 520px) {
  .shell {
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0.9rem 1.15rem;
  }

  h1 {
    font-size: 0.95rem;
  }

  .kicker,
  .section-label,
  .metric-card span,
  .footer-line span,
  .field span {
    font-size: 0.62rem;
  }

  .settings-panel .field > span {
    font-size: 0.82rem;
  }

  .amount {
    font-size: clamp(2.35rem, 13vw, 3.1rem);
  }

  .countdown-grid {
    gap: 0.22rem;
    min-height: 3.6rem;
  }

  .count-num {
    min-width: 2.35rem;
    padding: 0.34rem 0.35rem;
    font-size: 1rem;
  }

  .count-sep {
    margin-top: 0.42rem;
  }

  .metrics {
    gap: 0.5rem;
  }

  .metric-card {
    min-height: 3.8rem;
    padding: 0.65rem 0.7rem;
  }

  .metric-card strong {
    font-size: 0.9rem;
  }

  .footer-line {
    padding-top: 0.85rem;
  }

  .footer-line p {
    font-size: 0.82rem;
  }

  .settings-panel {
    padding: 1.45rem 1.1rem;
  }

  .time-row {
    gap: 0.65rem;
  }
}
