@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600&family=Montserrat:wght@500&display=swap");
/* FRIDMANS calculator kit — shared tokens and components. Navy band, ivory ground, antique gold accents. */
:root {
  --bg: #F1EDE3; --surface: #FFFFFF; --ink: #0E2438; --muted: #5F6B78; --slate: #7C8794; --line: #DED8CA;
  --navy: #16344F; --band: #16344F; --gold: #BE9E4F; --gold-ink: #8C7032;
  --a: #2C5B82; --b: #B08A2E; --chip: #F6F3EC; --field: #FBFAF6; --good: #2F7A55; --bad: #A4472F;
  --display: "Frank Ruhl Libre", "David", Georgia, serif;
  --word: "Cinzel", Georgia, serif; --tag: "Montserrat", Arial, sans-serif;
  --body: "IBM Plex Sans Hebrew", "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1A2A; --surface: #11253A; --ink: #ECE8DE; --muted: #A3AEBB; --slate: #8E99A6; --line: #233A54;
    --navy: #D9E2EC; --band: #0E2438; --gold: #CDB06A; --gold-ink: #D8BC77;
    --a: #82B1DC; --b: #D8B866; --chip: #162E48; --field: #0E2034; --good: #6FC39A; --bad: #E28A70;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1A2A; --surface: #11253A; --ink: #ECE8DE; --muted: #A3AEBB; --slate: #8E99A6; --line: #233A54;
  --navy: #D9E2EC; --band: #0E2438; --gold: #CDB06A; --gold-ink: #D8BC77;
  --a: #82B1DC; --b: #D8B866; --chip: #162E48; --field: #0E2034; --good: #6FC39A; --bad: #E28A70;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; margin: 0; }
.in { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.band { background: var(--band); color: #F1EDE3; border-bottom: 3px solid var(--gold); position: relative; overflow: hidden; }
/* Chessboard motif from the logo: faded gold squares rising from the left edge of the band. */
.band::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 46%; pointer-events: none; background: conic-gradient(rgba(205,176,106,.22) 25%, transparent 0 50%, rgba(205,176,106,.22) 0 75%, transparent 0) 0 0 / 76px 76px; -webkit-mask-image: linear-gradient(to right, #000, transparent 95%); mask-image: linear-gradient(to right, #000, transparent 95%); }
@media (max-width: 720px) { .band::after { width: 70%; opacity: .55; } }
.band .in { position: relative; z-index: 1; padding-block: 22px 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 14px; direction: ltr; }
.brand .emb { flex: none; width: 54px; height: 54px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(205,176,106,.55); }
.brand .emb img { width: 100%; height: 100%; display: block; }
.word { display: grid; line-height: 1; }
.word b { font-family: var(--word); font-weight: 500; font-size: 27px; letter-spacing: .1em; }
.word small { font-family: var(--tag); font-weight: 500; font-size: 9.5px; letter-spacing: .38em; color: #CDB06A; margin-top: 7px; }
.titles { display: grid; gap: 4px; min-width: 0; }
.titles .eyebrow { color: #BE9E4F; }
.titles h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3.6vw, 32px); text-wrap: balance; line-height: 1.15; }
.titles p { margin: 0; color: #C9CFD6; font-size: 14px; max-width: 62ch; }

main.in { padding-block: 24px 40px; display: grid; gap: 20px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--gold-ink); font-weight: 600; }
h2 { font-family: var(--display); font-size: 19px; margin: 0; color: var(--navy); }
h3 { font-family: var(--display); font-size: 17px; margin: 0; color: var(--navy); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 14px; min-width: 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field > label b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.rangepair { display: grid; grid-template-columns: 1fr 84px; gap: 10px; align-items: center; }
input[type=number], input[type=text], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
textarea { resize: vertical; min-height: 60px; }
input[type=number] { font-variant-numeric: tabular-nums; direction: ltr; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--gold); direction: ltr; }
input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .three { grid-template-columns: 1fr 1fr; } }
.grp { display: grid; gap: 10px; }
.grp .gh { font-size: 11.5px; letter-spacing: .06em; color: var(--gold-ink); font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; padding: 7px 10px; border: 0; background: var(--field); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--surface); font-weight: 600; }
.btn { font: inherit; font-weight: 600; font-size: 14.5px; padding: 9px 18px; border-radius: 7px; border: 1px solid var(--navy); background: var(--navy); color: var(--surface); cursor: pointer; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.alt { background: transparent; color: var(--navy); }
.ghost { justify-self: start; font: inherit; font-size: 12.5px; color: var(--muted); background: none; border: 1px dashed var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.ghost:hover { color: var(--ink); border-color: var(--slate); }

.verdict { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 14px; }
.verdict .head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 999px; background: var(--chip); color: var(--ink); }
.big { font-family: var(--display); font-size: clamp(20px, 3vw, 26px); color: var(--navy); margin: 0; text-wrap: balance; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 3px; min-width: 0; border-top: 3px solid var(--sc, var(--line)); }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 10px; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 16px; height: 3px; vertical-align: middle; margin-inline-start: 6px; border-radius: 2px; }
canvas.chart { width: 100%; display: block; }
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
td:first-child, th:first-child { text-align: right; }
td.cur, th.cur { background: var(--chip); font-weight: 600; }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }

.export { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 12px 16px; align-items: end; border-inline-start: 4px solid var(--gold); }
@media (max-width: 760px) { .export { grid-template-columns: 1fr; } }
.export .msg { grid-column: 1 / -1; font-size: 13px; color: var(--muted); min-height: 1em; margin: 0; }

.ov { position: fixed; inset: 0; z-index: 50; background: rgba(8, 18, 30, .72); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.ov .box { background: var(--surface); color: var(--ink); border-radius: 12px; width: min(760px, 100%); max-height: 100%; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.ov .bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ov .bar .acts { display: flex; gap: 8px; }
.ov .pages { overflow: auto; padding: 18px; display: grid; gap: 16px; background: var(--chip); }
.ov .pages img { width: 100%; height: auto; display: block; box-shadow: 0 2px 10px rgba(0,0,0,.18); background: #fff; }
.ov .note { font-size: 13px; color: var(--muted); margin: 0; flex-basis: 100%; }

footer.foot { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
footer.foot ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
footer.foot .contact { color: var(--ink); font-size: 13px; display: flex; align-items: center; gap: 12px; }
footer.foot .contact img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--gold); flex: none; }
footer.foot .contact > div { display: grid; gap: 1px; }
footer.foot .contact > div > span { color: var(--muted); }
footer.foot .contact b { color: var(--navy); }
footer.foot .sig { font-family: var(--word); letter-spacing: .2em; color: var(--slate); font-size: 12px; direction: ltr; text-align: left; }
.ltr { direction: ltr; unicode-bidi: isolate; }
