/* Oson Kroy — the usta web app. Telegram's own theme first (light / dark follow the user's Telegram), teal accent. */
:root {
  --bg: var(--tg-theme-bg-color, #0f172a);
  --text: var(--tg-theme-text-color, #f1f5f9);
  --hint: var(--tg-theme-hint-color, #94a3b8);
  --card: var(--tg-theme-secondary-bg-color, #1e293b);
  --line: color-mix(in srgb, var(--hint) 28%, transparent);
  --accent: #0d9488; --accent-ink: #ffffff; --violet: #7c3aed; --bad: #ef4444; --warn: #f59e0b;
  --radius: 14px; --ease-out: cubic-bezier(.2, 0, 0, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--hint); margin: 18px 0 8px; }
.hint { color: var(--hint); font-size: 14px; margin: 0; }
.screen { min-height: 100vh; display: flex; flex-direction: column; gap: 12px;
  padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); animation: in 220ms var(--ease-out) both; }
.screen.center { align-items: center; justify-content: center; text-align: center; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; }

/* buttons: 48px+ targets */
.cta { border: 0; min-height: 52px; border-radius: var(--radius); padding: 0 18px; font-size: 17px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px rgb(13 148 136 / .3);
  transition: transform 120ms var(--ease-out), opacity 120ms; }
.cta:active { transform: scale(.97); }
.cta:disabled { opacity: .45; box-shadow: none; }
.ghost { border: 1px solid var(--line); background: transparent; border-radius: 12px; min-height: 48px; padding: 0 14px; }
.wide { width: 100%; }
.x { border: 0; background: transparent; color: var(--hint); width: 44px; height: 44px; font-size: 18px; flex: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

/* top */
.hello { display: flex; gap: 12px; align-items: center; padding-top: 4px; }
.logo-s { width: 48px; height: 48px; flex: none; }
.pill { margin-top: 4px; border: 0; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.pill.bad, b.bad { color: var(--bad); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.note { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--warn) 18%, transparent); }
.bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 0; }
.back { border: 0; background: transparent; font-size: 30px; line-height: 1; width: 44px; height: 44px; color: var(--accent); }
.title { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 20px; font-weight: 700; padding: 6px 0; }

/* lists */
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 2px 8px; border: 0; background: var(--card);
  border-radius: var(--radius); padding: 14px; min-height: 64px; }
.item .hint { grid-column: 1; } .item .chev { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 22px; color: var(--hint); }
.empty { color: var(--hint); text-align: center; padding: 24px 12px; margin: 0; }
.tabs { display: flex; gap: 6px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: var(--card); font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tabs.bottom { margin-top: auto; }

/* forms */
.form { display: grid; gap: 12px; }
.form h2 { margin: 8px 0 0; }
.fld { display: grid; gap: 4px; font-size: 13px; color: var(--hint); }
.fld input, .cell input, .pname, select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); padding: 0 12px; font-size: 16px; color: var(--text); }
.row { display: flex; gap: 8px; align-items: end; } .row .fld { flex: 1; }
.err { color: var(--bad); margin: 0; font-size: 14px; }

/* the order */
.tabbody { display: grid; gap: 10px; }
.mat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px; align-items: end; }
.mat .wide { grid-column: 1 / -1; }
.cell { display: grid; gap: 3px; font-size: 12px; color: var(--hint); min-width: 0; }
.cell input { text-align: center; font-variant-numeric: tabular-nums; }
.part { display: grid; gap: 8px; padding: 10px; }
.part-top { display: flex; gap: 8px; align-items: center; }
.part-top .no { width: 28px; text-align: center; color: var(--hint); flex: none; }
.part-sizes { display: grid; grid-template-columns: 1fr 1fr .7fr; gap: 8px; }
.part-more { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.part-more select { flex: 1 1 120px; min-height: 44px; }
.edges { display: flex; gap: 6px; flex: 1 1 220px; }
.edge { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 12px;
  display: grid; place-items: center; line-height: 1.1; padding: 2px; }
.edge i { font-style: normal; font-weight: 700; font-size: 14px; min-height: 16px; }
.edge.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.tex { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 20px; flex: none; }
.tex.on { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 24%, transparent); }

/* bottom dock */
.dock { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 3; }
.dock .cta { margin-left: auto; min-width: 150px; }
.dock.two > * { flex: 1; }

/* the result */
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big { background: var(--card); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.big b { font-size: 26px; }
.price { display: grid; gap: 6px; }
.price div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.price span { color: var(--hint); }
.price .total { border-top: 1px solid var(--line); padding-top: 8px; font-size: 18px; }
.price .total span { color: var(--text); font-weight: 600; }
.maps { display: grid; gap: 12px; }
.map { margin: 0; background: #fff; border-radius: 12px; padding: 8px; color: #0f172a; }
.map figcaption { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.map svg { width: 100%; height: auto; display: block; }
.lock p { color: var(--hint); }

/* loading, toast, install */
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent);
  animation: spin 900ms linear infinite; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 5;
  padding: 12px 14px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / .35);
  animation: up 200ms var(--ease-out) both; }
#toast.bad { background: #7f1d1d; }
.install { display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 10px 12px; border-radius: var(--radius);
  background: var(--card); }
.install[hidden] { display: none; }
.install .ico { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.install b { display: block; font-size: 15px; } .install small { color: var(--hint); font-size: 13px; }
.install .go { margin-left: auto; border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.install .x { width: 32px; height: 32px; }

@keyframes in { from { opacity: 0; transform: translateY(6px); } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .screen, #toast { animation: none; } .spinner { animation-duration: 3s; } .cta { transition: none; } }
.note.mode { display: grid; gap: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* the edges: a small drawing of the part — tap a side; its size is written on it (top/bottom = length, sides = width) */
.esk { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; grid-template-rows: 46px minmax(64px, auto) 46px;
  gap: 4px; flex: 1 1 100%; }
.esk .e { border: 1px dashed var(--line); background: transparent; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums;
  transition: background 120ms var(--ease-out), border-color 120ms; }
.esk .top { grid-column: 1 / 4; grid-row: 1; } .esk .bottom { grid-column: 1 / 4; grid-row: 3; }
.esk .left { grid-column: 1; grid-row: 2; } .esk .right { grid-column: 3; grid-row: 2; }
.esk .left, .esk .right { flex-direction: column; writing-mode: vertical-rl; }
.esk .left i, .esk .right i { writing-mode: horizontal-tb; }
.esk .e i { font-style: normal; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 6px;
  min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; }
.esk .e.on { border: 0; color: var(--text); background: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent); }
.esk .top.on { box-shadow: inset 0 -5px 0 var(--accent), inset 0 0 0 1px var(--accent); }
.esk .bottom.on { box-shadow: inset 0 5px 0 var(--accent), inset 0 0 0 1px var(--accent); }
.esk .left.on { box-shadow: inset -5px 0 0 var(--accent), inset 0 0 0 1px var(--accent); }
.esk .right.on { box-shadow: inset 5px 0 0 var(--accent), inset 0 0 0 1px var(--accent); }
.emid { grid-column: 2; grid-row: 2; border-radius: 6px; display: grid; place-content: center; text-align: center; gap: 2px;
  background: color-mix(in srgb, #d6b98c 32%, transparent); font-weight: 700; font-variant-numeric: tabular-nums; }
.emid small { font-weight: 400; font-size: 11px; color: var(--hint); }

/* the bottom of what Telegram shows (its own bar can cover the page's 100vh): docks and the Raskroy button sit above it */
:root { --vh: var(--tg-viewport-stable-height, 100vh); }
.dock { bottom: auto; top: calc(var(--vh) - 68px - env(safe-area-inset-bottom)); }
.dock.three > * { flex: 1; min-width: 0; padding: 0 8px; font-size: 15px; }
.fab { position: fixed; right: 16px; top: calc(var(--vh) - 84px - env(safe-area-inset-bottom)); z-index: 4;
  min-height: 60px; padding: 8px 20px; border: 0; border-radius: 18px; background: var(--accent); color: var(--accent-ink);
  font-size: 18px; font-weight: 700; display: grid; justify-items: center; line-height: 1.15;
  box-shadow: 0 10px 28px rgb(13 148 136 / .45); transition: transform 120ms var(--ease-out); }
.fab small { font-size: 12px; font-weight: 500; opacity: .9; }
.fab:active { transform: scale(.96); }
.fab:disabled { opacity: .45; box-shadow: none; }
.tabs.bottom { flex-wrap: wrap; }
.tabs.bottom button { flex: 1 1 30%; }
@media (prefers-reduced-motion: reduce) { .fab, .esk .e { transition: none; } }
.part-more .tex { width: auto; padding: 0 14px; font-size: 14px; }
.item.shop { align-items: center; }
.item.shop .x { grid-column: 2; grid-row: 1; }
.center { text-align: center; }
