@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;800;900&family=Montserrat:wght@500;600;700;800&display=swap');

:root {
  --bg: #040705;
  --surface: #0b120d;
  --surface-2: #121c15;
  --line: #1f3326;
  --text: #f2f7f3;
  --text-dim: #7f9a88;
  --green: #28e062;
  --green-dim: #0f5a27;
  --glow: rgba(40, 224, 98, .5);
  --live: #ff4a4a;
  --focus: #9dffbd;
  --ot: #ff8a2b;
  --ot-glow: rgba(255, 138, 43, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(118deg, transparent 0 26px, rgba(40,224,98,.16) 26px 27px),
    repeating-linear-gradient(62deg, transparent 0 26px, rgba(40,224,98,.12) 26px 27px);
  -webkit-mask-image:
    radial-gradient(circle at 100% 0%, #000 0, transparent 42%),
    radial-gradient(circle at 0% 100%, #000 0, transparent 38%);
  mask-image:
    radial-gradient(circle at 100% 0%, #000 0, transparent 42%),
    radial-gradient(circle at 0% 100%, #000 0, transparent 38%);
}
h1, h2, h3, p { margin: 0; }
button, select, input { font-family: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ============ painel público ============ */
.status-tag {
  position: fixed;
  top: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
  z-index: 2;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.status-tag.live { color: var(--text); }
.status-tag.live .status-dot { background: var(--live); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,74,74,.6); }
  70% { box-shadow: 0 0 0 9px rgba(255,74,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,74,74,0); }
}

.poster {
  position: relative;
  width: 100%;
  max-width: min(860px, 78vh);
  min-width: min(100%, 320px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vh, 36px);
  text-align: center;
}

.champ { width: min(54%, 340px); height: auto; }
.phase {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 4.2vw, 36px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--green);
  text-shadow: 0 0 22px var(--glow), 0 0 4px var(--green);
}

.match-wrap { container-type: inline-size; width: 100%; }
.match {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20cqw minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 2cqw;
  row-gap: clamp(8px, 2vh, 18px);
  align-items: center;
}
.logo {
  grid-row: 1;
  justify-self: center;
  width: 100%;
  height: 26cqw;
  object-fit: contain;
}
.logo.home { grid-column: 1; }
.logo.away { grid-column: 3; }
.x {
  grid-row: 1; grid-column: 2;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 8cqw;
  color: var(--text);
}
.name {
  grid-row: 2;
  font-weight: 800;
  font-size: clamp(14px, 4.4cqw, 30px);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text);
  min-height: 2.4em;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 4px;
}
.name.home { grid-column: 1; }
.name.away { grid-column: 3; }

.score {
  grid-row: 3;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 17cqw;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  text-shadow: 0 0 28px var(--glow), 0 0 6px rgba(40,224,98,.7);
}
.score.long { font-size: 12.5cqw; }
.score.home { grid-column: 1; }
.score.away { grid-column: 3; }

.period {
  grid-row: 3; grid-column: 2;
  justify-self: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25em;
  text-align: center;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--green-dim);
  border-radius: 12px;
  padding: .9em .3em;
}
.period .p-label { font-size: clamp(9px, 2.5cqw, 15px); font-weight: 800; letter-spacing: .06em; line-height: 1.2; }
.period .p-note { font-size: clamp(8px, 2cqw, 12px); font-weight: 600; letter-spacing: .1em; color: var(--text-dim); }
.period .p-min { font-family: 'Orbitron', sans-serif; font-size: clamp(13px, 4.4cqw, 26px); font-weight: 800; line-height: 1.1; text-shadow: 0 0 14px var(--glow); }
.period .p-note:empty, .period .p-min:empty { display: none; }

.venue {
  font-weight: 500;
  font-size: clamp(10px, 1.9vw, 13px);
  line-height: 1.4;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.sponsors { width: min(94%, 400px); height: auto; opacity: .95; }
@media (max-height: 780px) and (min-aspect-ratio: 1/1) { .sponsors { width: auto; height: 50px; } }


/* Our Team (contratante): destaque laranja no lado em que ele joga */
.logo.ot { filter: drop-shadow(0 0 12px var(--ot-glow)); }
.name.ot { color: var(--ot); }
.score.ot { color: var(--ot); text-shadow: 0 0 28px var(--ot-glow), 0 0 6px rgba(255,138,43,.7); }

/* ============ painel de controle ============ */
.app { max-width: 1040px; margin: 0 auto; padding: 20px 20px 56px; position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand .mark { font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 16px; letter-spacing: .12em; color: var(--green); text-shadow: 0 0 14px var(--glow); }
.brand .tag { font-size: 12px; color: var(--text-dim); }
.top-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.conn-state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.conn-state.online .conn-dot { background: var(--green); box-shadow: 0 0 10px var(--glow); }
.link-btn {
  font-size: 13px; font-weight: 700; text-decoration: none;
  color: var(--bg); background: var(--green); padding: 9px 16px; border-radius: 10px;
}

.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .control-grid { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.card h3 { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px; }

.team-card .head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.team-card .head img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.team-card .head .name-c { flex: 1; font-weight: 800; font-size: 16px; text-transform: uppercase; line-height: 1.2; }
.team-card .head .score-c {
  font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 44px;
  color: var(--green); text-shadow: 0 0 18px var(--glow); font-variant-numeric: tabular-nums;
}

.pts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.pts-btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 24px;
  border-radius: 12px; padding: 18px 0 14px;
  transition: transform .08s, background .15s, border-color .15s;
}
.pts-btn:active { transform: scale(.96); background: var(--green-dim); border-color: var(--green); }
.pts-btn .lbl { display: block; font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 600; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; }
.minor-btn {
  width: 100%; border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 700; border-radius: 10px; padding: 11px 6px;
}
.minor-btn:hover { color: var(--text); border-color: var(--text-dim); }

.game-card { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 36px; }
.game-card .block { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.game-card .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); }
.period-stepper { display: flex; align-items: center; gap: 12px; }
.period-stepper button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 18px; }
.period-stepper .cur { font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 16px; min-width: 130px; text-align: center; color: var(--green); }
.min-chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: min(100%, 420px); }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 15px; padding: 11px 0; border-radius: 10px; }
.chip.on { background: var(--green); color: var(--bg); border-color: var(--green); }
.min-actions { display: flex; align-items: center; gap: 10px; }
.final-btn { border: 1px solid var(--green); background: transparent; color: var(--green); font-weight: 800; font-size: 13px; padding: 11px 18px; border-radius: 10px; letter-spacing: .04em; }
.final-btn.is-final { background: var(--green); color: var(--bg); }

.setup-card { grid-column: 1 / -1; }
.setup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 720px) { .setup-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.field select, .field input {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; font-size: 14px; font-weight: 600;
}
.setup-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.primary-btn { border: none; background: var(--green); color: var(--bg); font-weight: 800; font-size: 13px; padding: 11px 18px; border-radius: 10px; }
.danger-btn { border: 1px solid var(--line); background: transparent; color: var(--text-dim); font-weight: 700; font-size: 13px; padding: 11px 18px; border-radius: 10px; }
.danger-btn:hover { color: var(--live); border-color: var(--live); }

.log-card { grid-column: 1 / -1; }
.log-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.log-head h3 { margin: 0; }
.undo-btn { background: transparent; border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 700; padding: 9px 14px; border-radius: 10px; }
.undo-btn:hover { border-color: var(--live); color: var(--live); }
.log-list { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.log-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-dim); padding: 7px 4px; border-bottom: 1px dashed var(--line); }
.log-item .who { font-weight: 700; color: var(--green); }

button:disabled { opacity: .4; pointer-events: none; }
.note { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--text-dim); }
