/* ===================================================================
   Pidsak Bait Calc — Telegram Mini App
   Візуал: нічна коропова сесія — темна вода + бурштин сигналізатора.
   Без зовнішніх залежностей (шрифти системні), щоб хостилось одним теком.
   =================================================================== */

:root {
  --bg-0: #0a1c20;
  --bg-1: #0e2a2b;
  --surface: #123330;
  --surface-2: #16423c;
  --border: #1f524a;
  --amber: #f0a83c;      /* акцент — сигналізатор / світанок */
  --amber-dk: #c9832a;
  --green: #3fb98f;      /* «добре / у нормі» */
  --red: #e0604d;        /* червона лінія / перегодовування */
  --text: #eef4f0;
  --muted: #8fa8a2;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --r: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: radial-gradient(120% 80% at 50% -10%, #10393a 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; }

/* ---------- Header / brand ---------- */
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 2px 14px;
}
.brand .logo {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--amber), var(--amber-dk));
  display: grid; place-items: center;
  font-size: 26px; box-shadow: var(--shadow);
}
.brand h1 {
  margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .5px;
  line-height: 1.05;
}
.brand .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; letter-spacing: .3px; }
.brand .tag {
  margin-left: auto; font-size: 10.5px; color: var(--amber);
  border: 1px solid var(--amber-dk); border-radius: 999px; padding: 4px 9px;
  font-weight: 700; letter-spacing: .5px; white-space: nowrap;
}

/* ---------- Sections ---------- */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); font-weight: 700;
}

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 4px; }
.field .label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.field .label .name { font-size: 14.5px; font-weight: 600; }
.field .label .val { font-size: 15px; font-weight: 800; color: var(--amber); }

/* ---------- Slider ---------- */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: #0c2624; outline: none; margin: 4px 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd17a, var(--amber));
  border: 2px solid #6b4a12; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--amber); border: 2px solid #6b4a12; cursor: pointer;
}
.ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Segmented ---------- */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-width: 62px;
  background: #0e2b29; color: var(--muted);
  border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .12s ease; font-family: inherit;
}
.seg button .emoji { display: block; font-size: 17px; margin-bottom: 2px; }
.seg button.active {
  background: linear-gradient(180deg, var(--amber), var(--amber-dk));
  color: #241703; border-color: var(--amber); font-weight: 800;
  box-shadow: 0 4px 12px rgba(240,168,60,.25);
}

/* ---------- Result ---------- */
#result .total-line {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px;
}
#result .total-line .big { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
#result .total-line .u { color: var(--muted); font-size: 14px; font-weight: 600; }
#result .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }

.bait {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid rgba(255,255,255,.05);
}
.bait:first-of-type { border-top: none; }
.bait .ic { font-size: 24px; width: 30px; text-align: center; flex: 0 0 30px; }
.bait .meta { flex: 1 1 auto; }
.bait .meta .n { font-size: 14.5px; font-weight: 700; }
.bait .meta .d { font-size: 12px; color: var(--muted); margin-top: 1px; }
.bait .qty { font-size: 18px; font-weight: 800; color: var(--amber); white-space: nowrap; }
.bait .qty small { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Schedule ---------- */
.sched { display: flex; gap: 6px; align-items: flex-end; height: 74px; margin-top: 6px; }
.sched .bar { flex: 1; background: linear-gradient(180deg, var(--amber), var(--amber-dk));
  border-radius: 5px 5px 3px 3px; min-height: 6px; position: relative; opacity: .92; }
.sched .bar span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center;
  font-size: 9.5px; color: var(--muted); }
.sched-legend { font-size: 11.5px; color: var(--muted); margin-top: 26px; }

/* ---------- Warnings ---------- */
.warn {
  display: flex; gap: 9px; align-items: flex-start;
  background: rgba(224,96,77,.10); border: 1px solid rgba(224,96,77,.4);
  border-radius: 11px; padding: 10px 12px; margin-top: 10px;
  font-size: 12.5px; line-height: 1.4;
}
.warn.ok { background: rgba(63,185,143,.09); border-color: rgba(63,185,143,.35); }
.warn .wi { font-size: 15px; flex: 0 0 auto; }

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 10px; margin-top: 4px; }
.btn {
  flex: 1; border: none; border-radius: 13px; padding: 14px;
  font-size: 14.5px; font-weight: 800; cursor: pointer; font-family: inherit;
  transition: transform .1s ease, filter .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--amber), var(--amber-dk)); color: #241703; }
.btn.ghost { background: #0e2b29; color: var(--text); border: 1px solid var(--border); }

/* ---------- Share card (canvas) ---------- */
#cardModal {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  display: none; place-items: center; padding: 20px; z-index: 50;
}
#cardModal.show { display: grid; }
#cardModal .cardbox { max-width: 360px; width: 100%; }
#cardModal canvas { width: 100%; border-radius: 18px; box-shadow: var(--shadow); display: block; }
#cardModal .cactions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Footer / socials ---------- */
.foot { text-align: center; padding: 18px 0 4px; }
.foot .socials { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.foot .socials a {
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; color: var(--text); font-size: 13px; font-weight: 700;
  background: #0e2b29; border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 12px;
}
.foot .socials a .ei { font-size: 15px; }
.foot .credit { color: var(--muted); font-size: 11px; line-height: 1.5; }
.foot .credit b { color: var(--amber); }
.disclaimer { color: var(--muted); font-size: 10.5px; text-align: center; margin-top: 8px; line-height: 1.5; }
