/* Brand tokens from KAP1st Merch Claim (sampled from the Karnival Aspirasi Pahang poster) */
:root {
  --indigo: #2b2d8e;
  --indigo-deep: #1f2070;
  --purple: #6e3fa3;
  --lavender: #a99ad6;
  --lavender-soft: #e8e3f6;
  --red: #d93a40;
  --coral: #ef6b5b;
  --mustard: #f2b43a;
  --ink: #141414;
  --muted: #55526b;
  --paper: #f4f3f1;
  --card: #ffffff;
  --ok: #1f8a5b;
  --radius: 14px;
  --shadow: 0 2px 0 rgba(20, 20, 20, 0.08), 0 8px 24px rgba(43, 45, 142, 0.08);
  --display: 'Poppins', system-ui, sans-serif;
  --cond: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.5 var(--display);
  color: var(--ink);
  background-color: var(--paper);
  /* paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-x: hidden;
}

/* Diagonal poster stripes in the corners */
body::before, body::after { content: ''; position: fixed; z-index: -1; width: 180px; height: 180px; pointer-events: none; }
body::before {
  top: -40px; right: -60px; opacity: 0.5; transform: rotate(8deg);
  background: repeating-linear-gradient(135deg, var(--coral) 0 10px, transparent 10px 22px);
}
body::after {
  bottom: -50px; left: -70px; opacity: 0.35;
  background: repeating-linear-gradient(135deg, var(--purple) 0 14px, transparent 14px 26px);
}

.wrap { max-width: 480px; margin: 0 auto; padding: 16px 16px 48px; }

:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin: 4px 0 18px; }
.hero-logo { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 150px; margin: 0 0 10px; padding: 14px 0; }
.hero-logo::before {
  content: ''; position: absolute; z-index: -1; inset: 6px 14%;
  background: var(--lavender-soft); border-radius: 46% 54% 40% 60% / 55% 45% 55% 45%; transform: rotate(-4deg);
}
.hero-logo::after {
  content: ''; position: absolute; z-index: -1; top: 0; left: 12%; width: 64px; height: 64px;
  background: repeating-linear-gradient(135deg, var(--mustard) 0 6px, transparent 6px 12px); border-radius: 50%;
}
.hero-logo img {
  display: block; width: auto; height: auto; max-height: 180px; max-width: 86%; object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(43, 45, 142, 0.18)); animation: pop 0.4s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(0.92); } }
/* Text wordmark: shown only until a carnival logo is uploaded in admin */
.wordmark { text-align: center; line-height: 1; }
.wordmark .k { display: inline-block; font: italic 900 22px var(--display); color: #fff; background: var(--indigo); padding: 4px 12px; border-radius: 6px; transform: rotate(-2deg); }
.wordmark .a { display: inline-block; margin-top: 4px; font: italic 900 26px var(--display); color: #fff; background: var(--red); padding: 2px 12px; transform: rotate(-2deg); }
.wordmark .p { display: block; margin-top: 4px; font: italic 900 38px var(--display); letter-spacing: -0.5px; color: var(--ink); text-shadow: 3px 3px 0 var(--mustard); }
.tag {
  display: inline-block; font: 700 15px/1 var(--cond); letter-spacing: 1px; text-transform: uppercase;
  background: var(--mustard); color: var(--ink); padding: 6px 12px; transform: rotate(-2deg);
}
.hero h1 { margin: 10px 0 4px; font: italic 900 clamp(30px, 9vw, 40px)/1.05 var(--display); color: var(--indigo); letter-spacing: -0.5px; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
/* Logged in: small header so voting is the first thing on screen */
.in .hero { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 14px; }
.in .hero-logo { min-height: 0; margin: 0; padding: 0; }
.in .hero-logo::before, .in .hero-logo::after { display: none; }
.in .hero-logo { flex: none; max-width: 30%; }
.in .hero-logo img { max-height: 64px; max-width: 100%; }
.in .wordmark .k { font-size: 11px; padding: 2px 6px; }
.in .wordmark .a { font-size: 13px; padding: 1px 6px; margin-top: 2px; }
.in .wordmark .p { font-size: 19px; margin-top: 2px; text-shadow: 2px 2px 0 var(--mustard); }
.in .hero .tag { font-size: 12px; padding: 4px 8px; }
.in .hero h1 { margin: 4px 0 0; font-size: 24px; }
.in .hero p { display: none; }

/* ---------- Card / form ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 16px; border-top: 6px solid var(--indigo); }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 4px; font: italic 800 22px/1.2 var(--display); color: var(--indigo); }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field input[type='text'], .field input[type='tel'], .field input[type='password'], .field input[type='number'] {
  width: 100%; min-height: 50px; padding: 12px 14px; font: 500 17px var(--display); color: var(--ink);
  background: #fff; border: 2px solid #d9d6e6; border-radius: 10px; transition: border-color 0.15s;
}
.field input:focus { border-color: var(--indigo); outline: none; box-shadow: 0 0 0 3px rgba(43, 45, 142, 0.15); }
.field input[aria-invalid='true'] { border-color: var(--red); background: #fdecec; color: #8f1f24; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

.consent { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--lavender-soft); border-radius: 10px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.consent input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--indigo); }

.error { color: var(--red); font-weight: 600; font-size: 14px; margin: 12px 0 0; }
.error:empty { margin: 0; }
.switch { margin: 16px 0 0; text-align: center; font-size: 15px; color: var(--muted); }
.link { background: none; border: 0; padding: 4px; font: 700 15px var(--display); color: var(--indigo); text-decoration: underline; cursor: pointer; min-height: 44px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; width: 100%;
  padding: 12px 18px; border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
  font: italic 800 18px/1.2 var(--display); letter-spacing: 0.2px; text-align: center; color: #fff; background: var(--indigo);
  box-shadow: 0 4px 0 var(--indigo-deep); transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--indigo-deep); }
.btn.red { background: var(--red); box-shadow: 0 4px 0 #a92a30; }
.btn.gold { background: var(--mustard); color: var(--ink); box-shadow: 0 4px 0 #c48c1f; }
.btn.green { background: var(--ok); box-shadow: 0 4px 0 #156b45; }
.btn.ghost { background: transparent; color: var(--indigo); box-shadow: none; border: 2px solid var(--indigo); font-style: normal; font-weight: 700; font-size: 15px; min-height: 44px; }
.btn.sm { width: auto; min-height: 44px; font-size: 15px; padding: 8px 14px; }
.btn[disabled] { background: #bdb9cf; color: #fff; box-shadow: 0 4px 0 #a29fb6; cursor: not-allowed; } /* after variants so it wins */
.mt { margin-top: 16px; }

/* ---------- Voting ---------- */
.band-name { margin: 6px 0 2px; font: italic 900 clamp(28px, 9vw, 38px)/1.05 var(--display); color: var(--ink); word-break: break-word; }
.band-info { margin: 0; color: var(--muted); font-size: 15px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 99px; background: var(--lavender-soft); color: var(--indigo); font: 700 14px var(--cond); letter-spacing: .5px; text-transform: uppercase; }
.pill.live { background: var(--red); color: #fff; }
.timer { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 6px; font: 700 15px var(--cond); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.timer b { font: italic 900 30px var(--display); color: var(--indigo); font-variant-numeric: tabular-nums; }
.timer.low b { color: var(--red); }
.bar { position: relative; height: 10px; background: var(--lavender-soft); border-radius: 99px; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--purple), var(--indigo)); border-radius: 99px; }
.timer.low + .bar > i { background: var(--red); }

.stars { display: flex; justify-content: space-between; gap: 4px; margin: 22px 0 6px; border: 0; padding: 0; }
.stars legend { font-weight: 600; font-size: 15px; margin-bottom: 10px; padding: 0; }
.star {
  flex: 1; aspect-ratio: 1; max-width: 72px; min-height: 52px; padding: 0; border: 0; background: none; cursor: pointer;
  color: #d9d6e6; -webkit-tap-highlight-color: transparent; transition: transform 0.1s, color 0.15s;
}
.star svg { width: 100%; height: 100%; display: block; fill: currentColor; stroke: #c48c1f; stroke-width: 0; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .08)); }
.star.on { color: var(--mustard); }
.star.on svg { stroke-width: 1; }
.star:active { transform: scale(0.9); }
.star[disabled] { cursor: progress; }
.scale { display: flex; justify-content: space-between; font: 600 13px var(--cond); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.voted { margin: 16px 0 0; padding: 12px; border-radius: 10px; background: #e7f6ee; border-left: 4px solid var(--ok); color: #145c3d; font-weight: 600; font-size: 15px; }
.next-up { margin: 16px 0 0; padding: 12px; border-radius: 10px; background: var(--paper); font-size: 15px; }
.next-up b { display: block; font: italic 800 20px var(--display); color: var(--indigo); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600;
  transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 10; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { text-align: center; font: 600 12px var(--cond); letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin-top: 28px; }
.loading { text-align: center; padding: 48px 0; color: var(--muted); }
.powered { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 0; font: 600 11px var(--cond); letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); opacity: 0.8; }
.powered img { height: 20px; width: auto; }
.powered.on-dark { color: #fff; opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
