:root {
  --paper: #fcfbf8;
  --ink: #141923;
  --muted: #68707c;
  --gold: #9b7216;
  --gold-line: #ddbf69;
  --gold-soft: #fff4cf;
  --line: #e8e5df;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Manrope", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }

.risk-page { width: min(calc(100% - 36px), 632px); margin: 0 auto; padding: 65px 0 48px; }
.risk-header { text-align: center; }
.risk-header > p { margin: 0 0 16px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .42em; text-transform: uppercase; }
.risk-header h1 { margin: 0; font-family: "Cormorant Garamond", serif; font-size: clamp(2.8rem, 5vw, 3.55rem); font-weight: 600; line-height: .98; letter-spacing: -.025em; white-space: nowrap; }
.risk-header > span { display: block; margin-top: 20px; color: var(--muted); font-size: 15px; }
.risk-header::after { display: block; width: 96px; height: 1px; margin: 28px auto 32px; background: linear-gradient(90deg, transparent, var(--gold-line), transparent); content: ""; }

.calculator-card { padding: 32px; border: 1px solid #eee7cf; border-radius: 19px; background: rgba(255,255,255,.48); box-shadow: 0 9px 27px rgba(49,43,28,.055); }
.instrument-switch { display: flex; justify-content: center; gap: 12px; }
.instrument-button { width: 140px; min-height: 70px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.55); cursor: pointer; }
.instrument-button strong, .instrument-button span { display: block; }
.instrument-button strong { font-size: 15px; font-weight: 700; }
.instrument-button span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.instrument-button.active { border-color: #d7a72c; background: var(--gold-soft); box-shadow: 0 5px 15px rgba(190,144,28,.1); }

.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 24px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.6); }
.mode-button { min-height: 39px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #606774; cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: .025em; text-transform: uppercase; }
.mode-button.active { background: var(--gold-soft); color: #87620b; box-shadow: 0 2px 0 #d2a834; }

.calculator-form { display: grid; gap: 17px; margin-top: 28px; }
.field label { display: block; margin: 0 0 8px; color: #58606c; font-size: 11px; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; }
.field input { width: 100%; min-height: 54px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: rgba(255,255,255,.72); color: var(--ink); font-size: 17px; font-weight: 600; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: #c9a54c; box-shadow: 0 0 0 3px rgba(206,166,68,.13); }
.money-input { position: relative; }
.money-input span { position: absolute; top: 50%; left: 16px; z-index: 1; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.money-input input { padding-left: 32px; }

.result-panel { display: block; margin-top: 28px; padding: 27px 24px 25px; border: 1px solid #eee1b9; border-radius: 12px; background: linear-gradient(135deg, #fffaf0, #fff6dc); text-align: center; }
.result-panel .result-label { margin: 0; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; }
.result-panel .result-value { display: block; margin-top: 6px; font-size: clamp(2.55rem, 9vw, 3.6rem); font-weight: 700; line-height: 1; letter-spacing: -.035em; }
.result-panel .result-detail { margin: 12px 0 0; color: #78808a; font-size: 12px; line-height: 1.55; }
.result-panel .result-note { margin: 7px auto 0; max-width: 430px; color: #8c7850; font-size: 10px; line-height: 1.5; }

.quick-reference { margin-top: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.4); }
.quick-reference h2 { margin: 0 0 20px; color: #606875; font-size: 10px; font-weight: 600; letter-spacing: .28em; text-align: center; text-transform: uppercase; }
.reference-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.reference-grid article { padding: 14px 16px 16px; border: 1px solid #efede8; border-radius: 8px; }
.reference-grid h3 { margin: 0 0 11px; color: var(--gold); font-size: 12px; text-align: center; }
.reference-grid dl { margin: 0; }
.reference-grid dl div { display: flex; justify-content: space-between; gap: 18px; padding: 3px 0; color: #5f6670; font-size: 10px; }
.reference-grid dt, .reference-grid dd { margin: 0; }

.risk-footer { padding: 26px 20px 0; color: #9a9da2; text-align: center; }
.risk-footer p { margin: 0 auto; max-width: 560px; font-size: 9px; line-height: 1.75; }
.risk-footer strong { display: block; margin-top: 24px; color: #ccb974; font-size: 9px; letter-spacing: .38em; text-transform: uppercase; }

@media (max-width: 620px) {
  .risk-page { width: min(calc(100% - 24px), 520px); padding-top: 39px; }
  .risk-header > p { font-size: 9px; }
  .risk-header h1 { white-space: normal; }
  .risk-header > span { font-size: 13px; }
  .calculator-card { padding: 18px 14px; border-radius: 15px; }
  .instrument-button { width: min(42vw, 140px); }
  .mode-button { min-height: 46px; padding: 7px 4px; font-size: 9px; line-height: 1.25; }
  .reference-grid { grid-template-columns: 1fr; }
}
