/* Googly. Nabble's layout (a fixed bar on top, a fixed tab bar along the
   bottom, an icon over a word) in the icon's colours: blue, red, yellow and
   green on white, as in static/Googly_icon.png. */

:root {
  --blue: #2f7df6;
  --blue-deep: #1a5fd0;
  --red: #e8392f;
  --yellow: #f9c21a;
  --green: #43a85e;
  --paper: #f8f8f8;
  --line: #e3e5e8;
  --ink: #202124;
  --quiet: #5f6368;
  /* Profit and loss as text: deeper than the icon's green and red, so they
     read at small sizes on white. Always with a sign, never colour alone. */
  --up: #1e7e3e;
  --down: #c5221f;
  --top-height: 56px;
  --tabs-height: 64px;
  --gutter: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue-deep); }

/* TOP BAR: white, with the icon's four colours as a stripe along its foot. */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--top-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--gutter) + env(safe-area-inset-right)) 0
           calc(var(--gutter) + env(safe-area-inset-left));
  background: #fff;
  color: var(--ink);
}

.top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--blue) 0 25%, var(--red) 25% 50%, var(--yellow) 50% 75%, var(--green) 75%);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
  text-decoration: none;
}

.mark { width: 32px; height: 32px; }

/* The letters coloured as the icon's wordmark is: G o o g l y. */
.letters span:nth-child(1), .letters span:nth-child(4) { color: var(--blue); }
.letters span:nth-child(2), .letters span:nth-child(6) { color: var(--red); }
.letters span:nth-child(3) { color: var(--yellow); }
.letters span:nth-child(5) { color: var(--green); }

.gear {
  display: flex;
  padding: 8px;
  margin-right: -8px;
  border-radius: 999px;
  color: var(--quiet);
  -webkit-tap-highlight-color: transparent;
}

.gear.on { color: var(--blue); background: rgba(47, 125, 246, .12); }

.gear svg, .tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* PAGE */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--top-height) + env(safe-area-inset-top) + var(--gutter))
           calc(var(--gutter) + env(safe-area-inset-right))
           var(--gutter)
           calc(var(--gutter) + env(safe-area-inset-left));
}

.with-bars main {
  padding-bottom: calc(var(--tabs-height) + env(safe-area-inset-bottom) + var(--gutter));
}

h1 { margin: 4px 0 14px; font-size: 24px; font-weight: 700; color: var(--ink); }

.quiet { color: var(--quiet); font-size: 14px; }

.card {
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(32, 33, 36, .06);
}

.card p { margin: 8px 0 0; }

.placeholder { border: 2px dashed var(--line); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.toggle:first-of-type { margin-top: 10px; }

.toggle input { width: 20px; height: 20px; accent-color: var(--blue); }

.build { text-align: center; }

.warn-badge { background: var(--red); color: #fff; }

code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }

/* HISTORY */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * var(--gutter)) 14px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.chip {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.chip.on { border-color: var(--blue); background: rgba(47, 125, 246, .12); color: var(--blue-deep); }

.label { margin: 0; color: var(--quiet); font-size: 13px; font-weight: 600; }

.hero { margin: 2px 0 12px; font-size: 48px; font-weight: 700; line-height: 1.1; letter-spacing: -1px; }

.up { color: var(--up); }
.down { color: var(--down); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.stats dt { color: var(--quiet); font-size: 12px; }
.stats dd { margin: 0; font-weight: 700; }

.chart { margin: 10px 0 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: #bdc1c6; stroke-width: 1; }
.chart .tick { fill: var(--quiet); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .area { fill: var(--blue); opacity: .1; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot, .chart .cross circle { fill: var(--blue); stroke: #fff; stroke-width: 2; }
.chart .end { fill: var(--ink); font-size: 13px; font-weight: 700; }
/* SVG ignores the hidden attribute, so the crosshair hides by class. */
.chart .cross { display: none; }
.chart .cross.on { display: inline; }
.chart .cross line { stroke: var(--quiet); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.readout { min-height: 22px; margin-top: 6px; font-size: 14px; }
.readout span { color: var(--quiet); }

.list .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.list .label { margin-bottom: 6px; }
.list .row .quiet { font-size: 13px; }
.list .name { font-weight: 600; }
.pnl { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.pnl .quiet { font-weight: 400; }

/* ACCOUNT */
.hero-small { margin: 2px 0 6px; font-size: 24px; font-weight: 700; }

/* Back and lay as Betfair colours them: blue and pink, with the word. */
.side {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  vertical-align: 2px;
}
.side-back { background: #d6e8fc; color: #1a4f8b; }
.side-lay { background: #fbdde6; color: #8b1a3f; }

.more {
  display: block;
  padding: 12px 0 2px;
  border-top: 1px solid var(--line);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

/* LOGIN */
.gate { display: grid; gap: 12px; max-width: 320px; margin: 8vh auto 0; }

.gate-logo { width: 160px; height: 160px; margin: 0 auto 4px; }

.gate h1 { margin: 0; text-align: center; font-size: 30px; }

.gate > .quiet { margin: 0 0 8px; text-align: center; }

.gate input, .gate button {
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.gate input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }

.gate button { border: 0; background: var(--blue); color: #fff; font-weight: 700; }

.gate button:active { background: var(--blue-deep); }

.warn { color: var(--red); font-size: 14px; margin: 0; }

/* BOTTOM BAR: each tab lights up in one of the icon's colours. */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-height) + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* Solid, not frosted: a backdrop blur on a fixed bar lags in the Android WebView. */
  background: #fff;
  border-top: 1px solid var(--line);
}

.tab {
  --hue: var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms ease-out;
}

.tab-inplay { --hue: var(--red); }
.tab-history { --hue: var(--blue); }
.tab-account { --hue: var(--green); }
/* A deeper yellow: the icon's own is too pale to stroke on white. */
.tab-model { --hue: #e0a500; }

/* The pill behind the icon, as Android's own bottom bars have. */
.tab svg { box-sizing: content-box; padding: 4px 18px; border-radius: 999px; }

.tab:active { transform: scale(.94); transition-duration: 80ms; }

.tab.on { color: var(--ink); font-weight: 800; }

.tab.on svg {
  stroke: var(--hue);
  stroke-width: 2.2;
  background: color-mix(in srgb, var(--hue) 16%, transparent);
}
