/* TelecomEngine — dark, mobile-first, outdoor-readable. */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c232c;
  --border:    #30363d;
  --text:      #ffffff;
  --text-dim:  #b6c0cc;
  --accent:    #2f81f7;
  --tap:       48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* ---- header ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px) * 0);
}

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .3px;
}

.crumbs {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-dim);
  min-height: 20px;
}

.crumbs a {
  color: var(--accent);
  text-decoration: none;
}

.crumbs .sep { padding: 0 6px; color: var(--border); }

/* ---- layout ---- */

.view {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 48px;
}

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 24px 0 10px; color: var(--text-dim);
     text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }

.sub { color: var(--text-dim); font-size: 15px; margin: 0 0 16px; }

/* ---- cards ---- */

.card {
  display: block;
  width: 100%;
  min-height: var(--tap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.card:active { background: var(--surface-2); }

.card-title { font-size: 20px; font-weight: 600; }
.card-meta  { font-size: 15px; color: var(--text-dim); margin-top: 4px; }
.card-go    { float: right; color: var(--accent); font-size: 22px; line-height: 1; }

/* ---- key/value strip ---- */

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--text-dim); text-transform: uppercase;
         letter-spacing: .6px; margin: 0; }
.kv dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; }


/* ---- instruction rows ---- */

.rows { list-style: none; margin: 0; padding: 0; }

.row {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 16px;
  margin-bottom: 12px;
  min-height: var(--tap);
}

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

.row-action {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
}

.row-fibers {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dim);
}

.row-dest {
  font-size: 20px;
  margin-top: 6px;
}

.row-dest .arrow { color: var(--text-dim); padding-right: 6px; }

.row-detail {
  font-size: 15px;
  color: var(--text-dim);
  margin-top: 6px;
}

.chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- fiber color chip ---- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px 4px 5px;
}

.chip-sq {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .55);
  display: inline-block;
}

.chip-txt { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- notes ---- */

.notes { list-style: none; margin: 0; padding: 0; }
.notes li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 16px;
  color: var(--text-dim);
}

/* ---- misc ---- */

.empty { color: var(--text-dim); padding: 24px 0; }

/* ---- diagram ---- */

.diagram-wrap { position: relative; }

.diagram {
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
}

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

.fs-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.fs-btn:active { background: var(--accent); border-color: var(--accent); }

/* ---- fullscreen diagram overlay ---- */

body.no-scroll { overflow: hidden; }

.fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.fs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.fs-title { font-size: 17px; font-weight: 600; }

.fs-close {
  min-height: var(--tap);
  min-width: var(--tap);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
}

.fs-close:active { background: var(--accent); }

.fs-stage {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.fs-stage:active { cursor: grabbing; }

.fs-content {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.fs-content svg { display: block; width: 100%; height: 100%; }

/* ---- banners, flags, findings ---- */

.banner {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.45;
  border: 1px solid;
}

.banner-amber { background: #2b2003; border-color: #9e6a03; color: #f2cc60; }
.banner-red   { background: #2d0f0f; border-color: #b62324; color: #ff9492; }
.banner strong { display: block; }
.banner-why { margin-top: 6px; font-size: 14px; opacity: .85; }

.flag {
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 3px 7px;
  border-radius: 5px;
  margin-left: 6px;
}

.flag-amber { background: #9e6a03; color: #fff8e0; }
.flag-red   { background: #b62324; color: #fff0f0; }

.findings { list-style: none; margin: 0; padding: 0; }

.findings li {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
}

.finding-amber { border-left-color: #9e6a03; }
.finding-red   { border-left-color: #b62324; }

.card-demo { border-color: var(--accent); }
.card-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ---- fatal seed failure ---- */

.fatal {
  border: 1px solid #b62324;
  background: #2d0f0f;
  border-radius: 10px;
  padding: 20px;
  color: #ff9492;
}

.fatal h1 { color: #ff9492; }
.fatal ul { padding-left: 20px; }
.fatal li { margin-bottom: 8px; font-size: 14px; }
