/* Semáforo Inteligente: a quiet layer over the game. Dark glass sheets, one accent (amber, the light in between), the pixel font only
   for the logo and the big numbers, everything else in Inter. css/shell.css gives the page frame, the corner
   buttons, the toasts and the guide below the game. */

body.semaforo {
  --bg: #14161b;
  --glass: rgba(17, 18, 23, 0.82);
  --glass-2: rgba(255, 255, 255, 0.05);
  --edge: rgba(255, 255, 255, 0.09);
  --text: #f2f0ea;
  --muted: #a1a5b0;
  --yellow: #e8b440;
  --yellow-ink: #231900;
  --pink: #ff9ac8;
  --green: #8fdc98;
  --rain: #8fd3ff;
  --r: 16px;
}
body.semaforo .game { background: var(--bg); }
body.semaforo #game { box-shadow: none; }

/* ---------- Sheets ---------- */

.o-sheet {
  position: absolute;
  z-index: 10;
  width: min(420px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px 22px 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  backdrop-filter: blur(12px) saturate(1.15);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  color: var(--text);
  text-align: center;
  scrollbar-width: thin;
  touch-action: pan-y;
  animation: o-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.o-sheet[hidden] { display: none; }
.o-sheet--small { width: min(360px, calc(100% - 28px)); }
@keyframes o-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } }
.o-h { margin: 0 0 6px; font: 800 20px/1.2 var(--body); letter-spacing: -0.01em; }
.o-sub { margin: 0 0 14px; font: 500 14px/1.45 var(--body); color: var(--muted); }
.o-sub--h { margin: 18px 0 8px; color: var(--text); font-weight: 700; text-align: left; }
.o-note { margin: 14px 0 0; font: 500 12px/1.4 var(--body); color: var(--muted); }

/* ---------- Title ---------- */

.o-title { width: min(440px, calc(100% - 28px)); padding-top: 30px; }
.o-logo { margin: 0 0 10px; font: 400 34px/1.15 var(--pixel); color: #f4f1e6; text-shadow: 0 0.11em 0 #000; letter-spacing: 0.02em; }
/* the font squashes accented capitals: the logo's É is a plain E with a pixel acute */
.o-ac { position: relative; display: inline-block; }
.o-ac::before { content: ""; position: absolute; left: 0.5em; top: -0.3em; width: 0.125em; height: 0.125em; background: currentColor; box-shadow: 0.125em -0.125em 0 currentColor, -0.125em 0 0 currentColor, 0 0.08em 0 #000, 0.125em -0.045em 0 #000, -0.125em 0.08em 0 #000; }
.o-tag { margin: 0 auto 20px; max-width: 24em; font: 500 15px/1.45 var(--body); color: var(--muted); }
.o-chal { margin: -6px auto 16px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 154, 200, 0.12); color: var(--text); font: 600 14px/1.4 var(--body); }
.o-chal[hidden] { display: none; }
.o-chal b { color: var(--pink); }

.o-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.o-mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 14px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--glass-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.18s, border-color 0.18s;
}
.o-mode img { width: 76px; height: 76px; image-rendering: pixelated; border-radius: 10px; }
.o-mode b { font: 800 15px/1.2 var(--body); }
.o-mode small { font: 500 12.5px/1.3 var(--body); color: var(--muted); }
.o-mode__go { margin-top: 6px; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font: 700 13px/1 var(--body); color: var(--text); transition: background 0.18s, color 0.18s; }
.o-mode__best { font: 600 11.5px/1 var(--body); color: var(--yellow); }
.o-mode__best:empty { display: none; }
.o-mode:hover, .o-mode.is-sel { background: rgba(232, 180, 64, 0.1); border-color: rgba(232, 180, 64, 0.55); }
.o-mode:hover { transform: translateY(-2px); }
.o-mode:hover .o-mode__go, .o-mode.is-sel .o-mode__go { background: var(--yellow); color: var(--yellow-ink); }
.o-mode:active { transform: translateY(0) scale(0.98); }
.o-mode:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

.o-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin: 16px 0 0; }
.o-link { padding: 10px 12px; border: 0; border-radius: 999px; background: none; color: var(--text); font: 600 14px/1 var(--body); cursor: pointer; opacity: 0.82; touch-action: manipulation; }
.o-link:hover { background: rgba(255, 255, 255, 0.07); opacity: 1; }
.o-link:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.o-links--small { margin-top: 12px; }
.o-links--small .o-link { font-size: 13px; color: var(--muted); }
.o-foot { display: grid; gap: 4px; margin: 10px 0 0; font: 500 12px/1.5 var(--body); color: var(--muted); }
.o-foot a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
.o-foot a:hover { color: var(--text); }
.o-foot a[aria-current="true"] { color: var(--text); font-weight: 800; }
.o-counters { color: var(--green); }
.o-counters[hidden] { display: none; }

/* ---------- Buttons ---------- */

.o-cta { display: flex; gap: 8px; margin-top: 14px; }
.o-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px; border: 1px solid var(--edge); border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--text); font: 700 15px/1 var(--body); cursor: pointer; touch-action: manipulation; transition: transform 0.12s, filter 0.12s; }
.o-btn:hover { filter: brightness(1.15); }
.o-btn:active { transform: scale(0.97); }
.o-btn:focus-visible, .o-close:focus-visible, .o-sb:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.o-btn--go { background: var(--yellow); border-color: transparent; color: var(--yellow-ink); }
.o-close { display: block; margin: 16px auto 0; padding: 10px 18px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 600 14px/1 var(--body); cursor: pointer; }
.o-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* ---------- The end of a run ---------- */

.o-over { width: min(560px, calc(100% - 28px)); }
.o-over__h { margin: 0 0 4px; font: 400 19px/1.35 var(--pixel); color: var(--pink); text-shadow: 0 3px 0 #000; }
.o-over__sub { margin: 0 0 16px; font: 500 14px/1.4 var(--body); color: var(--muted); }
.o-over__sub.is-beat { color: var(--yellow); font-weight: 700; }
.o-over__grid { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: center; text-align: left; }
.o-card { width: 190px; height: 190px; border-radius: 12px; background: #1c1f26; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.o-score { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.o-score b { font: 400 28px/1 var(--pixel); color: var(--yellow); }
.o-score > span:not(.o-new) { font: 600 13px/1 var(--body); color: var(--muted); }
.o-new { padding: 4px 8px; border-radius: 999px; background: var(--yellow); color: var(--yellow-ink); font: 800 11px/1 var(--body); letter-spacing: 0.02em; }
.o-new[hidden] { display: none; }
.o-rankt { margin: 8px 0 0; font: 700 14px/1.3 var(--body); color: var(--green); }
.o-statline { margin: 4px 0 0; font: 500 12.5px/1.45 var(--body); color: var(--muted); }
.o-name { display: flex; gap: 6px; margin: 12px 0 0; }
.o-name[hidden] { display: none; }
.o-name input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 10px; background: rgba(0, 0, 0, 0.3); color: #fff; font: 700 14px/1 var(--body); text-transform: uppercase; }
.o-name input:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }
.o-name button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.1); color: var(--text); font: 700 13px/1 var(--body); cursor: pointer; }
.o-name button:disabled { opacity: 0.5; }
.o-rankline { margin: 10px 0 0; font: 600 13px/1.4 var(--body); color: var(--text); }
.o-rankline[hidden] { display: none; }
.o-rankline button { margin-left: 6px; padding: 2px 4px; border: 0; background: none; color: var(--muted); font: 500 12px/1 var(--body); text-decoration: underline; cursor: pointer; }
.o-fact { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--glass-2); text-align: left; font: 500 13.5px/1.5 var(--body); color: #d9d7d1; }
.o-fact b { display: block; margin-bottom: 3px; font: 700 11px/1.3 var(--body); color: var(--pink); text-transform: uppercase; letter-spacing: 0.06em; }
.o-fact a { color: var(--yellow); font-weight: 700; white-space: nowrap; }

/* ---------- Share ---------- */

.o-sharegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.o-sb { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 12px; background: rgba(255, 255, 255, 0.06); color: var(--text); font: 700 14px/1 var(--body); text-decoration: none; cursor: pointer; transition: filter 0.12s, transform 0.12s; }
.o-sb:hover { filter: brightness(1.2); }
.o-sb:active { transform: scale(0.97); }
.o-sb--wa { background: #1f8f4e; border-color: transparent; }
.o-sb[hidden] { display: none; }

/* ---------- Ranking ---------- */

.o-rank { z-index: 12; }
.o-seg { display: flex; gap: 4px; margin: 10px 0 0; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.o-seg button { flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 700 13px/1 var(--body); cursor: pointer; }
.o-seg button[aria-selected="true"] { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.o-seg--small { width: max-content; margin: 8px auto 0; padding: 3px; }
.o-seg--small button { min-height: 28px; padding: 0 12px; font-size: 12px; }
.o-ranklist { list-style: none; margin: 12px 0 0; padding: 0; text-align: left; font: 600 14px/1.3 var(--body); }
.o-ranklist li { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; }
.o-ranklist li:nth-child(odd) { background: rgba(255, 255, 255, 0.03); }
.o-ranklist li.is-you { background: rgba(232, 180, 64, 0.16); }
.o-rk { font: 700 12px/1 var(--body); color: var(--muted); text-align: right; }
.o-ranklist li:first-child .o-rk { color: var(--yellow); }
.o-rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-rp { color: var(--muted); font-size: 12px; text-align: right; }
.o-rv { font: 800 14px/1 var(--body); text-align: right; }
.o-rank-empty, .o-rank-total { margin: 12px 0 0; font: 500 13px/1.5 var(--body); color: var(--muted); }
.o-ranklist .o-rank-gap { display: block; padding: 0; text-align: center; color: var(--muted); background: none; }

/* ---------- Complain for real ---------- */

.o-report { z-index: 13; width: min(440px, calc(100% - 28px)); }
.o-helplist { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; }
.o-helplist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--glass-2); }
.o-helplist b { font: 800 14px/1.3 var(--body); }
.o-helplist p { grid-column: 1; margin: 0; font: 500 13px/1.45 var(--body); color: var(--muted); }
.o-helplist a.o-go { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--yellow); color: var(--yellow-ink); font: 800 13px/1 var(--body); text-decoration: none; white-space: nowrap; }
.o-helplist a.o-go:hover { filter: brightness(1.08); }

/* ---------- In play ---------- */

body.semaforo .g-toast { top: max(calc(env(safe-area-inset-top) + 8px), var(--hud-bottom, 80px)); bottom: auto; transform: translate(-50%, -24px); width: min(460px, calc(100% - 24px)); border-top: 0; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); font-size: 13.5px; }
body.semaforo .g-toast.is-on { transform: translate(-50%, 0); }
body.semaforo .g-toast b { font: 700 10px/1.3 var(--body); text-transform: uppercase; letter-spacing: 0.06em; }
body.semaforo .g-icon { border: 0; border-radius: 12px; background: rgba(17, 18, 23, 0.6); box-shadow: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.o-coach { position: absolute; left: 50%; top: max(calc(env(safe-area-inset-top) + 8px), var(--hud-bottom, 80px)); transform: translateX(-50%); z-index: 17; display: flex; align-items: center; gap: 10px; width: min(480px, calc(100% - 24px)); padding: 10px 10px 10px 14px; border-radius: 12px; background: rgba(17, 18, 23, 0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--text); font: 600 14px/1.4 var(--body); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); animation: o-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.o-coach[hidden] { display: none; }
.o-coach b { flex: none; font: 800 11px/1 var(--body); color: var(--yellow); }
.o-coach span { flex: 1; }
.o-coach button { flex: none; min-height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--text); font: 700 12px/1 var(--body); cursor: pointer; }

/* the guide's sources */
.g-about .o-sources { padding-left: 1.1em; }
.g-about .o-sources a { font: 700 13px/1.4 var(--body); white-space: nowrap; }

/* ---------- Small screens ---------- */

@media (max-width: 520px) {
  .o-sheet { padding: 22px 16px 14px; }
  .o-logo { font-size: 27px; }
  .o-tag { font-size: 14px; margin-bottom: 16px; }
  .o-mode img { width: 64px; height: 64px; }
  .o-over__grid { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 12px; }
  .o-card { width: 180px; height: 180px; }
  .o-score { justify-content: center; }
  .o-cta { width: 100%; }
  .o-name { width: 100%; }
}
@media (max-height: 560px) {
  .o-sheet { padding: 14px 16px 10px; }
  .o-logo { font-size: 22px; margin-bottom: 4px; }
  .o-tag { display: none; }
  .o-mode { flex-direction: row; gap: 10px; padding: 8px 10px; text-align: left; }
  .o-mode img { width: 44px; height: 44px; }
  .o-mode small, .o-mode__best { display: none; }
  .o-links { margin-top: 8px; }
  .o-foot { margin-top: 4px; }
  .o-over__grid { grid-template-columns: 130px 1fr; }
  .o-card { width: 130px; height: 130px; }
  .o-fact { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .o-sheet, .o-coach { animation: none; }
  .o-mode, .o-btn, .o-sb { transition: none; }
}

/* ---------- ?poster=1: the share image, the logo over the crossing at rush hour ---------- */

body.is-poster .o-modes, body.is-poster .o-links, body.is-poster .o-foot, body.is-poster .o-coach, body.is-poster .o-chal { display: none; }
body.is-poster .o-title { left: 5%; width: 50%; padding: 40px 30px 36px; }
body.is-poster .o-logo { font-size: 50px; margin-bottom: 16px; }
body.is-poster .o-tag { font-size: 19px; margin-bottom: 18px; color: var(--text); }
body.is-poster .o-title::after { content: "LOCO.LTD/SEMAFORO"; display: block; font: 13px/1 var(--pixel); color: var(--yellow); }

/* teia's text bar at the top (placement "topo"): its height reserved so the page doesn't jump when it loads,
   60 px, 40 px from 1024 px wide; the game takes the rest of the screen */
[data-teia="topo"] { display: block; min-height: 60px; --teia-bar-bg: #101115; --teia-bar-fg: #e6e6e0; }
body.semaforo .game { height: calc(100vh - 60px); height: calc(100svh - 60px); }
@supports (height: 100dvh) {
  body.semaforo.is-playing .game { height: calc(100dvh - 60px); }
}
@media (min-width: 1024px) {
  [data-teia="topo"] { min-height: 40px; }
  body.semaforo .game { height: calc(100vh - 40px); height: calc(100svh - 40px); }
  @supports (height: 100dvh) {
    body.semaforo.is-playing .game { height: calc(100dvh - 40px); }
  }
}
body.is-poster [data-teia="topo"] { display: none; }
body.semaforo.is-poster .game { height: 100vh; }

/* ---------- Semáforo: the logo's little traffic light, the event line, the green wave's button ---------- */

.o-logo { font-size: 28px; line-height: 1.25; }
.o-logo .o-l2 { display: block; color: var(--yellow); }
.o-lamp { display: inline-flex; gap: 5px; margin: 0 auto 14px; padding: 6px 9px; border-radius: 10px; background: #14101c; box-shadow: inset 0 0 0 2px #26262e; }
.o-lamp i { width: 12px; height: 12px; border-radius: 3px; background: #3a3a44; animation: o-lamp 4.5s steps(1) infinite; }
.o-lamp i:nth-child(1) { --c: #ff4a3d; animation-delay: -3s; }
.o-lamp i:nth-child(2) { --c: #ffcc1f; animation-delay: -1.5s; }
.o-lamp i:nth-child(3) { --c: #2ee07a; }
@keyframes o-lamp { 0% { background: var(--c); box-shadow: 0 0 10px var(--c); } 33.3% { background: #3a3a44; box-shadow: none; } }
.o-say { position: absolute; left: 50%; bottom: max(calc(env(safe-area-inset-bottom) + 12px), 14px); transform: translate(-50%, 16px); z-index: 16; width: max-content; max-width: min(520px, calc(100% - 24px)); padding: 9px 14px; border-radius: 12px; background: rgba(17, 18, 23, 0.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--text); font: 600 13.5px/1.4 var(--body); text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.o-say.is-on { opacity: 1; transform: translate(-50%, 0); }
body:not(.is-playing) .o-say { display: none; }
.o-wave { position: absolute; left: 50%; bottom: max(calc(env(safe-area-inset-bottom) + 12px), 14px); transform: translateX(-50%); z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 240px; padding: 10px 18px; border: 1px solid var(--edge); border-radius: 14px; background: rgba(17, 18, 23, 0.82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #ff8a7a; font: 800 14px/1.2 var(--body); cursor: pointer; touch-action: manipulation; transition: background 0.18s, color 0.18s, border-color 0.18s; }
.o-wave[hidden] { display: none; }
.o-wave small { font: 500 11.5px/1.2 var(--body); color: var(--muted); }
.o-wave.on { color: var(--green); border-color: rgba(143, 220, 152, 0.6); background: rgba(20, 48, 30, 0.85); }
.o-wave:disabled { color: var(--yellow); cursor: not-allowed; opacity: 0.9; }
.o-wave:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
/* the logo's acute, closer to its A at this line height */
body.semaforo .o-ac::before { top: -0.16em; }
/* landscape: the green wave's button in the bottom-left corner, clear of the side streets' queues; portrait: across
   the bottom, under the avenue, with the event line above it */
@media (orientation: landscape) {
  .o-wave { left: max(calc(env(safe-area-inset-left) + 14px), 14px); transform: none; align-items: flex-start; min-width: 0; }
}
@media (orientation: portrait) {
  body.semaforo.has-wave .o-say { bottom: max(calc(env(safe-area-inset-bottom) + 76px), 78px); }
}
@media (max-width: 520px) {
  .o-logo { font-size: 22px; }
  .o-wave { min-width: 0; width: calc(100% - 24px); }
}
@media (max-height: 560px) {
  .o-logo { font-size: 19px; }
  .o-lamp { display: none; }
}
body.is-poster .o-logo { font-size: 40px; }
body.is-poster .o-title::after { content: "LOCO.LTD/SEMAFORO"; }
