/* EdgeCheck — one stylesheet for the landing page and the app.
   Color carries meaning only: green = target, red = stop, grey = luck.
   Everything else is ink on paper. */

:root {
  --paper: #edf0f2;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #5a6672;
  --line: #d3d9df;
  --target: #0b7a64;
  --target-zone: rgba(11, 122, 100, 0.13);
  --stop: #bf3a2b;
  --stop-zone: rgba(191, 58, 43, 0.12);
  --luck: #8794a1;
  --warn: #a15c07;
  --focus: #2f55d4;
  --on-ink: #ffffff;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --step--1: 0.8125rem; /* 13px */
  --step-0: 0.9375rem; /* 15px */
  --step-1: 1.0625rem; /* 17px */
  --step-2: 1.3125rem; /* 21px */
  --step-3: 1.6875rem; /* 27px */
  --step-4: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem);

  --radius-sheet: 14px;
  --radius-control: 8px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171d;
    --surface: #1a222b;
    --ink: #e6ebef;
    --muted: #a3afba;
    --line: #2c3742;
    --target: #3bc2a0;
    --target-zone: rgba(59, 194, 160, 0.16);
    --stop: #ff7b69;
    --stop-zone: rgba(255, 123, 105, 0.15);
    --luck: #75828f;
    --warn: #f2b84b;
    --focus: #8fa8ff;
    --on-ink: #11171d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --warn: #f2b84b;
  --paper: #11171d;
  --surface: #1a222b;
  --ink: #e6ebef;
  --muted: #a3afba;
  --line: #2c3742;
  --target: #3bc2a0;
  --target-zone: rgba(59, 194, 160, 0.16);
  --stop: #ff7b69;
  --stop-zone: rgba(255, 123, 105, 0.15);
  --luck: #75828f;
  --focus: #8fa8ff;
  --on-ink: #11171d;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
  letter-spacing: -0.015em;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--target);
}

.neg {
  color: var(--stop);
}

.muted {
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Until the page's text is in the chosen language (see i18n.js). */
html.i18n-wait body {
  visibility: hidden;
}

/* Author display rules must never undo the hidden attribute. */
[hidden] {
  display: none !important;
}

/* Grid children may shrink below their content; wide tables scroll inside their box instead of the page. */
.hero,
.verdict,
.layout,
.column,
.sheet,
.patterns {
  grid-template-columns: minmax(0, 1fr);
}

.hero > *,
.verdict > *,
.layout > *,
.column > *,
.sheet > *,
.patterns > * {
  min-width: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Top bar */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.bar .spacer {
  flex: 1;
}

/* Buttons and inputs */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 0 10px;
}

.button.quiet:hover {
  color: var(--ink);
}

.button.danger {
  color: var(--stop);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.target {
  border-color: color-mix(in srgb, var(--target) 45%, var(--line));
  color: var(--target);
}

.button.stop {
  border-color: color-mix(in srgb, var(--stop) 45%, var(--line));
  color: var(--stop);
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field > label,
.field > .label,
legend {
  font-size: var(--step--1);
  color: var(--muted);
  padding: 0;
}

.field .optional {
  font-weight: 400;
}

input,
select,
textarea {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 9px 11px;
  min-height: 44px;
  width: 100%;
  min-width: 0;
}

input.num {
  font-variant-numeric: tabular-nums;
}

textarea {
  resize: vertical;
  min-height: 68px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--paper);
}

.seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
}

.seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--step--1);
  text-align: center;
  line-height: 1.2;
}

.seg label + input + label {
  border-left: 1px solid var(--line);
}

.seg input:checked + label {
  background: var(--ink);
  color: var(--on-ink);
}

.seg input:focus-visible + label {
  outline: 2px solid var(--focus);
  outline-offset: -3px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.error {
  color: var(--stop);
  font-size: var(--step--1);
}

.error:empty {
  display: none;
}

/* ---------- Landing page ---------- */

.hero {
  display: grid;
  gap: 32px;
  padding-block: 32px 56px;
  align-items: center;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 56px;
    padding-block: 56px 88px;
  }
}

.hero h1 {
  font-size: var(--step-4);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 750;
  max-width: 13ch;
}

.hero .lead {
  margin-top: 18px;
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 44ch;
}

.hero .cta .button.quiet {
  padding-inline: 6px;
}

.hint .button.quiet {
  min-height: 32px;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero .cta {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* The position box: the tool every trader already knows. */
.position {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.position svg {
  width: 100%;
  height: auto;
  display: block;
}

.position .zone-label {
  font: 600 13px var(--font);
}

.position .axis-label {
  font: 500 12px var(--font);
  fill: var(--muted);
}

.position .readout {
  font-size: var(--step-2);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.position .readout .num {
  color: var(--target);
}

.position .control {
  display: grid;
  gap: 6px;
}

.position .control label {
  display: flex;
  justify-content: space-between;
  font-size: var(--step--1);
  color: var(--muted);
}

input[type="range"] {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--ink);
}

.dots {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 5px;
}

.dots span {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--stop-zone);
  border: 1px solid color-mix(in srgb, var(--stop) 35%, transparent);
}

.dots span.hit {
  background: var(--target);
  border-color: var(--target);
}

.dots-caption {
  font-size: var(--step--1);
  color: var(--muted);
}

.section {
  padding-block: 48px;
  border-top: 1px solid var(--line);
}

.section h2 {
  font-size: var(--step-3);
  line-height: 1.15;
  max-width: 22ch;
}

.steps {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 24px;
  counter-reset: step;
}

@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
  }
}

.steps li {
  counter-increment: step;
  display: grid;
  gap: 6px;
  align-content: start;
}

.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.steps h3 {
  font-size: var(--step-1);
}

.steps p,
.section .body {
  color: var(--muted);
  max-width: 60ch;
}

.section .body {
  margin-top: 14px;
  font-size: var(--step-1);
}

.footer {
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--step--1);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

/* ---------- Terms and privacy ---------- */

.legal {
  display: grid;
  gap: 12px;
  padding-block: 24px 48px;
}

.legal > * {
  max-width: 68ch;
}

.legal h1 {
  font-size: var(--step-3);
  line-height: 1.15;
}

.legal h2 {
  font-size: var(--step-1);
  margin-top: 16px;
}

.legal ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.footer a {
  color: var(--muted);
}

.lang-pick select {
  width: auto;
  min-height: 36px;
  padding: 4px 8px;
  font-size: var(--step--1);
  color: var(--muted);
  background: transparent;
}

/* ---------- App ---------- */

/* Tabs: Trades, Results, Settings. They stay at the top while the page scrolls. */
.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.tabs-row {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-row::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink);
}

.tabs + main {
  padding-top: 16px;
}

/* Trades tab: the next big news release */
.news {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.news.soon,
.news.live {
  border-color: var(--warn);
  box-shadow: inset 3px 0 0 var(--warn);
}

.news-next {
  font-size: var(--step--1);
}

.news-more summary {
  cursor: pointer;
  font-size: var(--step--1);
  color: var(--muted);
  padding-block: 2px;
}

.news-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: var(--step--1);
}

.news-list li {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 110px) minmax(0, 1fr);
  gap: 2px 10px;
}

.news-list li span:last-child {
  color: var(--muted);
}

@media (max-width: 560px) {
  .news-list li {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .news-list li span:last-child {
    grid-column: 1 / -1;
  }
}

.news-warn {
  font-size: var(--step--1);
  padding: 6px 10px;
  border-radius: var(--radius-control);
  box-shadow: inset 3px 0 0 var(--warn);
  background: var(--paper);
}

/* Warnings from the trader's own trades, right above the lock button. */
.own-warn {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  box-shadow: inset 3px 0 0 var(--warn);
  background: var(--paper);
  font-size: var(--step--1);
}

.own-warn-title {
  margin: 0;
  font-weight: 600;
}

.own-warn ul {
  margin: 0;
  padding-left: 1.1em;
  display: grid;
  gap: 6px;
}

.own-warn .hint {
  margin: 0;
}

.chip-signal {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.chip-signal.signal {
  border-color: var(--stop);
  color: var(--stop);
  font-weight: 600;
}

.tag.news-tag {
  border-color: var(--warn);
}

/* The short verdict at the top of the Trades tab */
.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-block: 16px 20px;
}

.summary > * {
  min-width: 0;
}

.summary h1 {
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 750;
}

.summary .button {
  justify-self: start;
}

@media (min-width: 760px) {
  .summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 320px) auto;
    gap: 20px;
  }
}

.strip.mini {
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 3px;
  max-width: none;
}

.strip.mini span {
  height: 14px;
  border-radius: 3px;
}

@media (max-width: 640px) {
  .strip.mini {
    gap: 2px;
  }
}

/* Results: the dates to look at */
.range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
  padding-top: 8px;
}

.range > * {
  min-width: 0;
}

.range select,
.range input {
  height: 44px;
}

.range > .field:nth-child(-n + 2),
.range .range-line {
  grid-column: 1 / -1;
}

@media (min-width: 560px) {
  .range > .field:nth-child(-n + 2) {
    grid-column: auto;
  }
}

@media (min-width: 960px) {
  .range {
    grid-template-columns: minmax(0, 210px) minmax(0, 170px) minmax(0, 160px) minmax(0, 160px) minmax(0, 1fr);
  }

  .range .range-line {
    grid-column: auto;
    padding-bottom: 12px;
  }
}

/* Lock form: position size */
.size {
  gap: 8px;
}

.size .grid-3 {
  align-items: end;
}

input[readonly] {
  color: var(--muted);
  background: transparent;
}

.size .hint .button.quiet {
  min-height: 32px;
  padding: 0 4px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Strategies tab */
.strategies-view {
  display: grid;
  gap: 16px;
  padding-block: 16px 40px;
  grid-template-columns: minmax(0, 1fr);
}

.strategies-view > * {
  min-width: 0;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.view-lead {
  max-width: 70ch;
}

.strategy-form {
  max-width: 760px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy-list {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .strategy-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.strategy-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.strategy-head h2 {
  margin-right: auto;
  overflow-wrap: anywhere;
}

.strategy-stats {
  font-size: var(--step--1);
  color: var(--muted);
}

.strategy-stats b {
  color: var(--ink);
}

.rules {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0;
  font-size: var(--step--1);
}

.rules dt {
  font-weight: 600;
  color: var(--muted);
}

.rules dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rules-box {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--paper);
}

/* The rule lab: tick boxes in the lock form, and a card per rule in Strategies. */
.rule-ticks {
  display: grid;
  gap: 8px;
}

.rule-tick-list {
  display: grid;
  gap: 6px;
}

.rule-tick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.rule-tick input {
  margin-top: 3px;
  flex: none;
  width: 18px;
  height: 18px;
}

.rule-tick:has(input:checked) {
  border-color: var(--target);
}

.rule-lab {
  display: grid;
  gap: 12px;
}

.rule-form {
  display: grid;
  gap: 10px;
}

.rule-form .button {
  justify-self: start;
}

.rule-list {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .rule-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.rule-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.rule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.rule-text {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.rule-verdict {
  flex: none;
  font-size: var(--step--1);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.rule-verdict.helps {
  color: var(--target);
  border-color: var(--target);
  font-weight: 600;
}

.rule-verdict.hurts {
  color: var(--stop);
  border-color: var(--stop);
  font-weight: 600;
}

.rule-meta {
  margin: 0;
}

.rule-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.rule-progress-fill {
  height: 100%;
  background: var(--target);
}

.rule-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.rule-sides dt {
  font-size: var(--step--1);
  color: var(--muted);
}

.rule-sides dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.rule-why {
  margin: 0;
  font-size: var(--step--1);
}

.rule-added {
  margin: 0;
  font-size: var(--step--1);
  color: var(--target);
  font-weight: 600;
}

.rules-title {
  font-size: var(--step--1);
  font-weight: 600;
}

.archived summary {
  cursor: pointer;
  font-size: var(--step--1);
  color: var(--muted);
  padding-block: 6px;
}

.archived-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.archived-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

/* Import tab */
.import-view {
  display: grid;
  gap: 16px;
  padding-block: 16px 40px;
  grid-template-columns: minmax(0, 1fr);
}

.import-view > * {
  min-width: 0;
}

/* The real file input stays focusable; its label is the visible button. */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.file-input:focus-visible + .file-button {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 10px 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--step--1);
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--ink);
}

.import-result {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  padding-block: 8px;
}

.import-result > * {
  min-width: 0;
}

.import-head h2 {
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 750;
}

.import-head .why {
  margin-top: 6px;
  color: var(--muted);
  max-width: 70ch;
}

.import-head .hint {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

/* The running total: one 2px line on a hairline at zero */
.equity {
  margin: 0;
  display: grid;
  gap: 8px;
}

.equity-plot {
  position: relative;
  height: 220px;
  border-radius: var(--radius-control);
  touch-action: pan-y;
}

.equity-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.equity-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.equity .zero {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.equity .cross {
  stroke: var(--muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.equity-axis,
.equity-end {
  position: absolute;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  pointer-events: none;
}

.equity-axis.top {
  top: 0;
  left: 0;
}

.equity-axis.bottom {
  bottom: 0;
  left: 0;
}

.equity-end {
  right: 0;
  transform: translateY(-130%);
  color: var(--ink);
  font-weight: 650;
}

.equity-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
}

.equity-tip {
  position: absolute;
  transform: translate(12px, -50%);
  display: grid;
  gap: 2px;
  min-width: 140px;
  max-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(10, 16, 22, 0.12);
  font-size: var(--step--1);
  pointer-events: none;
  z-index: 2;
}

.equity-tip.flip {
  transform: translate(calc(-100% - 12px), -50%);
}

.equity-tip strong {
  font-size: var(--step-0);
  font-variant-numeric: tabular-nums;
}

.equity-tip span {
  color: var(--muted);
}

.equity-plot:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.all-trades summary,
.import-list .link {
  cursor: pointer;
}

.all-trades summary {
  font-size: var(--step--1);
  color: var(--muted);
  padding-block: 6px;
}

.import-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.import-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.import-list li:last-child {
  border-bottom: 0;
}

.import-list li.current .link {
  font-weight: 700;
}

.import-list .hint {
  margin-right: auto;
}

.link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  text-align: left;
}

/* Results: locked trades or imported ones */
.results-source {
  border: 0;
  padding: 0;
  margin: 12px 0 4px;
  max-width: 460px;
}

/* AI analysis tab */
.ai-view {
  display: grid;
  gap: 16px;
  padding-block: 16px 40px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 780px;
}

.ai-view > * {
  min-width: 0;
}

.ai-usage {
  font-weight: 600;
  margin-bottom: 12px;
}

/* The AI service's own words after a failure, for whoever looks into it. */
.ai-detail {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ai-progress::before {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 8px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: ai-spin 0.9s linear infinite;
}

@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-progress::before {
    animation: none;
  }
}

.ai-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

/* What the analysis says to do. The colors follow the ones chosen for winning and losing trades. */
.ai-decision {
  display: inline-block;
  font-size: var(--step--1);
  font-weight: 700;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  white-space: nowrap;
}

.ai-decision.keep {
  color: var(--target);
}

.ai-decision.adjust {
  color: var(--warn);
}

.ai-decision.stop {
  color: var(--stop);
}

.ai-decision.too_early {
  color: var(--muted);
}

.ai-decision.small {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 8px;
}

.ai-headline {
  font-size: var(--step-2);
  line-height: 1.3;
  margin: 12px 0 6px;
}

.ai-summary {
  margin-bottom: 6px;
}

.ai-result h3 {
  font-size: var(--step-0);
  margin: 22px 0 8px;
}

.ai-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.2em;
}

ul.ai-list {
  list-style: none;
  padding-left: 0;
}

.ai-list p {
  margin-top: 4px;
}

.ai-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.ai-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
}

/* What the trader does well: a check in the win colour, the text in the normal ink. */
.ai-strengths {
  list-style: none;
  padding-left: 0;
}

.ai-strengths li {
  position: relative;
  padding-left: 1.5em;
}

.ai-strengths li::before {
  content: "✓";
  position: absolute;
  left: 0.2em;
  color: var(--target);
  font-weight: 700;
}

.ai-result .row-actions {
  margin-top: 22px;
}

.ai-history {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ai-history li + li {
  border-top: 1px solid var(--line);
}

.ai-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ai-history-item .hint {
  grid-column: 1 / -1;
}

.ai-history-item[aria-current="true"] .ai-history-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-history-item:disabled {
  cursor: default;
  opacity: 0.7;
}

.link.danger {
  color: var(--stop);
}

/* Settings tab */
.settings-view {
  display: grid;
  gap: 20px;
  padding-block: 16px 40px;
  max-width: 680px;
}

.settings-view > * {
  min-width: 0;
}

.view-title {
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.settings {
  display: grid;
  gap: 20px;
}

.settings > * {
  min-width: 0;
}

.settings-view .sheet > .button,
.settings-actions .button {
  justify-self: start;
}

/* Settings: how to put EdgeCheck on the home screen, one line per kind of device. */
.install-steps {
  display: grid;
  gap: 12px;
}

.install-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.install-list li {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  gap: 2px 12px;
}

@media (max-width: 480px) {
  .install-list li {
    grid-template-columns: minmax(0, 1fr);
  }
}

.settings-actions {
  display: flex;
}

.notice {
  font-size: var(--step--1);
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-control);
  padding: 8px 12px;
}

.account-email {
  font-size: var(--step--1);
  color: var(--muted);
  text-decoration: none;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.notice .button.quiet {
  min-height: 32px;
  padding: 0 4px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice.warn {
  color: var(--stop);
  border-color: color-mix(in srgb, var(--stop) 40%, var(--line));
}

/* A newer version of the site is live: say so, with a button to reload. */
.update-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  color: var(--ink);
  border-style: solid;
  border-color: var(--target);
  margin-bottom: 12px;
}

.verdict {
  padding-block: 20px 28px;
  display: grid;
  gap: 18px;
}

.verdict h1 {
  font-size: var(--step-4);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 750;
}

.verdict .why {
  margin-top: 8px;
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 62ch;
}

/* The test strip: one cell per closed trade, 30 to a row. */
.strip {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 4px;
  max-width: 900px;
}

@media (max-width: 640px) {
  .strip {
    grid-template-columns: repeat(15, minmax(0, 1fr));
  }
}

.strip span {
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
}

.strip span.target {
  background: var(--target);
  border-color: var(--target);
}

.strip span.stop {
  background: var(--stop);
  border-color: var(--stop);
}

.strip span.early {
  background: var(--luck);
  border-color: var(--luck);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: var(--step--1);
  color: var(--muted);
}

.legend .key::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
  background: var(--k);
}

.legend .count {
  color: var(--ink);
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 0;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
}

.stats div {
  border-top: 1.5px solid var(--ink);
  padding-top: 10px;
  min-width: 0;
}

.stats dt {
  font-size: var(--step--1);
  color: var(--muted);
}

.stats dd {
  margin: 0;
}

.stats .big {
  font-size: var(--step-2);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stats .small {
  font-size: var(--step--1);
  color: var(--muted);
}

.versus {
  display: grid;
  gap: 8px;
  max-width: 560px;
}

.versus-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  font-size: var(--step--1);
}

.versus-track {
  height: 10px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}

.versus-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--ink);
  transition: width 0.35s ease;
}

.versus-fill.luck {
  background: var(--luck);
}

.versus-row .num {
  text-align: right;
}

.layout {
  display: grid;
  gap: 20px;
  padding-bottom: 20px;
}

.column.review {
  padding-bottom: 40px;
}

.show-all {
  justify-self: start;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
    align-items: start;
  }
}

.column {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  padding: 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.sheet h2 {
  font-size: var(--step-2);
  line-height: 1.25;
}

/* The buttons move under the title when a long title and two buttons don't fit (German on a phone). */
.sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.sheet-head .count {
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sheet-head .spacer {
  flex: 1;
}

.hint {
  font-size: var(--step--1);
  color: var(--muted);
}

form.lock {
  display: grid;
  gap: 12px;
}

.calc {
  font-size: var(--step--1);
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}

.calc.bad {
  color: var(--stop);
}

.empty {
  color: var(--muted);
  font-size: var(--step--1);
}

.trades {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.trade {
  display: grid;
  gap: 8px;
  padding-block: 14px;
  border-top: 1px solid var(--line);
}

.trade:first-child {
  border-top: 0;
  padding-top: 2px;
}

.trade-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.symbol {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: 0.01em;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.trade-top .when {
  margin-left: auto;
  font-size: var(--step--1);
  color: var(--muted);
}

.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  font-size: var(--step--1);
  color: var(--muted);
}

.levels b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trade .note {
  font-size: var(--step--1);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.closeform {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.closeform .full {
  grid-column: 1 / -1;
}

.closeform .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-box {
  overflow-x: auto;
  margin-inline: -4px;
  padding-inline: 4px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--step--1);
}

table.wide {
  min-width: 560px;
}

table .symbol {
  font-size: inherit;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: var(--muted);
}

td.r,
th.r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.outcome {
  font-weight: 600;
}

.outcome.target {
  color: var(--target);
}

.outcome.stop {
  color: var(--stop);
}

.outcome.early {
  color: var(--muted);
}

.patterns {
  display: grid;
  gap: 18px;
}

/* Wide enough for five columns in every language: two tables side by side on a laptop. */
@media (min-width: 720px) {
  .patterns {
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 24px;
  }
}

/* Long group names, such as "Без ясен тренд", may wrap instead of pushing the numbers out. */
.patterns td:first-child {
  white-space: normal;
}

.patterns > .signal-hint {
  grid-column: 1 / -1;
  margin: 0;
}

/* Signal or noise: only a difference that is not chance gets colour. */
td.signal {
  white-space: normal;
  min-width: 7em;
  color: var(--muted);
}

td.signal.up {
  color: var(--target);
  font-weight: 600;
}

td.signal.down {
  color: var(--stop);
  font-weight: 600;
}

.patterns h3 {
  font-size: var(--step-0);
  margin-bottom: 4px;
}

/* Import tables have six columns, so each gets the whole width. */
.patterns.wide {
  grid-template-columns: minmax(0, 1fr);
}

.patterns.wide table {
  max-width: 860px;
}

/* The calendar on the Results tab: each day tinted by its result, the stronger the bigger. */
.calendar {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.calendar-sheet {
  margin-bottom: 20px;
}

/* Results: will I pass the prop exam? */
.prop-sheet {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.prop-form {
  display: grid;
  gap: 12px;
}

.prop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 10px 12px;
  align-items: end;
}

.prop-result {
  display: grid;
  gap: 8px;
}

.prop-result h3 {
  margin: 14px 0 2px;
  font-size: var(--step-0);
}

.prop-big {
  font-size: var(--step-1);
}

.prop-pct {
  font-size: var(--step-3);
  font-variant-numeric: tabular-nums;
}

.prop-bars {
  display: grid;
  gap: 8px;
  max-width: 560px;
}

.prop-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  font-size: var(--step--1);
}

.prop-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.prop-track {
  height: 10px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}

.prop-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.35s ease;
}

.prop-fill.pass {
  background: var(--target);
}

.prop-fill.fail {
  background: var(--stop);
}

.prop-fill.slow {
  background: var(--luck);
}

.prop-warn {
  color: var(--warn);
  font-weight: 600;
}

.prop-sizes tr.best td {
  font-weight: 700;
}

/* Inside the analysis of imported trades it starts a new part. */
.results-imported .calendar {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.cal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.cal-head h2,
.cal-head h3 {
  margin-right: auto;
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.cal-month {
  min-width: 9.5em;
  text-align: center;
  font-weight: 600;
}

.button.cal-step {
  min-width: 44px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
}

.cal-unit .seg label {
  min-height: 36px;
  min-width: 52px;
}

.cal-summary {
  color: var(--muted);
  font-size: var(--step--1);
}

.cal-summary strong {
  font-size: var(--step-0);
  font-variant-numeric: tabular-nums;
}

table.cal {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 4px;
  width: calc(100% + 8px);
  margin: -4px;
}

.cal th,
.cal td {
  border: 0;
  padding: 0;
  white-space: nowrap;
}

.cal th {
  text-align: center;
  font-size: 0.75rem;
  padding-bottom: 2px;
}

.cal th.cal-week-h {
  width: 13%;
  text-align: right;
  padding-right: 6px;
}

.cal td {
  vertical-align: top;
  border-radius: 8px;
}

.cal td.cal-day {
  background: color-mix(in srgb, var(--paper) 60%, var(--surface));
}

.cal td.cal-win {
  background: color-mix(in srgb, var(--target) var(--mix, 24%), var(--surface));
}

.cal td.cal-loss {
  background: color-mix(in srgb, var(--stop) var(--mix, 24%), var(--surface));
}

.cal td.cal-flat {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.cal td.cal-picked {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.cal-day > .cal-date,
.cal-day button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
  width: 100%;
  min-height: 66px;
  padding: 6px 7px;
}

.cal-day button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cal-day button:hover {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.cal-day button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.cal-date {
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* On a coloured day every text is in the ink colour, which stays readable on any tint. */
.cal-win .cal-date,
.cal-loss .cal-date,
.cal-today .cal-date {
  color: var(--ink);
}

.cal-today .cal-date {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cal-value {
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.cal-count {
  font-size: 0.6875rem;
  line-height: 1.2;
}

.cal td.cal-week {
  vertical-align: middle;
  text-align: right;
  padding: 6px 6px 6px 8px;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.cal-week .cal-value,
.cal-week .cal-count {
  display: block;
}

.cal-week .cal-count {
  color: var(--muted);
}

.cal-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.cal-detail h3,
.cal-detail h4 {
  font-size: var(--step-0);
}

/* On a phone: seven narrow days. The week's totals and the number of trades are left out. */
@media (max-width: 560px) {
  table.cal {
    border-spacing: 3px;
    width: calc(100% + 6px);
    margin: -3px;
  }

  .cal th.cal-week-h,
  .cal td.cal-week,
  .cal-count {
    display: none;
  }

  .cal-day > .cal-date,
  .cal-day button {
    min-height: 50px;
    padding: 4px;
  }

  .cal-value {
    font-size: 0.6875rem;
    letter-spacing: -0.02em;
  }

  .cal th {
    font-size: 0.6875rem;
  }

  .cal-month {
    min-width: 8em;
  }
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--surface);
  color: var(--ink);
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}

dialog::backdrop {
  background: rgba(10, 16, 22, 0.45);
}

dialog form {
  display: grid;
  gap: 14px;
}

dialog h2 {
  font-size: var(--step-2);
}

/* Password with a show/hide button inside the field */
.password-box {
  position: relative;
}

.password-box input {
  padding-right: 52px;
}

.eye {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.eye:hover {
  color: var(--ink);
}

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

.eye[aria-pressed="true"] .eye-open,
.eye[aria-pressed="false"] .eye-closed {
  display: none;
}

.button.suggest {
  justify-self: start;
  min-height: 36px;
  padding: 0 2px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--on-ink);
  padding: 10px 16px;
  border-radius: var(--radius-control);
  font-size: var(--step--1);
  font-weight: 600;
  max-width: calc(100vw - 32px);
  z-index: 10;
}

.toast[hidden] {
  display: none;
}

/* ---------- Public pages ---------- */

.eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.verdict-body,
.public-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.public-layout {
  gap: 20px;
  padding-bottom: 40px;
}

.verdict-body > *,
.public-layout > * {
  min-width: 0;
}

.trade.sealed .symbol {
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--muted);
}

tr.late td {
  color: var(--muted);
}

.tag.late {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  border-style: dashed;
}

.how {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: var(--step--1);
  color: var(--muted);
  max-width: 75ch;
}

.how strong {
  color: var(--ink);
}

/* Settings: colors for winning and losing trades */
.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.swatch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

:root[data-theme="dark"] .swatch {
  background: var(--sw-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .swatch {
    background: var(--sw-dark);
  }
}

.swatch-input:checked + .swatch,
input[type="color"].color-pick.chosen {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}

.swatch-input:focus-visible + .swatch {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

/* Any color: a rainbow until a color of one's own is chosen */
input[type="color"].color-pick {
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#e11d48, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #e11d48);
  cursor: pointer;
}

input[type="color"].color-pick::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"].color-pick::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

input[type="color"].color-pick::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

input[type="color"].color-pick:not(.chosen)::-webkit-color-swatch {
  opacity: 0;
}

input[type="color"].color-pick:not(.chosen)::-moz-color-swatch {
  opacity: 0;
}

.strip.sample {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  max-width: 360px;
}

.strip.sample span {
  height: 18px;
}

/* Settings: the public page */
.public-details {
  display: grid;
  gap: 10px;
}

.public-box .hint {
  overflow-wrap: anywhere;
}

.public-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: var(--step--1);
  min-width: 0;
}

.public-link a {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.notice a {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 420px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 > :last-child {
    grid-column: 1 / -1;
  }

  .versus-row {
    grid-template-columns: 108px minmax(0, 1fr) 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .versus-fill {
    transition: none;
  }
}

/* Help: the button in the header and its window */
.help-button {
  position: relative;
  gap: 6px;
  padding-inline: 10px;
}

.help-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.help-dot {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--stop);
  border: 2px solid var(--paper);
}

@media (max-width: 420px) {
  .help-button span:not(.help-mark):not(.help-dot) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

dialog.help-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  display: grid;
  gap: 18px;
}

dialog.help-dialog:not([open]) {
  display: none;
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.help-part {
  display: grid;
  gap: 10px;
}

.help-part h3 {
  font-size: var(--step-0);
}

.help-faq {
  display: grid;
  border-top: 1px solid var(--line);
}

.help-q {
  border-bottom: 1px solid var(--line);
}

.help-q summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
}

.help-q p {
  padding: 0 0 12px;
  color: var(--muted);
}

.help-form {
  display: grid;
  gap: 10px;
}

.help-answer {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
}

.help-answer-text,
.help-reply {
  white-space: pre-line;
}

.help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.help-list li {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.help-from {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--target);
}

.help-waiting {
  font-size: var(--step--1);
  color: var(--warn);
  font-weight: 600;
}

/* Chart pictures: picked when locking, opened from a trade */
.chart-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.chart-pick input:focus-visible + label {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.chart-thumb {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.chart-link {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  padding: 0;
  vertical-align: middle;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.chart-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

dialog.chart-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  display: grid;
  gap: 12px;
}

dialog.chart-dialog:not([open]) {
  display: none;
}

.chart-full {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* The price check: a mark beside a trade's outcome, and the summary under the closed trades.
   The glyph says it too, so the color is never the only sign. */
.check-chip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  vertical-align: 1px;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--on-ink);
  background: var(--muted);
}

.check-chip.match {
  background: var(--target);
}

.check-chip.mismatch {
  background: var(--stop);
}

.check-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.check-box p {
  margin: 0;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.check-list .check-chip {
  margin-left: 0;
  align-self: center;
}

.check-list .when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* The end of the beta: the note where the lock form was, and the three questions */
.beta-paused {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  border-radius: var(--radius-control);
  box-shadow: inset 3px 0 0 var(--warn);
}

.beta-paused p {
  margin: 0;
}

dialog.survey-dialog form {
  gap: 16px;
}

#survey-title:focus {
  outline: none;
}

dialog.survey-dialog legend {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: var(--step-0);
  font-weight: 600;
}

/* Signed out on a site that asks for an account first: only the brand, the sign-in and the footer */
.gate-only {
  display: none;
}

body.gate .gate-only {
  display: block;
}

body.gate .tabs,
body.gate main,
body.gate #open-help,
body.gate #open-auth,
body.gate #account-email,
body.gate #auth-cancel {
  display: none !important;
}

body.gate #auth {
  position: static;
  margin: 24px auto 48px;
}
