:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: #111111;
  --surface-soft: #171614;
  --surface-raised: #1d1b17;
  --gold: #e7bd62;
  --gold-bright: #f4d88f;
  --gold-muted: #b88e3e;
  --text: #f5f2ea;
  --muted: #a49d8e;
  --line: rgba(231, 189, 98, .15);
  --danger: #e9a7a0;
  --radius-xl: 28px;
  --radius-lg: 18px;
  font-family: Tahoma, Arial, sans-serif;
  background: var(--bg);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -20%, rgba(157, 112, 35, .14), transparent 52%),
    linear-gradient(150deg, #080808 0%, #0c0c0b 55%, #090909 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.ambient { position: fixed; z-index: 0; pointer-events: none; border-radius: 999px; filter: blur(90px); opacity: .12; }
.ambient-one { width: 260px; height: 260px; background: #bd8c2f; right: -170px; top: 30%; }
.ambient-two { width: 220px; height: 220px; background: #7b5a24; left: -150px; top: 70%; }
.app-shell { position: relative; z-index: 1; width: min(100% - 36px, 820px); margin: 0 auto; padding: 28px 0 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 11px; align-items: center; text-decoration: none; color: inherit; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: linear-gradient(145deg, #f0d18b, #b9852e); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 7px 24px rgba(192,137,42,.16); }
.brand-mark svg { width: 30px; height: 30px; fill: #201707; }
.brand-mark .mark-shine { fill: #f9e8b7; opacity: .82; }
.brand-copy { display: flex; flex-direction: column; gap: 4px; }
.brand-copy strong { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.install-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 13px; min-height: 42px; border: 1px solid rgba(231,189,98,.26); border-radius: 14px; color: var(--gold-bright); background: rgba(231,189,98,.06); cursor: pointer; font-size: 11px; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.install-button:hover { background: rgba(231,189,98,.12); border-color: rgba(231,189,98,.48); }
.install-button:active { transform: translateY(1px); }
.install-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.intro { padding: 58px 8px 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--gold); font-size: 11px; letter-spacing: .1px; margin-bottom: 18px; }
.eyebrow-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px rgba(231,189,98,.7); }
h1 { margin: 0; font-size: clamp(31px, 6vw, 49px); line-height: 1.4; letter-spacing: -1.6px; font-weight: 800; }
h1 span { color: var(--gold-bright); }
.intro p { max-width: 530px; margin: 13px 0 0; color: #aaa398; font-size: 13px; line-height: 2; }
.calculator-panel { border: 1px solid rgba(231,189,98,.14); background: linear-gradient(145deg, rgba(23,22,19,.97), rgba(15,15,14,.98)); border-radius: var(--radius-xl); padding: 28px; box-shadow: 0 20px 75px rgba(0,0,0,.27), inset 0 1px 0 rgba(255,255,255,.025); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 25px; }
.section-kicker { font-size: 10px; color: var(--gold-muted); display: block; margin-bottom: 7px; }
.panel-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.4px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; color: #b9b2a4; border: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.025); border-radius: 999px; padding: 8px 10px; white-space: nowrap; }
.live-badge span { width: 6px; height: 6px; display: inline-block; background: #a4c887; border-radius: 50%; box-shadow: 0 0 9px rgba(164,200,135,.4); }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 15px; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 9px; }
.field-wide { grid-column: 1 / -1; }
.field-label { color: #d9d3c7; font-size: 12px; font-weight: 700; }
.input-wrap { position: relative; display: block; }
.input-wrap input { width: 100%; min-width: 0; height: 57px; padding: 0 15px 0 67px; color: var(--text); background: #0b0b0a; border: 1px solid #302d26; border-radius: 14px; outline: none; text-align: right; direction: ltr; font-size: 17px; font-weight: 700; letter-spacing: .2px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.input-wrap input::placeholder { color: #59564e; font-size: 14px; font-weight: 400; opacity: 1; }
.input-wrap input:focus { border-color: rgba(231,189,98,.78); background: #0d0c0a; box-shadow: 0 0 0 3px rgba(231,189,98,.08); }
.input-suffix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--gold-muted); font-size: 11px; pointer-events: none; padding-right: 11px; border-right: 1px solid rgba(231,189,98,.18); }
.percent-suffix { font-size: 16px; }
.field-hint { color: #777166; font-size: 10px; line-height: 1.8; }
.formula-strip { display: flex; align-items: center; gap: 11px; padding: 13px 14px; margin-top: 23px; border: 1px solid rgba(231,189,98,.1); border-radius: 14px; background: rgba(231,189,98,.035); }
.formula-icon { flex: 0 0 auto; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: rgba(231,189,98,.12); color: var(--gold-bright); direction: ltr; font-weight: 700; font-size: 12px; }
.formula-strip p { margin: 0; color: #bcb4a4; font-size: 11px; line-height: 1.8; }
.result-card { margin-top: 20px; position: relative; overflow: hidden; padding: 22px 22px 18px; border: 1px solid rgba(244,216,143,.3); border-radius: 20px; background: radial-gradient(ellipse at 90% -10%, rgba(231,189,98,.16), transparent 48%), linear-gradient(120deg, #211b0f 0%, #17140f 48%, #191610 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 12px 34px rgba(0,0,0,.16); }
.result-card::after { content: ""; position: absolute; left: -65px; bottom: -120px; width: 240px; height: 240px; border: 1px solid rgba(231,189,98,.07); border-radius: 50%; box-shadow: 0 0 0 22px rgba(231,189,98,.018), 0 0 0 48px rgba(231,189,98,.014); pointer-events: none; }
.result-topline { display: flex; align-items: center; justify-content: space-between; color: #d5c8a9; font-size: 12px; position: relative; z-index: 1; }
.result-spark { color: var(--gold-bright); font-size: 18px; }
.result-value-row { display: flex; align-items: baseline; gap: 9px; direction: ltr; justify-content: flex-end; margin-top: 16px; position: relative; z-index: 1; }
.result-value-row strong { font-size: clamp(30px, 7vw, 43px); line-height: 1.2; letter-spacing: -1px; color: #ffdf91; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.result-value-row > span { color: #bba36d; font-size: 12px; white-space: nowrap; }
.result-message { min-height: 19px; color: #94876b; font-size: 10px; margin-top: 7px; line-height: 1.8; position: relative; z-index: 1; }
.result-message.error { color: var(--danger); }
.result-divider { height: 1px; margin: 19px 0 16px; background: linear-gradient(90deg, transparent, rgba(231,189,98,.2), transparent); position: relative; z-index: 1; }
.result-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; position: relative; z-index: 1; }
.result-detail { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.result-detail + .result-detail { border-right: 1px solid rgba(231,189,98,.12); padding-right: 13px; }
.result-detail > span { color: #938873; font-size: 10px; line-height: 1.7; }
.result-detail strong { color: #e9d6a8; font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-detail strong small { color: #99895f; font-size: 9px; font-weight: 400; }
.actions-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; }
.autosave-note { display: inline-flex; align-items: center; gap: 7px; color: #706c61; font-size: 10px; line-height: 1.7; }
.save-dot { flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: #7d9a64; }
.reset-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; color: #a99f8a; background: transparent; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; cursor: pointer; font-size: 10px; white-space: nowrap; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.reset-button:hover { color: #ead8b1; border-color: rgba(231,189,98,.25); background: rgba(231,189,98,.035); }
.reset-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.footer { text-align: center; padding: 33px 0 0; }
.footer-line { display: block; width: 46px; height: 1px; margin: 0 auto 16px; background: linear-gradient(90deg, transparent, #a17d3e, transparent); }
.footer p { color: #8f8778; font-size: 11px; margin: 0 0 8px; }
.footer p span { color: var(--gold-muted); padding: 0 4px; }
.footer small { color: #625e55; font-size: 9px; line-height: 1.8; display: block; }
.install-dialog { width: min( calc(100% - 32px), 390px); padding: 0; border: 1px solid rgba(231,189,98,.3); border-radius: 22px; color: var(--text); background: #171511; box-shadow: 0 25px 90px rgba(0,0,0,.7); }
.install-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.install-dialog form { padding: 28px; position: relative; text-align: center; }
.dialog-close { position: absolute; top: 12px; left: 13px; border: 0; background: none; color: #b5a990; font-size: 25px; cursor: pointer; }
.dialog-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 4px auto 17px; border: 1px solid rgba(231,189,98,.25); color: var(--gold-bright); background: rgba(231,189,98,.08); border-radius: 16px; font-size: 25px; }
.install-dialog h2 { font-size: 17px; margin: 0 0 12px; }
.install-dialog p { color: #a9a08f; font-size: 12px; line-height: 2; margin: 0 0 20px; }
.dialog-confirm { width: 100%; padding: 12px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #f0d18b, #bd8a35); color: #211707; font-weight: 700; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
@media (min-width: 700px) { .app-shell { padding-top: 32px; } .intro { padding-top: 66px; padding-bottom: 32px; } }
@media (max-width: 520px) {
  .app-shell { width: min(100% - 24px, 480px); padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 14px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small { font-size: 9px; }
  .install-button { padding: 9px 10px; min-height: 40px; gap: 5px; font-size: 10px; }
  .install-button svg { width: 15px; height: 15px; }
  .intro { padding: 41px 3px 22px; }
  h1 { font-size: clamp(30px, 8.5vw, 41px); letter-spacing: -1px; line-height: 1.42; }
  .intro p { margin-top: 10px; font-size: 11px; line-height: 2; }
  .calculator-panel { padding: 20px 15px 17px; border-radius: 23px; }
  .panel-heading { margin-bottom: 21px; }
  .panel-heading h2 { font-size: 18px; }
  .live-badge { font-size: 9px; padding: 7px 8px; }
  .fields-grid { gap: 17px 10px; }
  .field-label { font-size: 11px; }
  .input-wrap input { height: 53px; padding-left: 58px; padding-right: 10px; border-radius: 12px; font-size: 15px; }
  .input-wrap input::placeholder { font-size: 12px; }
  .input-suffix { left: 9px; padding-right: 7px; font-size: 10px; }
  .field-hint { font-size: 9px; }
  .formula-strip { margin-top: 20px; padding: 11px; gap: 9px; }
  .formula-strip p { font-size: 10px; }
  .result-card { padding: 18px 15px 15px; border-radius: 17px; }
  .result-value-row { margin-top: 14px; }
  .result-value-row strong { font-size: clamp(26px, 7.8vw, 37px); }
  .result-details { gap: 9px; }
  .result-detail + .result-detail { padding-right: 9px; }
  .result-detail > span { font-size: 9px; }
  .result-detail strong { font-size: 11px; }
  .result-detail strong small { font-size: 8px; }
  .actions-row { align-items: flex-start; }
  .autosave-note { max-width: 52%; font-size: 9px; }
  .reset-button { padding: 8px; gap: 5px; font-size: 9px; }
  .footer { padding-top: 25px; }
}
@media (max-width: 360px) {
  .install-button span { max-width: 94px; white-space: normal; line-height: 1.5; }
  .brand { gap: 8px; }
  .brand-mark { width: 39px; height: 39px; }
  .fields-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .result-details { grid-template-columns: 1fr; gap: 10px; }
  .result-detail { flex-direction: row; align-items: center; justify-content: space-between; }
  .result-detail + .result-detail { border-right: 0; padding-right: 0; border-top: 1px solid rgba(231,189,98,.1); padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
