/* Viking Bot web monitor — "Obsidian & Gold", matching the Android app. */
:root {
  --bg: #070A11;
  --card-1: rgba(23, 31, 49, .92);
  --card-2: rgba(13, 19, 31, .92);
  --well: rgba(3, 7, 14, .55);
  --line: rgba(150, 175, 220, .11);
  --line-2: rgba(150, 175, 220, .19);
  --text: #EEF2FA;
  --text-2: #A9B4CA;
  --text-3: #6E7B95;
  --gold-hi: #FFE7A3;
  --gold: #F4C35A;
  --gold-lo: #C48A22;
  --gold-ink: #1C1404;
  --metal: linear-gradient(135deg, #FFEAAA 0%, #F4C35A 38%, #D49B30 70%, #F8DA8C 100%);
  --green: #2DDBA0;
  --red: #FF5E6D;
  --amber: #FFB648;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, .85);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --tabs-h: 64px;
  --mono: "Roboto Mono", "SF Mono", Consolas, monospace;
  --max: 560px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; color: var(--text); }
body {
  font-family: "Noto Sans Arabic", "Noto Naskh Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45; overscroll-behavior: none; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.booting { visibility: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: .3px; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(75% 42% at 92% -6%, rgba(244, 195, 90, .15), transparent 70%),
    radial-gradient(65% 40% at -8% 2%, rgba(76, 126, 255, .13), transparent 70%),
    radial-gradient(90% 55% at 50% 112%, rgba(45, 219, 160, .05), transparent 70%),
    linear-gradient(180deg, #0A0F19 0%, #070A11 55%);
}

.ico { font-style: normal; }

/* -------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: var(--max); margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, rgba(8, 12, 20, .96), rgba(8, 12, 20, .72) 70%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo {
  width: 42px; height: 42px; border-radius: 13px; overflow: hidden; flex: none; background: #0A1530;
  box-shadow: 0 0 0 1px rgba(244, 195, 90, .38), 0 8px 22px -6px rgba(244, 195, 90, .35);
}
.logo img { display: block; width: 100%; height: 100%; }
.logo.big { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 14px; }
.brand-name { font-weight: 900; font-size: 17px; letter-spacing: 4.5px; line-height: 1.1;
  background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name.center { text-align: center; font-size: 20px; }
.brand-sub { margin-top: 2px; font-size: 9.5px; font-weight: 700; letter-spacing: 2.6px; color: var(--text-3); }
.pills { display: flex; gap: 6px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px;
  background: rgba(19, 26, 41, .78); border: 1px solid var(--line-2);
  font-size: 11.5px; font-weight: 700; color: var(--text-3); line-height: 1;
}
.pill:active { transform: scale(.95); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #56637B; flex: none; }
.pill.ok { color: var(--text); }
.pill.ok i { background: var(--green); box-shadow: 0 0 0 3px rgba(45, 219, 160, .16), 0 0 10px rgba(45, 219, 160, .9); }
.pill.warn { color: var(--text-2); }
.pill.warn i { background: var(--amber); animation: blink 1.1s ease-in-out infinite; }
.pill.bad { color: var(--text); }
.pill.bad i { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 94, 109, .14); }
.pill.gear { padding: 0 10px; font-size: 15px; }
@keyframes blink { 50% { opacity: .35; } }

/* --------------------------------------------------------------- views */
.view { display: none; max-width: var(--max); margin: 0 auto; padding: 2px 14px 0; }
.view.active { display: block; animation: viewIn .3s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 8px; }
.page-title { margin: 6px 2px 8px; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.group-label { margin: 20px 4px 9px; font-size: 11px; font-weight: 800; letter-spacing: 1.8px; color: var(--text-3); }
.spacer { height: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px); }

/* ------------------------------------------------------- view-only tag */
.viewonly {
  display: flex; align-items: flex-start; gap: 11px; margin: 14px 0 4px; padding: 12px 14px; border-radius: 15px;
  background: linear-gradient(135deg, rgba(244, 195, 90, .10), rgba(244, 195, 90, .03));
  border: 1px solid rgba(244, 195, 90, .28);
}
.viewonly .ico { font-size: 18px; line-height: 1.2; }
.viewonly-t { font-weight: 800; color: var(--gold-hi); font-size: 13px; letter-spacing: .3px; }
.viewonly-s { color: var(--text-2); font-size: 12px; margin-top: 2px; }

/* ---------------------------------------------------------------- card */
.card {
  margin: 12px 0; padding: 15px 15px 16px; border-radius: 18px;
  background: linear-gradient(180deg, var(--card-1), var(--card-2));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--well); border: 1px solid var(--line); font-size: 15px; }
.card-title { font-weight: 800; font-size: 15px; letter-spacing: .2px; flex: 1; min-width: 0; }
.badge { font-size: 10.5px; font-weight: 800; letter-spacing: .6px; padding: 4px 9px; border-radius: 99px;
  text-transform: uppercase; color: var(--text-3); background: var(--well); border: 1px solid var(--line); }
.badge.good { color: #0A1A12; background: var(--green); border-color: transparent; }
.badge.warn { color: var(--gold-ink); background: var(--amber); border-color: transparent; }
.badge.muted { color: var(--text-3); }
.mini { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--well); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 99px; }
.mini:active { transform: scale(.95); }

.rows { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px;
  border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row > span { color: var(--text-3); font-size: 13px; }
.row > b { font-weight: 700; text-align: end; }
.note { margin-top: 11px; padding: 10px 12px; border-radius: 12px; font-size: 12px; color: var(--text-2);
  background: var(--well); border: 1px solid var(--line); }

/* ------------------------------------------------------------- results */
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.tally-cell { text-align: center; padding: 10px 4px; border-radius: 13px; background: var(--well); border: 1px solid var(--line); }
.tally-n { font-size: 22px; font-weight: 800; font-family: var(--mono); }
.tally-l { font-size: 10px; color: var(--text-3); margin-top: 2px; letter-spacing: .4px; }
.pnl-line { display: flex; align-items: center; justify-content: space-between; margin: 12px 2px 4px;
  padding-top: 11px; border-top: 1px solid var(--line); }
.pnl-line > span { color: var(--text-3); font-size: 13px; }
.pnl-line > b { font-size: 18px; font-weight: 800; }
.feed { margin-top: 10px; display: flex; flex-direction: column; }
.fitem { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.fitem:last-child { border-bottom: 0; }
.fitem .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.fitem.win .dot { background: var(--green); } .fitem.loss .dot { background: var(--red); } .fitem.draw .dot { background: var(--text-3); }
.fitem .fout { font-weight: 700; }
.fitem.win .fout { color: var(--green); } .fitem.loss .fout { color: var(--red); }
.fitem .ftime { color: var(--text-3); margin-inline-start: auto; font-size: 12px; }
.fitem b { font-weight: 700; min-width: 56px; text-align: end; }
.empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 10px 6px 2px; }

/* ------------------------------------------------------------ settings */
.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.toggle:last-of-type { border-bottom: 0; }
.toggle > span { flex: 1; min-width: 0; }
.toggle b { display: block; font-weight: 700; font-size: 14px; }
.toggle small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 46px; height: 27px; border-radius: 99px; background: var(--well); border: 1px solid var(--line-2);
  position: relative; flex: none; transition: background .2s, border-color .2s; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 21px; height: 21px; border-radius: 50%;
  background: #8794AC; transition: transform .2s var(--ease), background .2s; }
.toggle input:checked + .switch { background: linear-gradient(135deg, var(--gold), var(--gold-lo)); border-color: transparent; }
.toggle input:checked + .switch::after { transform: translateX(19px); background: var(--gold-ink); }
[dir=rtl] .toggle input:checked + .switch::after { transform: translateX(-19px); }

.segctl { display: flex; gap: 6px; background: var(--well); border: 1px solid var(--line); border-radius: 13px; padding: 4px; }
.option { flex: 1; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; }
.option.active { background: linear-gradient(135deg, var(--gold), var(--gold-lo)); color: var(--gold-ink); }

.btn { height: 46px; border: 1px solid var(--line-2); border-radius: 13px; background: var(--well); color: var(--text);
  font-weight: 800; letter-spacing: .3px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.98); }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--well); }
.btn.gold { background: var(--metal); color: var(--gold-ink); border-color: transparent; box-shadow: 0 10px 26px -10px rgba(244, 195, 90, .6); }
.btn.danger { color: var(--red); border-color: rgba(255, 94, 109, .4); background: rgba(255, 94, 109, .06); margin-top: 10px; }
.btn.danger.confirm { background: var(--red); color: #fff; border-color: transparent; }
.hint { color: var(--text-3); font-size: 11.5px; margin-top: 8px; padding: 0 2px; }
.keybox { padding: 12px 14px; border-radius: 12px; background: var(--well); border: 1px solid var(--line);
  font-size: 14px; letter-spacing: 1px; margin-bottom: 11px; text-align: center; color: var(--gold-hi); }
.appinfo { text-align: center; color: var(--text-3); font-size: 11.5px; margin-top: 18px; }

/* ----------------------------------------------------------- bottom nav */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; max-width: var(--max); margin: 0 auto;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 14, 22, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.tab { flex: 1; border: 0; background: transparent; color: var(--text-3); font-size: 11px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tab .ico { font-size: 19px; opacity: .6; }
.tab.active { color: var(--gold); }
.tab.active .ico { opacity: 1; }
body.locked-out .tabs { display: none; }

/* --------------------------------------------------------------- gate */
.gate { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(90% 60% at 50% 0%, rgba(10, 16, 30, .6), transparent), var(--bg); }
.gate.shown { display: flex; animation: viewIn .3s var(--ease) both; }
.gate-card { width: 100%; max-width: 380px; text-align: center; }
.gate-sub { color: var(--text-2); font-size: 13.5px; margin: 10px 0 20px; }
#gateCode { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--well);
  text-align: center; font-family: var(--mono); letter-spacing: 2px; font-size: 15px; text-transform: uppercase; }
#gateCode:focus { outline: 0; border-color: var(--gold-lo); box-shadow: 0 0 0 3px rgba(244, 195, 90, .14); }
.gate-msg { min-height: 18px; margin: 10px 0; font-size: 12.5px; color: var(--text-3); }
.gate-msg.bad { color: var(--red); }
.gate .btn.gold { margin-top: 4px; }
.linkbtn { background: none; border: 0; color: var(--gold); font-weight: 700; margin-top: 16px; }
.gate-foot { color: var(--text-3); font-size: 11px; margin-top: 22px; }

/* -------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 20px); transform: translateX(-50%) translateY(20px);
  z-index: 60; max-width: 86%; padding: 11px 18px; border-radius: 13px; background: rgba(20, 27, 43, .98);
  border: 1px solid var(--line-2); color: var(--text); font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 600px) { body { font-size: 15.5px; } }
