:root {
    --ink: #171717;
    --muted: #6d6a64;
    --paper: #fffdf8;
    --accent: #ff4d2e;
    --accent-dark: #dc3218;
    --line: #dfdbd2;
    --soft: #f2eee5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 77, 46, .13), transparent 30%),
        #e9e5dc;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, input { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
    width: min(100%, 680px);
    margin: 0 auto;
    padding: 24px 16px 36px;
}

.hero { margin: 8px 4px 22px; }
.eyebrow, .receipt-tag {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .14em;
}
.hero h1 { margin: 8px 0 5px; font-size: clamp(31px, 8vw, 48px); line-height: 1.08; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }

.panel {
    padding: 24px;
    border: 1px solid rgba(23, 23, 23, .1);
    border-radius: 24px;
    background: var(--paper);
    box-shadow: 0 18px 50px rgba(45, 38, 27, .12);
}
.hidden { display: none !important; }

.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-heading h2, #result-view h2 { margin: 0; font-size: 21px; }
.panel-heading span { color: var(--muted); font-size: 12px; }
.field-grid { display: grid; gap: 20px; margin-top: 24px; }
.field { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.field > span, .field legend { font-size: 14px; font-weight: 800; }

.stepper, .input-with-unit {
    display: flex;
    align-items: center;
    overflow: hidden;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.stepper input, .input-with-unit input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 20px;
    font-weight: 850;
    text-align: center;
}
.input-with-unit input { padding-left: 48px; }
.input-with-unit span { padding-right: 20px; color: var(--muted); }
.unit { color: var(--muted); }
.step-button {
    align-self: stretch;
    width: 58px;
    border: 0;
    background: var(--soft);
    font-size: 24px;
    cursor: pointer;
}
.step-button:active { background: #e4ded2; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented button {
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}
.segmented button.active { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 800; }

.estimate-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 16px;
    padding: 16px;
    border-radius: 16px;
    background: var(--soft);
}
.estimate-card span { color: var(--muted); font-size: 13px; }
.estimate-card strong { font-size: 21px; }

.primary-button, .secondary-button, .danger-button {
    min-height: 52px;
    padding: 13px 18px;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
}
.primary-button { width: 100%; border: 0; background: var(--ink); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.danger-button { border: 0; background: var(--accent); color: white; }
.primary-button:active, .danger-button:active { transform: translateY(1px); }
.privacy-note { margin: 13px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

#running-view { text-align: center; }
.status-line { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(255, 77, 46, .12); animation: pulse 1.2s infinite; }
.paused .live-dot { background: #999; box-shadow: none; animation: none; }
@keyframes pulse { 50% { transform: scale(.75); opacity: .6; } }
.timer { margin-top: 18px; font-variant-numeric: tabular-nums; font-size: 27px; font-weight: 900; letter-spacing: .08em; }
.burn-label { margin: 30px 0 5px; color: var(--muted); }
.money, .result-money {
    color: var(--accent);
    font-size: clamp(49px, 14vw, 78px);
    font-weight: 950;
    line-height: 1;
    letter-spacing: -.055em;
    font-variant-numeric: tabular-nums;
}
.money.bump { animation: bump .22s ease-out; }
@keyframes bump { 50% { transform: scale(1.015); } }
.rate-line { margin: 12px 0 28px; color: var(--muted); font-size: 13px; }
.rate-line strong { color: var(--ink); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; text-align: left; }
.stats-grid div { display: grid; gap: 5px; padding: 15px; border-radius: 14px; background: var(--soft); }
.stats-grid span { color: var(--muted); font-size: 11px; }
.stats-grid strong { font-size: 15px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

#result-view { text-align: center; }
#result-view h2 { margin-top: 8px; }
.result-money { margin-top: 25px; }
.result-joke { margin: 15px auto 24px; color: var(--muted); font-weight: 700; }
.receipt-list { margin: 0; border-top: 1px dashed var(--line); }
.receipt-list div { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px dashed var(--line); }
.receipt-list dt { color: var(--muted); }
.receipt-list dd { margin: 0; font-weight: 850; }

footer { padding: 24px 0 0; color: #827e76; font-size: 12px; text-align: center; }

@media (min-width: 600px) {
    .app-shell { padding-top: 46px; }
    .panel { padding: 34px; }
    .field-grid { grid-template-columns: 1fr 1fr; }
    .field:last-child { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
    .app-shell { padding: 14px 12px 28px; }
    .hero { margin-bottom: 16px; }
    .panel { padding: 20px 17px; border-radius: 20px; }
    .field-grid { gap: 16px; margin-top: 19px; }
    .stats-grid div { padding: 12px; }
    .stacked-mobile { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
