/* The Hazard Board — industrial safety-sign styling */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --eazo-safe-area-top: max(56px, env(safe-area-inset-top, 0px));
  --eazo-safe-area-bottom: max(34px, env(safe-area-inset-bottom, 0px));
  --yellow: #ffc21c;
  --yellow-pale: #fff5d9;
  --black: #16181d;
  --cell: #f1f2f6;
  --cell-line: #d6d8e0;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo,
    Consolas, "Noto Sans Mono CJK SC", "PingFang SC", "Microsoft YaHei",
    "Courier New", monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--yellow);
  color: var(--black);
  font-family: var(--mono);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* --- hazard stripe frame (decorative, fixed to viewport edges) --- */
.hazard-frame { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.hazard-frame .hz { position: absolute; display: block; }
.hazard-frame .hz-top,
.hazard-frame .hz-bottom {
  left: 0; right: 0; height: 18px;
  background: repeating-linear-gradient(45deg, #ffd500 0 16px, #15171c 16px 32px);
}
/* the frame lives inside the safe-area box, never under host chrome */
.hazard-frame .hz-top { top: var(--eazo-safe-area-top); }
.hazard-frame .hz-bottom { bottom: var(--eazo-safe-area-bottom); }
.hazard-frame .hz-left,
.hazard-frame .hz-right {
  top: var(--eazo-safe-area-top);
  bottom: var(--eazo-safe-area-bottom);
  width: 18px;
  background: repeating-linear-gradient(-45deg, #ffd500 0 16px, #15171c 16px 32px);
}
.hazard-frame .hz-left { left: 0; }
.hazard-frame .hz-right { right: 0; }

/* --- app shell: owns the safe-area insets --- */
.shell {
  padding-top: var(--eazo-safe-area-top);
  padding-bottom: var(--eazo-safe-area-bottom);
  padding-left: 22px;
  padding-right: 22px;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
}

/* --- masthead: language toggle, enamel plate, one-line instruction --- */
.masthead { padding-top: 10px; }

.langbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 12px; }
.lang-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  background: var(--black); color: #fff;
  border: 2px solid var(--black); border-radius: 999px;
  padding: 6px 26px 6px 14px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.lang-select:focus-visible { outline: 3px solid #5a6cff; outline-offset: 2px; }

/* white enamel plate with bolts, double outline and hard drop shadow */
.title-plate {
  position: relative;
  display: inline-block;
  background: #fdfdf8;
  border: 2px solid var(--black);
  border-radius: 16px;
  box-shadow: 0 0 0 4px #fdfdf8, 0 0 0 7px var(--black), 7px 8px 0 rgba(20, 0, 0, .3);
  padding: 15px 28px 17px;
  transform: rotate(-1.8deg);
  margin: 2px 0 4px 6px;
  max-width: 100%;
}
.title-plate::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid var(--black);
  border-radius: 11px;
  pointer-events: none;
}
.plate-title {
  font-family: var(--mono);
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.12;
  white-space: nowrap;
  color: var(--black);
}
.bolt {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a9099, #1c1f26 60%, #0a0c10);
  box-shadow: 0 1px 1px rgba(0,0,0,.55);
  z-index: 2;
}
.bolt-tl { top: 7px; left: 7px; }
.bolt-tr { top: 7px; right: 7px; }
.bolt-bl { bottom: 7px; left: 7px; }
.bolt-br { bottom: 7px; right: 7px; }

.instruction {
  font-size: 13px; line-height: 1.5; max-width: 56ch;
  margin-top: 14px; padding: 9px 12px;
  background: rgba(255,255,255,.42);
  border-left: 5px solid var(--black);
  font-weight: 700;
  opacity: 0.92;
}
/* --- report card --- */
.report-card {
  position: relative;
  overflow: hidden;
  margin: 18px 0 30px;
  background: var(--black);
  color: #fff;
  border: 3px solid var(--black);
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 7px 0 rgba(60, 20, 0, .35);
}
.report-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 61, 21, .28), transparent);
  transform: translateX(-100%);
  animation: hazard-sweep 5s infinite;
  pointer-events: none;
}
@keyframes hazard-sweep {
  0% { transform: translateX(-100%); }
  55% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.report-line {
  font-size: 13px; line-height: 1.45; padding: 6px 0;
  position: relative;
}
.report-line .rl-label {
  display: block;
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: #ffd500; padding-top: 2px; margin-bottom: 4px;
}
.report-line .rl-value { display: block; }
.report-actions { display: flex; gap: 10px; margin-top: 12px; position: relative; }
.btn {
  font-family: var(--mono); font-size: 13px; font-weight: 900;
  border-radius: 999px; padding: 9px 20px; cursor: pointer;
  letter-spacing: 0.04em; border: 2px solid transparent;
  min-height: 44px;
}
.btn:focus-visible { outline: 3px solid #8fa0ff; outline-offset: 2px; }
.btn-share { background: #ffc21c; color: var(--black); border-color: #ffc21c; }
.btn-share:active { transform: translateY(1px); }
.btn-share.is-pending { opacity: .7; }
.btn-share.is-pending-visible { animation: share-pulse .5s ease-in-out infinite alternate; }
@keyframes share-pulse { from { opacity: .55; } to { opacity: 1; } }
.btn-refresh { background: transparent; color: #fff; border-color: #fff; }
.btn-refresh:active { transform: translateY(1px); }

/* --- the board and its rows --- */
.board { display: flex; flex-direction: column; gap: 30px; padding-bottom: 26px; }

.row { display: flex; flex-direction: column; filter: drop-shadow(0 8px 0 rgba(60, 20, 0, .22)); }
.row-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--black); color: #fff;
  border-radius: 12px 12px 0 0;
  padding: 7px 10px 8px;
  gap: 8px;
}
.row-title-wrap { flex: 1; min-width: 0; text-align: center; }
.row-title {
  font-size: 15px; font-weight: 900; letter-spacing: 0.03em;
  text-transform: uppercase; text-align: center;
  line-height: 1.4em;
  white-space: normal; overflow: visible; text-overflow: clip;
}
.row-title .row-prefix { opacity: .6; font-weight: 700; }
.row-title .row-keep { white-space: nowrap; }
.lamp {
  flex: 0 0 auto; position: relative;
  width: 12px; height: 12px; border-radius: 50%;
}
.lamp::before, .lamp::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.lamp::after {
  inset: -22.5%; /* same-colour halo at 1.45x */
  background: var(--lamp-color, #f5b31e);
  opacity: .10;
  animation: lamp-breathe 2.5s ease-in-out var(--lamp-delay, 0s) infinite alternate-reverse;
}
.lamp::before {
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: lamp-flash 2.5s ease-in-out var(--lamp-delay, 0s) infinite alternate-reverse;
}
@keyframes lamp-breathe { from { opacity: .10; } to { opacity: .40; } }
@keyframes lamp-flash { from { opacity: 0; } to { opacity: .35; } }

/* severity drives lamp + footer rule colour */
.row.sev-1 .lamp { background: #f5b31e; --lamp-color: #f5b31e; }
.row.sev-2 .lamp { background: #f0961c; --lamp-color: #f0961c; }
.row.sev-3 .lamp { background: #e8751a; --lamp-color: #e8751a; }
.row.sev-4 .lamp { background: #e05616; --lamp-color: #e05616; }
.row.sev-5 .lamp { background: #d93a12; --lamp-color: #d93a12; }

.info-btn {
  flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #fff; background: transparent; color: #fff;
  font-family: var(--mono); font-size: 16px; font-weight: 900; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 0 1px;
}
.info-btn:focus-visible { outline: 3px solid #8fa0ff; outline-offset: 2px; }
.info-btn:active { background: rgba(255,255,255,.22); }
/* --- digit strip: eight cells, mechanical LCD faces --- */
.digits {
  display: flex; gap: 3px;
  background: var(--cell-line);
  padding: 3px;
  border: 1px solid #c9cbd4;
  border-top: none;
}
.digit-cell {
  flex: 1 1 0; min-width: 0;
  background: var(--cell);
  display: flex; align-items: center; justify-content: center;
  padding: 2px 0;
}
.digit-svg { display: block; width: 100%; height: auto; max-width: 46px; }
.digit-svg .seg { fill: var(--black); }
.digit-svg .seg.off { fill: #e3e4ea; }
/* Ghost slots: only the lit segments remain, faded near the reference's 13%
 * black — no unlit-segment backing, so every ghost slot reads as a 0. */
.digit-cell.ghost .digit-svg .seg { opacity: 0.13; }
.digit-cell.ghost .digit-svg .seg.off { opacity: 0; }

/* --- footer strip --- */
.row-foot {
  background: var(--yellow-pale);
  border-radius: 0 0 12px 12px;
  padding: 9px 12px 7px;
  text-align: center;
  border: 1px solid #ecd9a8;
  border-top: none;
}
.row-foot p { font-size: 12px; line-height: 1.5; opacity: 0.74; }
.row-foot .foot-prefix { opacity: .5; }
.row-foot a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}
.row-foot a:focus-visible { outline: 2px solid #5a6cff; outline-offset: 2px; }
.foot-rule { display: block; height: 3px; margin: 7px -13px -8px; border-radius: 0 0 10px 10px; }
.row.sev-1 .foot-rule { background: #f5b31e; }
.row.sev-2 .foot-rule { background: #f0961c; }
.row.sev-3 .foot-rule { background: #e8751a; }
.row.sev-4 .foot-rule { background: #e05616; }
.row.sev-5 .foot-rule { background: #d93a12; }

.board-foot { padding: 8px 0 4px; text-align: center; }
.board-foot p { font-size: 11px; opacity: 0.65; }
/* --- modal --- */
html.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.8);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  padding-top: var(--eazo-safe-area-top);
  padding-bottom: var(--eazo-safe-area-bottom);
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  position: relative;
  background: #ffc100;
  border-radius: 16px;
  border: 3px solid var(--black);
  box-shadow: 0 10px 0 rgba(0,0,0,.45);
  width: 100%; max-width: 440px;
  padding: 26px 22px 20px;
  color: var(--black);
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--black); background: var(--black); color: #ffc100;
  font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:focus-visible { outline: 3px solid #5a6cff; outline-offset: 2px; }
.modal-title { font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 12px; padding-right: 40px; }
.modal-body p { font-size: 13px; line-height: 1.58; }
.modal-body p.modal-text { margin-bottom: 14px; }
.modal-body em { font-style: italic; }
.scale-table { width: 100%; border-collapse: collapse; margin: 2px 0 14px; font-size: 12px; }
.scale-table th, .scale-table td {
  border: 1px solid var(--black); padding: 7px 9px; text-align: left;
}
.scale-table th { font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; background: #fff6b7; }
.scale-table tr:nth-child(2) td { background: #fff0a3; }
.scale-table tr:nth-child(3) td { background: #ffd979; }
.scale-table tr:nth-child(4) td { background: #ffbb4b; }
.scale-table tr:nth-child(5) td { background: #ff9830; }
.scale-table tr:nth-child(6) td { background: #ff6d14; }
.modal-attrib { margin-top: 10px; font-size: 10.5px; opacity: 0.72; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--eazo-safe-area-bottom) + 18px);
  transform: translateX(-50%);
  background: var(--black); color: #fff;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; z-index: 90;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}

@media (max-width: 380px) {
  .row-title { font-size: 13px; }
  .shell { padding-left: 14px; padding-right: 14px; }
  .report-line { font-size: 12px; }
  .plate-title { font-size: 17px; letter-spacing: 0.02em; }
}

@media (min-width: 900px) {
  .shell { max-width: 760px; }
  .board { gap: 34px; }
}
/* ---END PART 4--- */
