:root {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --background-top: #222337;
  --background-bottom: #080b0e;
  --foreground: #fff;
  --accent: #77ffdf;
  --wheel-accent: #7dd7c8;
  --key-background: #303044;
  --key-foreground: #918fa8;
  --selection: #ffffff1c;
  --sheet: #242424;
  --group: #363636;
  --secondary: #aaa9af;
  --separator: #ffffff14;
  --glass: #24253780;
  --app-inset-top: max(env(safe-area-inset-top,0px),16px);
  --app-inset-bottom: max(8px,calc(env(safe-area-inset-bottom,0px) - 20px));
  --sheet-inset-top: max(env(safe-area-inset-top,0px),16px);
  color-scheme: dark;
  color: var(--foreground);
  background: var(--background-bottom);
}
:root[data-appearance="light"] {
  --background-top: #fff;
  --background-bottom: #fff;
  --foreground: #050505;
  --accent: #1d7564;
  --wheel-accent: #307768;
  --key-background: #dedede;
  --key-foreground: #8f8ca6;
  --selection: #e8e8eb;
  --sheet: #edecf2;
  --group: #fff;
  --secondary: #68676e;
  --separator: #00000019;
  --glass: #ffffff8c;
  color-scheme: light;
}
:root[data-theme="forest"] { --background-top:#30434b; --background-bottom:#162026; --foreground:#d0d7cb; --accent:#8aaf91; --wheel-accent:#8aaf91; --key-background:#3c5052; --key-foreground:#cad4c8; }
:root[data-theme="sky"] { --background-top:#194d79; --background-bottom:#0d233c; --foreground:#f0d1b4; --accent:#e8a58e; --wheel-accent:#e8a58e; --key-background:#294866; --key-foreground:#ecd1bb; }
:root[data-theme="ocean"] { --background-top:#2a535c; --background-bottom:#15363d; --foreground:#e5b78c; --accent:#f5ebdf; --wheel-accent:#f5ebdf; --key-background:#34616a; --key-foreground:#e5b78c; }
:root[data-theme="sunset"] { --background-top:#515c7e; --background-bottom:#272e47; --foreground:#e7b297; --accent:#da7786; --wheel-accent:#da7786; --key-background:#62617b; --key-foreground:#edb89e; }
:root[data-theme="autumn"] { --background-top:#54292c; --background-bottom:#2c151c; --foreground:#f1d79a; --accent:#b65f4d; --wheel-accent:#dc957e; --key-background:#6e3b39; --key-foreground:#edcd9c; }
:root[data-theme="winter"] { --background-top:#102d46; --background-bottom:#081b2c; --foreground:#dfd2c7; --accent:#c5d2d6; --wheel-accent:#c5d2d6; --key-background:#25455b; --key-foreground:#dfd2c7; }
:root[data-theme="mardi-gras"] { --background-top:#242424; --background-bottom:#111; --foreground:#f0db49; --accent:#f5f5f5; --wheel-accent:#f0db49; --key-background:#3a3a3a; --key-foreground:#f0db49; }
:root[data-appearance="light"][data-theme="forest"] { --background-top:#ced6ca; --background-bottom:#ced6ca; --foreground:#527b70; --accent:#30434b; --wheel-accent:#30434b; --key-background:#b8c6b8; --key-foreground:#527b70; }
:root[data-appearance="light"][data-theme="sky"] { --background-top:#99afe0; --background-bottom:#efb197; --foreground:#0e2941; --accent:#1c4e7a; --wheel-accent:#1c4e7a; --key-background:#ffffff5e; --key-foreground:#244c70; }
:root[data-appearance="light"][data-theme="ocean"] { --background-top:#f5ece1; --background-bottom:#f5ece1; --foreground:#22a789; --accent:#2a535c; --wheel-accent:#2a535c; --key-background:#dce3d7; --key-foreground:#438378; }
:root[data-appearance="light"][data-theme="sunset"] { --background-top:#e4b497; --background-bottom:#d77986; --foreground:#685b77; --accent:#405f7e; --wheel-accent:#405f7e; --key-background:#ffffff48; --key-foreground:#685b77; }
:root[data-appearance="light"][data-theme="autumn"] { --background-top:#d9af98; --background-bottom:#d9af98; --foreground:#b3604f; --accent:#54292c; --wheel-accent:#54292c; --key-background:#e6c5ad; --key-foreground:#a85649; }
:root[data-appearance="light"][data-theme="winter"] { --background-top:#dfd2c7; --background-bottom:#dfd2c7; --foreground:#89a6b6; --accent:#102d46; --wheel-accent:#102d46; --key-background:#c8cbca; --key-foreground:#426578; }
:root[data-appearance="light"][data-theme="mardi-gras"] { --background-top:#f5f5f5; --background-bottom:#f5f5f5; --foreground:#781a81; --accent:#242424; --wheel-accent:#781a81; --key-background:#e7e1e8; --key-foreground:#781a81; }
* { box-sizing:border-box; }
html, body { margin:0; width:100%; height:100%; overscroll-behavior:none; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
html { overflow:hidden; }
/* Use viewport units: iOS standalone can resolve a percentage height to a shorter area. */
body { height:100vh; height:var(--app-viewport-height,100dvh); overflow:hidden; display:flex; align-items:center; justify-content:center; background:var(--background-bottom); -webkit-tap-highlight-color:transparent; }
button, input { font:inherit; }
button { color:inherit; border:0; cursor:pointer; touch-action:manipulation; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
button { -webkit-user-select:none; user-select:none; }
button:disabled { cursor:default; }
[hidden] { display:none!important; }
svg { fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; }
.svg-definitions { position:absolute; width:0; height:0; overflow:hidden; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.calculator { --header-height:48px; --readout-height:300px; --key-gap:8px; position:relative; container-type:inline-size; width:100%; max-width:500px; height:100vh; height:var(--app-viewport-height,100dvh); max-height:1085px; min-height:0; margin:auto; background:linear-gradient(var(--background-top),var(--background-bottom)); padding-top:var(--app-inset-top); padding-bottom:var(--app-inset-bottom); display:flex; flex-direction:column; }
.app-header { position:relative; flex:0 0 var(--header-height); display:flex; align-items:center; justify-content:center; padding:0 17px; }
h1 { font-size:19px; line-height:1; font-weight:600; letter-spacing:-.45px; margin:0; }
.glass-button { width:48px; height:48px; padding:10px; border-radius:50%; background:linear-gradient(155deg,#ffffff09,#00000008); box-shadow:inset 0 0 0 1px #00000040, inset 0 1px 1px #ffffff20, 0 2px 6px #0000000a; display:grid; place-items:center; }
.glass-button svg { width:29px; height:29px; stroke-width:2.5; }
#settings-button { position:absolute; right:17px; top:0; }
#settings-button svg { width:29px; height:29px; }
.readout { flex:1 0 var(--readout-height); display:grid; grid-template-rows:minmax(64px,1fr) 100px 136px; padding:0 9px; min-height:var(--readout-height); }
.readout.is-split { --total-height:max(76px,calc(15.295cqw + 16px)); --party-height:max(96px,calc(18.975cqw + 26px)); --readout-height:calc(164px + var(--total-height) + var(--party-height)); grid-template-rows:minmax(64px,1fr) 100px var(--total-height) var(--party-height); }
.bill-line { display:flex; align-items:center; justify-content:flex-end; padding-right:0; }
.amount { font-size:13.3cqw; font-weight:400; letter-spacing:-.45cqw; line-height:1.15; font-variant-numeric:tabular-nums; white-space:nowrap; }
.amount.compact { font-size:10.8cqw; }
.amount.very-compact { font-size:8.9cqw; }
.tip-line { display:flex; align-items:center; justify-content:space-between; border-bottom:2px solid var(--accent); position:relative; }
.amount-button { background:transparent; padding:0; position:relative; text-align:right; display:flex; flex-direction:column; align-items:flex-end; justify-content:center; height:100%; }
.tip-line .amount-button { padding-bottom:7px; }
.tip-amount { color:var(--accent); font-size:16.5cqw; letter-spacing:-.55cqw; font-weight:500; }
.tip-amount.compact { font-size:13cqw; }
.tip-amount.very-compact { font-size:10.5cqw; }
/* Keep the full total above the wheel and the separate per-person amount. */
.total-line { grid-area:3 / 1; align-self:start; display:flex; justify-content:flex-end; align-items:flex-start; padding-top:5px; }
.total-line .amount-button { height:auto; }
.rounding-indicator, .each-indicator { display:block; font-size:10px; font-weight:500; letter-spacing:.25px; line-height:1.1; padding-top:0; }
.tip-line .rounding-indicator { position:absolute; bottom:5px; right:0; }
.each-indicator { padding-top:3px; opacity:.65; }
.party-line { grid-area:3 / 1; align-self:end; height:96px; display:flex; align-items:flex-start; justify-content:space-between; padding-bottom:12px; }
.is-split .party-line { grid-area:4 / 1; height:100%; }
.wheel { position:relative; width:86px; height:84px; flex-shrink:0; margin-left:9px; overflow:hidden; isolation:isolate; color:var(--wheel-accent); -webkit-user-select:none; user-select:none; }
.wheel:has(.wheel-scroll:focus-visible) { outline:2px solid var(--wheel-accent); outline-offset:3px; border-radius:18px; }
.tip-line .wheel { margin-bottom:2px; }
.wheel::before { position:absolute; content:""; inset:26px 0 auto; height:34px; border-radius:30px; background:var(--selection); z-index:-1; }
.wheel-scroll { height:100%; overflow-y:scroll; overscroll-behavior:contain; scrollbar-width:none; scroll-snap-type:y mandatory; padding:27px 0; -webkit-mask-image:linear-gradient(transparent,black 29%,black 70%,transparent); mask-image:linear-gradient(transparent,black 29%,black 70%,transparent); outline-offset:1px; touch-action:pan-y; }
.wheel-scroll::-webkit-scrollbar { display:none; }
.wheel-option { height:30px; min-height:30px; display:flex; align-items:center; justify-content:center; gap:7px; scroll-snap-align:center; scroll-snap-stop:normal; font-size:25px; font-weight:600; letter-spacing:.1px; opacity:.45; cursor:pointer; transition:opacity .1s; }
.wheel-option[aria-selected="true"] { opacity:1; }
.wheel-option svg { width:25px; height:25px; stroke-width:2.4; }
.people-wheel { margin-top:0; }
.keypad { flex:0 1 auto; height:calc(86.6cqw + 24px); min-height:200px; display:grid; grid-template-columns:repeat(3,21.65cqw); grid-template-rows:repeat(4,minmax(0,1fr)); align-items:center; justify-items:center; justify-content:space-between; padding:0 20px; gap:var(--key-gap) 0; }
.key { padding:0; height:min(21.65cqw,100%); width:auto; min-height:44px; max-width:100%; aspect-ratio:1; border-radius:50%; color:var(--key-foreground); background:var(--key-background); font-size:8cqw; font-weight:400; line-height:1; display:grid; place-items:center; transition:background .12s,transform .12s; }
.key:active, .key.pressed { background:color-mix(in srgb,var(--key-background),var(--foreground) 18%); transform:scale(.94); }
.key.utility { background:transparent; }
.key.utility:active { background:var(--selection); }
.key.utility svg { height:31px; width:33px; stroke-width:3; }
.key[data-action="backspace"] svg { width:36px; }
.settings-sheet { --accent:#91ead6; --foreground:#f5f5f5; position:fixed; inset:var(--sheet-inset-top) 0 0; width:100%; max-width:500px; height:calc(100vh - var(--sheet-inset-top)); height:calc(var(--app-viewport-height,100dvh) - var(--sheet-inset-top)); max-height:none; padding:0; margin:0 auto; border:0; border-radius:43px 43px 40px 40px; background:var(--sheet); color:var(--foreground); overflow:hidden; }
.settings-sheet[open] { display:flex; flex-direction:column; }
dialog::backdrop { background:#00000033; }
.sheet-header { flex-shrink:0; display:flex; align-items:center; justify-content:center; height:73px; background:var(--sheet); position:relative; z-index:2; }
.sheet-header h2 { font-size:19px; letter-spacing:-.35px; font-weight:600; margin:0; }
.sheet-header h2:focus, .small-dialog h2:focus { outline:none; }
.close-button { position:absolute; right:17px; top:17px; width:46px; height:46px; color:var(--accent); }
.close-button svg { width:26px; height:26px; stroke-width:2.5; }
.settings-content { min-height:0; padding:10px 17px max(env(safe-area-inset-bottom),20px); overflow:auto; scrollbar-width:thin; scrollbar-color:#a2a2a5 transparent; overscroll-behavior:contain; }
.settings-section { margin:0 0 36px; }
.settings-section h3 { font-size:18px; font-weight:600; letter-spacing:-.25px; color:var(--secondary); margin:0 17px 11px; line-height:1.25; }
.setting-group { background:var(--group); border-radius:28px; overflow:hidden; }
.setting-row { width:100%; min-height:55px; position:relative; display:flex; align-items:center; text-align:left; gap:12px; padding:0 17px; font-size:18px; font-weight:400; letter-spacing:-.35px; background:transparent; color:inherit; }
.setting-row + .setting-row::before { position:absolute; content:""; top:0; height:1px; left:17px; right:17px; background:var(--separator); }
button.setting-row:active { background:#88888817; }
.check { width:21px; height:25px; stroke-width:2.8; margin-left:auto; color:var(--accent); visibility:hidden; flex-shrink:0; }
[aria-pressed="true"] > .check { visibility:visible; }
.setting-description { margin:8px 17px 0; font-size:14px; color:var(--secondary); line-height:1.4; letter-spacing:-.15px; }
.rounding-controls { margin-bottom:17px; }
.theme-section { margin-bottom:36px; }
.swatch { display:flex; width:64px; height:22px; margin-left:auto; overflow:hidden; flex-shrink:0; }
.swatch i { display:block; width:33.3333%; height:100%; }
.theme-row { gap:20px; }
.theme-row > .check { margin-left:0; }
.switch-row { gap:10px; cursor:pointer; }
.switch-row > span:first-child { flex:1; }
.switch-row input { position:absolute; right:17px; width:67px; height:30px; opacity:0; cursor:pointer; z-index:1; }
.switch { width:67px; height:30px; flex-shrink:0; border-radius:24px; background:#727274; position:relative; transition:background .18s; }
.switch::after { content:""; position:absolute; top:2px; left:2px; width:39px; height:26px; border-radius:20px; background:white; box-shadow:0 1px 2px #00000012; transition:transform .18s; }
.switch-row input:checked + .switch { background:#72ffdf; }
.switch-row input:checked + .switch::after { transform:translateX(24px); }
.switch-row input:focus-visible + .switch { outline:2px solid var(--accent); outline-offset:4px; }
.keyboard-section { margin-top:-18px; }
.appearance-section { margin-top:-5px; }
.share-icon { margin-left:auto; width:23px; height:23px; color:var(--accent); stroke-width:2; }
.install-section { margin-bottom:20px; }
.install-section:first-child { margin-bottom:26px; }
.settings-footer { text-align:center; color:var(--secondary); font-size:12px; margin:24px 0 12px; }
/* Reserve real space for the credit so the 0 key can never run into it. */
.app-footer { flex:0 0 12px; margin-top:16px; text-align:center; color:var(--secondary); font-size:10px; line-height:12px; white-space:nowrap; }
.app-footer a, .app-credit a { color:inherit; text-decoration:none; }
@media(hover:hover) { .app-footer a:hover, .app-credit a:hover { text-decoration:underline; text-underline-offset:2px; } }
.app-version { font:inherit; line-height:inherit; color:inherit; background:none; padding:0; border:0; }
.app-footer a:focus-visible, .app-credit a:focus-visible, .app-version:focus-visible { outline:1px solid currentColor; outline-offset:2px; }
:root[data-appearance="light"] .settings-sheet { --foreground:#090909; --accent:#205f51; }
:root[data-appearance="light"] .switch-row input:checked + .switch { background:#1d7564; }
.small-dialog { width:calc(100% - 44px); max-width:350px; padding:27px; border:0; border-radius:26px; background:var(--sheet); color:var(--foreground); }
.small-dialog h2 { margin:0 0 15px; font-size:22px; letter-spacing:-.5px; }
.small-dialog p { font-size:16px; line-height:1.5; color:var(--secondary); margin:0 0 24px; white-space:pre-line; }
.install-guide { max-width:390px; max-height:calc(100dvh - max(env(safe-area-inset-top),16px) - max(env(safe-area-inset-bottom),16px)); overflow:auto; overscroll-behavior:contain; }
.install-guide h2 { font-size:24px; line-height:1.15; }
.install-guide > p { font-size:14px; margin-bottom:18px; }
.install-platforms { display:flex; flex-direction:column; gap:20px; }
.install-platforms h3 { font-size:17px; margin:0 0 8px; }
.install-platforms ol { margin:0; padding-left:21px; color:var(--secondary); font-size:15px; line-height:1.45; }
.install-platforms li + li { margin-top:7px; }
.install-platforms strong { color:var(--foreground); font-weight:500; }
.install-guide .install-browser-note { font-size:13px; margin:20px 0; }
.install-guide .install-status { font-size:14px; margin:16px 0 0; color:var(--accent); }
.install-actions { display:flex; flex-direction:column; gap:10px; margin-top:20px; }
.install-actions button { width:100%; min-height:44px; }
.primary-button,.secondary-button { border-radius:14px; padding:13px 20px; font-size:16px; font-weight:600; background:var(--accent); color:var(--background-bottom); }
.secondary-button { background:var(--group); color:var(--foreground); }
.dialog-actions { display:flex; justify-content:space-between; gap:12px; }
.custom-tip-field { display:flex; align-items:center; font-size:32px; margin:12px 0 24px; border-bottom:1px solid var(--separator); }
.custom-tip-field input { width:100%; padding:10px 0; font-size:32px; background:transparent; color:var(--foreground); border:0; }
.display-check { max-height:calc(100dvh - 64px); overflow:auto; }
.display-check p { font-size:13px; margin-bottom:15px; }
.display-check pre { font:12px/1.4 ui-monospace,monospace; white-space:pre-wrap; overflow-wrap:anywhere; margin:0 0 20px; }
@media(min-width:650px) { .calculator { max-height:1000px; } .settings-sheet { max-height:1000px; } }
@media(max-height:740px) { :root { --app-inset-top:max(env(safe-area-inset-top),8px); } .calculator { --header-height:44px; --readout-height:288px; --key-gap:6px; } .readout { grid-template-rows:minmax(52px,1fr) 88px 148px; } .party-line { height:84px; } .keypad { height:calc(86.6cqw + 18px); min-height:194px; } .key { font-size:7cqw; } .amount { font-size:11.5cqw; } .tip-amount { font-size:14cqw; } .wheel { height:72px; } .wheel::before { top:20px; } .wheel-scroll { padding-block:21px; } .rounding-indicator,.each-indicator { font-size:9px; } }
@media(max-height:620px) { .calculator { --readout-height:280px; } .readout { grid-template-rows:minmax(44px,1fr) 88px 148px; } .app-footer { margin-top:8px; } }
@media(max-height:740px) { .readout.is-split { --total-height:max(66px,calc(13.225cqw + 17px)); --party-height:max(84px,calc(16.1cqw + 25px)); --readout-height:calc(140px + var(--total-height) + var(--party-height)); grid-template-rows:minmax(52px,1fr) 88px var(--total-height) var(--party-height); } }
@media(max-height:620px) { .readout.is-split { --readout-height:calc(132px + var(--total-height) + var(--party-height)); grid-template-rows:minmax(44px,1fr) 88px var(--total-height) var(--party-height); } }
/* Keep both headers below iOS's native scroll-edge blur; retain the full background. */
:root[data-ios-standalone="true"] {
  /* Include an overlaid status area only when iOS reports its safe inset. */
  --app-viewport-height:min(100vh,calc(100dvh + env(safe-area-inset-top,0px)));
  height:var(--app-viewport-height);
  --ios-header-clearance:clamp(0px,calc(100dvh - 620px),32px);
  --app-inset-top:calc(env(safe-area-inset-top,0px) + var(--ios-header-clearance));
  --sheet-inset-top:calc(env(safe-area-inset-top,0px) + var(--ios-header-clearance));
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; transition:none!important; } }
