/* css/styles.css
   Trade Gate: dark glassmorphism, emerald accent, ICCMAFIA look.
   Reading: a pre-trade self-gate for one trader, dark glass language,
   dial ENERGY 1 / RHYTHM 1 / MOTION 1 (calm, uniform, active states only).
   Purpose of the glass: the rules and the verdict must feel like a console
   readout, not a form. Emerald is used sparingly, only for GO and the
   primary action, so it keeps its meaning. No gradients, no emoji. */

:root {
  --bg: #0a0f0d;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8ece9;
  --muted: #9aa5a0;
  --emerald: #10b981;
  --emerald-dark: #06281d;
  --danger: #ef4444;
  --danger-dark: #2b0f0f;
  --amber: #f59e0b;
  --amber-dark: #2b1d05;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* One view visible at a time. B3 toggles .hidden; B1 also uses the hidden
   attribute, so both must hide, and must beat .view display. */
.hidden,
[hidden] {
  display: none !important;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.view { padding-top: 16px; }

h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 20px 0 12px;
}

h2:first-child { margin-top: 4px; }

p { margin: 0 0 12px; }

/* Header: title is the only 22px bold element, status line stays muted. */
.app-header {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px 4px;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.app-header .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Account status lives in the check view in B1 markup, styled muted. */
.account-status {
  color: var(--muted);
  font-size: 14px;
}

/* Honest banner: amber left border plus amber-tinted glass, so the warning
   reads as a warning before any word is read. */
.honest-banner {
  background: var(--glass);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  margin: 0 0 16px;
}

/* Rules scroll area: capped height so the start button stays reachable,
   with an inset bottom shadow as the scroll affordance. */
#rules-scroll {
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: inset 0 -24px 16px -16px rgba(0, 0, 0, 0.65);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

#rules-scroll::-webkit-scrollbar { width: 6px; }
#rules-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}
#rules-scroll::-webkit-scrollbar-track { background: transparent; }

#rules-scroll h2 { margin-top: 0; }

/* Rules lists: each rule is its own glass card so one rule is readable at
   a glance while scrolling. Numbers come from a CSS counter so the DON'T
   marker and the number sit on one line. */
.rules-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  counter-reset: rule;
}

.rules-list li {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.45;
}

.rules-list li:last-child { margin-bottom: 0; }

.not-list li { counter-increment: rule; }

.not-list li::before {
  content: counter(rule) ". DON'T";
  display: block;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.follow-list li::before {
  content: "\2713";
  color: var(--emerald);
  font-weight: 700;
  margin-right: 8px;
}

.scroll-hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

/* Buttons: primary is the one emerald fill on the screen, full width,
   48px, dark text for contrast. */
.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  color: #04150e;
  background: var(--emerald);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}

.primary-btn:active { background: #0ea371; }

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Secondary action in main views: glass, full width, 48px. */
main .link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}

main .link-btn:active { background: var(--glass-strong); }

/* Danger action: red outline only, used for the clear-log action. */
.danger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}

.danger-btn:active { background: rgba(239, 68, 68, 0.12); }

/* Focus: emerald ring on every interactive element, never removed. */
:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 2px;
}

/* Segmented controls: two-option pill groups, selected option emerald fill.
   aria-pressed is the state hook B3 toggles. */
.segmented {
  display: flex;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
}

.segmented button {
  flex: 1;
  min-height: 48px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.segmented button:active { color: var(--text); }

.segmented button[aria-pressed="true"] {
  background: var(--emerald);
  color: #04150e;
}

.segmented button.selected {
  background: var(--emerald);
  color: #04150e;
}

/* Form fields: dark glass, 48px, 16px font so iOS does not zoom. */
.field { margin-bottom: 14px; }

.field label,
.field-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color-scheme: dark;
}

.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--emerald);
  outline: 2px solid var(--emerald);
  outline-offset: 1px;
}

.field input::placeholder { color: var(--muted); }

/* Risk line: tabular numbers so the dollar figure does not jump as it
   updates. Red only when B3 adds .over past the $50 cap. */
#risk-line {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 16px 0;
}

#risk-line.over {
  color: var(--danger);
  border-color: var(--danger);
  font-weight: 700;
}

/* Verdict screens: full-width tinted glass cards, centered, large word. */
.verdict {
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.verdict h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
}

.verdict p { margin: 0 0 16px; }

.verdict .primary-btn { margin-top: 8px; }

#verdict-no {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.45);
}

#verdict-no h2 { color: var(--danger); }

#verdict-go {
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.45);
}

#verdict-go h2 { color: var(--emerald); }

/* Broken rules: one line per broken rule, left aligned for scanning. */
.broken-rules {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  text-align: left;
}

.broken-rules li {
  background: var(--glass);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 15px;
}

.broken-rules li:last-child { margin-bottom: 0; }

/* Log view: rows are glass cards; B3 renders each entry as .log-entry
   with a .verdict-chip carrying .go or .no. */
.log-summary {
  color: var(--muted);
  font-size: 14px;
}

.log-list { margin-bottom: 8px; }

.log-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.log-entry .log-info {
  flex: 1;
  min-width: 0;
}

.log-entry .log-date {
  font-weight: 600;
  font-size: 15px;
}

.log-entry .log-setup {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.verdict-chip {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.verdict-chip.go {
  color: var(--emerald);
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.10);
}

.verdict-chip.no {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.10);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Settings view: note text muted, selects reuse the form field style. */
.settings-note {
  color: var(--muted);
  font-size: 14px;
}

.honest-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
}

/* Footer nav: small muted text buttons, 44px tap targets, real views only. */
.app-footer {
  max-width: 480px;
  margin: 24px auto 0;
  padding: 0 16px;
  border-top: 1px solid var(--line);
}

.app-footer nav {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

.app-footer .link-btn {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.app-footer .link-btn:active {
  color: var(--text);
  background: var(--glass);
}

/* No-JS fallback: readable, same glass card treatment. */
noscript p {
  max-width: 480px;
  margin: 16px auto;
  padding: 12px 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
}

@media (min-width: 768px) {
  main { padding-top: 8px; }
  #rules-scroll { max-height: 55vh; }
}
