/* Spot-the-Phish — shared styles (ShieldNet 360 brand, offline, no CDN) */
:root {
  --blue: #255FE5;
  --blue-d: #1B49B8;
  --navy: #0B1B3B;
  --red: #E23D3D;
  --red-d: #B62626;
  --green: #1FA463;
  --green-d: #157A49;
  --amber: #E0A800;
  --ink: #16243F;
  --slate: #5A6B86;
  --line: #E2E8F2;
  --card: #FFFFFF;
  --bg: #F4F7FC;
  --tint: #EAF1FE;
  --shadow: 0 6px 22px rgba(16, 35, 70, .10);
  --shadow-lg: 0 14px 44px rgba(16, 35, 70, .18);
  --r: 16px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  overscroll-behavior: none;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
button { font-family: inherit; cursor: pointer; border: none; }
a { color: var(--blue); }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1180px; margin: 0 auto; padding: 18px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--blue), var(--blue-d));
  display: grid; place-items: center; color: #fff; font-size: 15px;
}
.brand small { display: block; font-weight: 600; color: var(--slate); font-size: 11px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 18px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: var(--blue); color: #fff; transition: filter .12s, transform .04s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 16px 22px; font-size: 17px; width: 100%; }
.btn-ghost { background: var(--tint); color: var(--blue-d); }
.btn-line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-amber { background: var(--amber); color: #3a2c00; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }

input[type=text], input[type=number] {
  width: 100%; padding: 14px 16px; font-size: 17px; border: 1.5px solid var(--line);
  border-radius: 12px; outline: none; background: #fff; color: var(--ink);
}
input:focus { border-color: var(--blue); }
label { font-weight: 600; font-size: 13px; color: var(--slate); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tint);
  color: var(--blue-d);
}
.pill.red { background: #FCE8E8; color: var(--red-d); }
.pill.green { background: #E4F6ED; color: var(--green-d); }
.pill.gray { background: #EEF1F6; color: var(--slate); }

.muted { color: var(--slate); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.hide { display: none !important; }
.stack > * + * { margin-top: 12px; }

/* ---------------- Player ---------------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
}
.score-chip {
  font-weight: 800; color: var(--blue-d); background: var(--tint);
  padding: 6px 12px; border-radius: 999px; font-size: 14px;
}

.timer-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--green); width: 100%;
  transition: width .25s linear; }
.timer-bar.warn > i { background: var(--amber); }
.timer-bar.crit > i { background: var(--red); }

/* Pinning stage */
.stage-wrap { position: relative; width: 100%; }
.stage {
  position: relative; width: 100%; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #fff; touch-action: manipulation;
  user-select: none;
}
.stage img { display: block; width: 100%; height: auto; pointer-events: none; }
.pin {
  position: absolute; width: 30px; height: 30px; transform: translate(-50%, -100%);
  z-index: 3; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.pin b {
  display: grid; place-items: center; width: 26px; height: 26px; margin: 0 auto;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--red); color: #fff; font-size: 12px; font-weight: 800;
}
.pin b span { transform: rotate(45deg); }
.pin.ok b { background: var(--green); }
.pin.miss b { background: var(--slate); }

/* near-fullscreen play layout (participant) */
body.playmode .topbar { display: none; }
body.playmode .wrap { max-width: 100%; padding: 0; }
.play { display: flex; flex-direction: column; }
.playhead { position: sticky; top: 0; z-index: 6; padding: 8px 14px 10px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); }
.playhead .ptitle { font-weight: 800; font-size: 15px; line-height: 1.25; margin: 5px 0; }
.stage-wrap.bleed { width: 100%; }
.bleed .stage { border-radius: 0; border-left: none; border-right: none; }
body.playmode .help { margin: 10px 14px; }
.actionbar { position: sticky; bottom: 0; z-index: 6; display: flex; flex-direction: column;
  gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line); }
.actionbar .abrow { display: flex; gap: 8px; }
.actionbar .abrow .btn { flex: 1; }
.actionbar .abrow.main .btn { padding: 14px 18px; font-size: 16px; }
@media (min-width: 760px) {
  body.playmode .wrap { max-width: 640px; margin: 0 auto; }
}

/* reveal hotspot rings drawn on stage */
.hsring {
  position: absolute; border: 3px dashed var(--green); border-radius: 50%;
  transform: translate(-50%, -50%); z-index: 2; background: rgba(31,164,99,.10);
}
.hsring .tag {
  position: absolute; left: 50%; top: -10px; transform: translate(-50%, -100%);
  background: var(--green-d); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 8px; white-space: nowrap; max-width: 240px;
}

.dot-mark {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%); z-index: 2; border: 2px solid #fff;
}

.bignum { font-size: 44px; font-weight: 900; line-height: 1; }
.result-row { display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--line); }

/* leaderboard */
.lb { list-style: none; margin: 0; padding: 0; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 12px; }
.lb li + li { margin-top: 6px; }
.lb li:nth-child(odd) { background: #F8FAFE; }
.lb .rk { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid;
  place-items: center; font-weight: 800; background: var(--tint); color: var(--blue-d); }
.lb .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.lb .sc { font-weight: 800; color: var(--navy); }
.lb li.gold .rk { background: #FFE7A8; color: #8A6A00; }
.lb li.silver .rk { background: #E6EAF0; color: #5A6B86; }
.lb li.bronze .rk { background: #F4DEC4; color: #8A5A22; }
.lb li.me { outline: 2px solid var(--blue); }

/* ---------------- Host ---------------- */
.host-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .host-grid { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { padding: 9px 16px; border-radius: 10px; font-weight: 700; background: #fff;
  border: 1px solid var(--line); color: var(--slate); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.qrbox { display: flex; gap: 16px; align-items: center; }
.qrbox img { width: 132px; height: 132px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; }
.joinurl { font-size: 18px; font-weight: 800; color: var(--navy); word-break: break-all; }

.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #F8FAFE; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; text-align: center; }
.stat b { display: block; font-size: 26px; font-weight: 900; color: var(--navy); }
.stat span { font-size: 12px; color: var(--slate); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
  gap: 10px; }
.thumb { border: 2px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer; position: relative; }
.thumb.active { border-color: var(--blue); }
.thumb img { width: 100%; height: 88px; object-fit: cover; object-position: top; display: block; }
.thumb .cap { padding: 7px 9px; font-size: 12px; font-weight: 700; }
.thumb .badge { position: absolute; top: 6px; right: 6px; background: var(--navy);
  color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }

/* hotspot editor */
.editor-stage { position: relative; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: #fff; cursor: crosshair; user-select: none; }
.editor-stage img { display: block; width: 100%; height: auto; pointer-events: none; }
.hs {
  position: absolute; border: 2px solid var(--blue); background: rgba(37,95,229,.14);
  cursor: move; display: grid; place-items: center;
}
.hs.shp-circle { border-radius: 50%; transform: translate(-50%, -50%); }
.hs.shp-rect { border-radius: 6px; }
.hs.sel { border-color: var(--red); background: rgba(226,61,61,.16); z-index: 4; }
.hs .lbl { position: absolute; top: -8px; left: 50%; transform: translate(-50%,-100%);
  background: var(--navy); color: #fff; font-size: 10px; padding: 2px 6px;
  border-radius: 6px; white-space: nowrap; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; pointer-events: none; }
.hs .handle { position: absolute; right: -7px; bottom: -7px; width: 16px; height: 16px;
  background: var(--red); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; }

/* freehand polygon in the editor */
.edpoly { position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible; }
.edpoly polygon { fill: rgba(37,95,229,.14); stroke: var(--blue); stroke-width: 2;
  vector-effect: non-scaling-stroke; pointer-events: auto; cursor: move; }
.edpoly.sel polygon { fill: rgba(226,61,61,.16); stroke: var(--red); }
.edtag { position: absolute; transform: translate(-50%, -50%); background: var(--navy);
  color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px; white-space: nowrap;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; z-index: 3; }
.edtag.sel { background: var(--red-d); }
.editor-stage.drawing { cursor: crosshair; }

/* shape toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbtn { padding: 7px 12px; border-radius: 9px; font-weight: 700; font-size: 13px;
  background: #fff; border: 1px solid var(--line); color: var(--slate); }
.toolbtn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.hslist .shp { width: 20px; text-align: center; color: var(--slate); font-size: 13px;
  flex: none; }

/* reveal: rectangle + polygon hotspots */
.hsrect { position: absolute; border: 3px dashed var(--green); background: rgba(31,164,99,.10);
  border-radius: 6px; z-index: 2; }
.hsrect .tag { position: absolute; left: 0; top: -10px; transform: translateY(-100%);
  background: var(--green-d); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 8px; white-space: nowrap; max-width: 240px; }
.revpoly { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  overflow: visible; z-index: 2; }
.revpoly polygon { fill: rgba(31,164,99,.12); stroke: var(--green); stroke-width: 3;
  stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.revtag { position: absolute; transform: translate(-50%, -50%); background: var(--green-d);
  color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px;
  white-space: nowrap; max-width: 240px; z-index: 3; }

.hslist { list-style: none; margin: 0; padding: 0; }
.hslist li { display: flex; gap: 8px; align-items: center; padding: 7px 0;
  border-bottom: 1px solid var(--line); }
.hslist .ix { width: 22px; height: 22px; border-radius: 6px; background: var(--tint);
  color: var(--blue-d); font-weight: 800; display: grid; place-items: center; font-size: 12px; }
.hslist input { padding: 7px 10px; font-size: 13px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-weight: 700; box-shadow: var(--shadow-lg); z-index: 99; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.help { font-size: 13px; color: var(--slate); background: #F8FAFE;
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }

/* Big projected leaderboard / final */
.final-hero { text-align: center; padding: 22px 0; }
.final-hero .crown { font-size: 50px; }
.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px;
  align-items: end; margin: 20px 0; }
.podium .col { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; text-align: center; box-shadow: var(--shadow); }
.podium .col .nm { font-weight: 800; }
.podium .col .sc { font-size: 24px; font-weight: 900; color: var(--blue-d); }
.podium .p1 { border-top: 5px solid #F4C430; }
.podium .p2 { border-top: 5px solid #C2CBD8; }
.podium .p3 { border-top: 5px solid #D8A05A; }
