* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --red: #e21b3c; --blue: #1368ce; --yellow: #d89e00; --green: #26890c;
  --brand: #002a5e; --brand-green: #1a9e3e;
}
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #002a5e, #0d7a30);
  color: #fff; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
}
.hidden { display: none !important; }
.card {
  background: #fff; color: #333; border-radius: 14px;
  padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-width: 460px; width: 92%; margin: 24px auto; text-align: center;
}
h1 { font-size: 28px; margin-bottom: 8px; }
h2 { font-size: 22px; margin-bottom: 14px; }
input, select, textarea {
  width: 100%; padding: 13px; font-size: 17px;
  border: 2px solid #ddd; border-radius: 8px; margin: 6px 0; font-family: inherit;
}
.center-input { text-align: center; }
button {
  cursor: pointer; border: none; border-radius: 8px;
  font-size: 18px; font-weight: 700; padding: 14px 20px; color: #fff;
  background: #002a5e; transition: transform .08s, opacity .2s;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-big { width: 100%; margin-top: 10px; font-size: 20px; padding: 16px; background: var(--brand-green); }
.btn-gray { background: #777; }
.btn-red { background: var(--red); }
.error { color: var(--red); font-weight: 700; margin: 8px 0; min-height: 20px; }

.pin-banner { background: #fff; color: #333; border-radius: 12px; padding: 14px 26px; margin: 18px auto; text-align: center; }
.pin-banner .pin { font-size: 46px; font-weight: 900; letter-spacing: 6px; }
.pin-banner small { color: #666; }

.players { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px; }
.player-chip { background: #fff; color: #002a5e; font-weight: 800; font-size: 18px; padding: 8px 16px; border-radius: 30px; animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.qbar { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; }
.timer { font-size: 36px; font-weight: 900; background: #fff; color: #002a5e; width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.qtext { font-size: 30px; font-weight: 800; text-align: center; background:#fff; color:#333; padding: 22px; border-radius: 12px; margin: 10px 22px; max-width: 900px; }
.answered-count { font-size: 20px; font-weight: 800; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 96%; max-width: 1000px; margin: 18px auto; }
.opt { display: flex; align-items: center; gap: 14px; padding: 22px; border-radius: 10px; font-size: 22px; font-weight: 800; color: #fff; min-height: 90px; position: relative; }
.opt .shape { font-size: 28px; }
.opt-0 { background: var(--red); } .opt-1 { background: var(--blue); }
.opt-2 { background: var(--yellow); } .opt-3 { background: var(--green); }
.opt.dim { opacity: .35; }
.opt .count { position: absolute; right: 18px; font-size: 20px; background: rgba(0,0,0,.25); padding: 2px 12px; border-radius: 20px; }
.opt .tick { position: absolute; right: 18px; font-size: 30px; }

.player-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 94%; max-width: 500px; margin: 20px auto; }
.player-opt { height: 130px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 48px; }

.result-big { font-size: 38px; font-weight: 900; margin: 16px 0; }
.correct-bg { background: var(--green) !important; color:#fff !important; }
.wrong-bg { background: var(--red) !important; color:#fff !important; }

.lb { width: 92%; max-width: 600px; margin: 18px auto; }
.lb-row { display: flex; justify-content: space-between; background: #fff; color: #333; padding: 14px 22px; border-radius: 10px; margin-bottom: 10px; font-size: 22px; font-weight: 800; }
.lb-row .rank { color: #002a5e; }
.podium .lb-row:nth-child(1) { background: #ffd700; }
.podium .lb-row:nth-child(2) { background: #c0c0c0; }
.podium .lb-row:nth-child(3) { background: #cd7f32; }

.muted { color: #ccc; font-size: 15px; margin-top: 10px; }
.links { margin-top: 14px; }
.links a { color: #002a5e; font-weight: 700; text-decoration: none; }

/* Admin */
.q-edit { background: #f4f4f8; border-radius: 10px; padding: 16px; margin: 12px 0; text-align: left; }
.q-edit .row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.q-edit .row input[type=text] { margin: 0; }
.q-edit .row input[type=radio] { width: auto; }
.q-edit label { font-size: 13px; color: #666; min-width: 56px; }
.q-num { font-weight: 800; color: #002a5e; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.toolbar button { flex: 1; min-width: 120px; }
.ok { color: var(--green); font-weight: 700; }

/* Question images (host & player) */
.qimages { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; margin: 14px auto; width: 96%; max-width: 1000px; }
.qimages img { max-height: 320px; max-width: 47%; border-radius: 12px; background: #fff; padding: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.2); object-fit: contain; }
.qimages.single img { max-width: 88%; max-height: 360px; }
#pImages img { max-height: 150px; }
#pImages.single img { max-width: 90%; max-height: 180px; }

/* Auth / Dashboard */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 1; background: #e6eef7; color: #002a5e; }
.tabs button.active { background: var(--brand-green); color: #fff; }
.field-label { text-align: left; font-size: 13px; color: #666; margin: 8px 0 2px; }
.status-box { background: #f4f4f8; border-radius: 12px; padding: 18px; margin: 14px 0; }
.status-box .big { font-size: 30px; font-weight: 900; color: #002a5e; }
.badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-weight: 800; font-size: 14px; }
.badge.active { background: #d7f5d0; color: #1c6e0a; }
.badge.trial { background: #fff3cd; color: #8a6d00; }
.badge.expired { background: #fdd; color: #b00020; }
.dash-links { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.dash-links a { display: block; background: #002a5e; color: #fff; padding: 15px; border-radius: 10px; font-weight: 700; text-decoration: none; font-size: 17px; }
.dash-links a.alt { background: #e6eef7; color: #002a5e; }
.qr-box { text-align: center; }
.qr-box img { width: 240px; height: 240px; background: #fff; padding: 8px; border-radius: 10px; }
.topbar { width: 100%; max-width: 680px; display: flex; justify-content: space-between; align-items: center; padding: 12px 6px; color: #fff; }
.topbar a, .topbar button { background: rgba(255,255,255,.15); color: #fff; font-size: 14px; padding: 8px 14px; border-radius: 8px; text-decoration: none; border: none; cursor: pointer; }

/* Admin categories */
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.cat-chip { background: #e6eef7; color: #002a5e; border: 2px solid transparent; border-radius: 24px; padding: 8px 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
.cat-chip.active { background: var(--brand-green); color: #fff; }
.cat-add { background: #fff; color: #002a5e; border: 2px dashed #b6c4db; border-radius: 24px; padding: 8px 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
.cat-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.cat-head input { margin: 0; font-weight: 800; font-size: 18px; }

/* Admin image upload */
.img-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.thumb { position: relative; }
.thumb img { height: 70px; border-radius: 8px; border: 1px solid #ddd; display: block; }
.thumb .x { position: absolute; top: -8px; right: -8px; background: var(--red); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; line-height: 1; padding: 0; cursor: pointer; }
.thumb-add { background: #eaeef4; color: #002a5e; border: 2px dashed #b6c4db; height: 70px; padding: 0 16px; font-size: 14px; }
