:root {
  color-scheme: dark;
  --ink: #f4f0e6;
  --muted: #a8b2ad;
  --soft: #151a18;
  --paper: #0e1211;
  --panel: #171d1b;
  --panel-strong: #1f2724;
  --line: #34403b;
  --green: #69c19c;
  --blue: #78b6df;
  --red: #ef8c7f;
  --gold: #e4ad5f;
  --focus: #f7d98a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(105, 193, 156, 0.14), transparent 340px),
    linear-gradient(180deg, rgba(120, 182, 223, 0.08), transparent 320px),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.kkr-logo {
  flex: 0 0 auto;
  width: clamp(88px, 13vw, 132px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.42));
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.tagline {
  margin: 12px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 1rem;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 27, 0.82);
}

.tab-button,
.chip,
.quiet-button,
.ghost-button,
.primary-button,
.danger-button,
.result-grid button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 750;
}

.tab-button {
  padding: 0 14px;
}

.tab-button.active {
  border-color: var(--green);
  background: #21483b;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workband {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.flow-panel,
.insight-panel,
.timer-band,
.result-band,
.analysis-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 27, 0.95);
  box-shadow: var(--shadow);
}

.flow-panel {
  padding: clamp(20px, 4vw, 36px);
}

.flow-header,
.section-heading,
.timer-band {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.step-pill {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
}

.progress-track {
  height: 10px;
  margin: 24px 0 30px;
  overflow: hidden;
  border-radius: 999px;
  background: #26312d;
}

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

.form-step {
  display: none;
  min-height: 270px;
}

.form-step.active {
  display: block;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.1;
  font-weight: 850;
}

.secondary-label {
  margin-top: 22px;
}

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

input,
select {
  height: 54px;
  padding: 0 14px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 22px,
    calc(100% - 14px) 22px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 42px;
}

select option {
  background: #111614;
  color: var(--ink);
}

select:invalid {
  color: var(--muted);
}

select option[value=""] {
  color: var(--muted);
}

textarea {
  min-height: 112px;
  padding: 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(23, 32, 27, 0.14);
  box-shadow: 0 0 0 3px rgba(247, 217, 138, 0.18);
}

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

.chip {
  padding: 0 12px;
  color: var(--blue);
}

.inline-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-input span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 850;
}

.flow-actions,
.timer-actions,
.history-actions,
.roundup-actions,
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.quiet-button,
.danger-button {
  padding: 0 16px;
}

.primary-button {
  border-color: var(--green);
  background: #275b49;
  color: var(--ink);
}

.ghost-button {
  background: transparent;
}

.quiet-button {
  background: var(--panel-strong);
  color: var(--blue);
}

.danger-button {
  border-color: rgba(154, 61, 53, 0.35);
  background: rgba(239, 140, 127, 0.12);
  color: var(--red);
}

.hidden {
  display: none !important;
}

.insight-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
}

.live-costs {
  display: grid;
  gap: 12px;
  margin: 0;
}

.live-costs div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.live-costs dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.live-costs dd {
  margin: 3px 0 0;
  font-size: 1.6rem;
  font-weight: 900;
}

.interruption-line {
  margin: auto 0 0;
  color: var(--green);
  font-size: 1.18rem;
  font-weight: 850;
  line-height: 1.28;
}

.timer-band,
.result-band,
.support-band {
  margin-top: 18px;
  padding: clamp(20px, 4vw, 32px);
}

.timer-face {
  flex: 0 0 auto;
  min-width: 190px;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.result-band h2 {
  margin-bottom: 10px;
}

.result-context {
  margin: 0 0 18px;
  max-width: 760px;
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.result-grid button {
  min-height: 66px;
  padding: 10px;
}

.result-reset {
  margin-top: 12px;
}

.support-band,
.roundup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 27, 0.95);
  box-shadow: var(--shadow);
}

.support-band h2 {
  margin-bottom: 10px;
}

.support-band p {
  max-width: 780px;
  color: var(--muted);
  line-height: 1.45;
}

.roundup-choice {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.roundup-choice p {
  margin: 0 0 12px;
  color: var(--ink);
  font-weight: 850;
}

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

.support-actions {
  margin-top: 18px;
}

.custom-roundup {
  display: grid;
  grid-template-columns: minmax(140px, 220px) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.custom-roundup label {
  grid-column: 1 / -1;
  margin-bottom: 0;
  font-size: 1rem;
}

.delay-note {
  flex: 1 1 260px;
  margin: 0 auto 0 0;
  color: var(--green);
  font-weight: 850;
  line-height: 1.3;
}

.result-grid button:hover,
.chip:hover,
.quiet-button:hover,
.ghost-button:hover {
  border-color: var(--blue);
}

.section-heading {
  margin: 8px 0 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 124px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 750;
}

.stat-card strong {
  display: block;
  color: var(--green);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.analysis-block {
  min-height: 132px;
  padding: 18px;
}

.analysis-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.roundup-status {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 850;
}

.roundup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
}

.roundup-card {
  padding: 18px;
}

.roundup-card h3 {
  font-size: 1.2rem;
}

.muted-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.roundup-submit {
  margin-top: 14px;
}

.daily-costs {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.daily-costs div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.daily-costs dt {
  color: var(--muted);
}

.daily-costs dd {
  margin: 3px 0 0;
  color: var(--green);
  font-size: 1.8rem;
  font-weight: 950;
}

.appreciation-line {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 850;
  line-height: 1.35;
}

.roundup-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.roundup-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.roundup-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.history-item h3 {
  margin: 0 0 7px;
  font-size: 1.1rem;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.history-result {
  align-self: start;
  min-width: 110px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(105, 193, 156, 0.14);
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 850;
  text-align: center;
}

.history-result.followed {
  background: rgba(239, 140, 127, 0.14);
  color: var(--red);
}

.empty-state {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(23, 29, 27, 0.74);
}

@media (max-width: 900px) {
  .topbar,
  .workband,
  .flow-header,
  .section-heading,
  .timer-band {
    display: grid;
  }

  .workband,
  .stats-grid,
  .analysis-grid,
  .roundup-layout {
    grid-template-columns: 1fr;
  }

  .view-tabs,
  .flow-actions,
  .timer-actions,
  .history-actions,
  .roundup-actions,
  .support-actions {
    justify-content: stretch;
  }

  .tab-button,
  .flow-actions button,
  .timer-actions button,
  .history-actions button,
  .roundup-actions button,
  .support-actions button {
    flex: 1 1 auto;
  }

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

  .timer-face {
    text-align: left;
  }

  .kkr-logo {
    width: 76px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 16px;
  }

  .brand-lockup {
    gap: 12px;
  }

  .kkr-logo {
    width: 58px;
  }

  h1 {
    font-size: 2rem;
    line-height: 1;
  }

  h2 {
    font-size: 1.78rem;
  }

  .tagline {
    margin-top: 7px;
    font-size: 0.92rem;
  }

  .flow-panel {
    padding: 18px;
  }

  .flow-header {
    gap: 12px;
  }

  .step-pill {
    padding: 8px 10px;
  }

  .progress-track {
    height: 8px;
    margin: 14px 0 18px;
  }

  .form-step {
    min-height: 188px;
  }

  label {
    margin-bottom: 10px;
    font-size: 1.32rem;
  }

  .view-tabs,
  .chips,
  .flow-actions,
  .timer-actions,
  .history-actions,
  .roundup-actions,
  .support-actions,
  .custom-roundup {
    display: grid;
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

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