@import url("/css/fonts.css");

/* ==========================================================================
   BRAC IT Raffle — shared design system
   Palette is lifted from bracits.com: coral #f25d5a (the logo), navy #092c58,
   violet #4e35df, mist #e6eaee. The stage is a deepened brand navy so the
   projector reads well in a dim room.
   ========================================================================== */

:root {
  --stage: #06182f;
  --stage-2: #0b2547;
  --stage-3: #12315b;
  --navy: #092c58;
  --coral: #f25d5a;
  --coral-dim: #c9403d;
  --violet: #4e35df;
  --mist: #e6eaee;
  --muted: #8098b8;
  --line: rgba(230, 234, 238, 0.14);

  --display: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r: 14px;
  --pad: clamp(1.1rem, 4vw, 2rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Layout classes below set display on the same elements that JS toggles with
   .hidden — without this, a hidden view still renders. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--stage);
  background-image:
    radial-gradient(1100px 620px at 50% -12%, rgba(78, 53, 223, 0.34), transparent 70%),
    radial-gradient(900px 520px at 92% 104%, rgba(242, 93, 90, 0.2), transparent 70%);
  background-attachment: fixed;
  color: var(--mist);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.02;
  text-transform: uppercase;
}

p {
  margin: 0;
}

a {
  color: var(--coral);
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- shell ---------------------------------------------------------------- */

.shell {
  width: min(560px, 100%);
  margin-inline: auto;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-height: 100dvh;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brandbar img {
  height: 30px;
  width: auto;
  display: block;
}

/* An eyebrow that states what this screen is. Not decoration — every surface
   (phone, projector, admin) shows a different one. */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow--live {
  color: var(--coral);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.eyebrow--live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

/* --- the signature: a raffle ticket stub ---------------------------------- */

.stub {
  position: relative;
  background: linear-gradient(150deg, var(--stage-2), var(--navy));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.35rem 1.4rem;
  overflow: hidden;
}

/* The tear line + punch notches that make it read as a torn ticket. */
.stub--torn {
  padding-top: 2.4rem;
}

.stub--torn::before,
.stub--torn::after {
  content: "";
  position: absolute;
  top: 1.55rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--stage);
  transform: translateY(-50%);
}

.stub--torn::before { left: -11px; }
.stub--torn::after { right: -11px; }

.stub__tear {
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  top: 1.55rem;
  border-top: 2px dashed rgba(230, 234, 238, 0.26);
}

.stub__label {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.stub__name {
  font-family: var(--display);
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  text-transform: uppercase;
  line-height: 1.05;
  margin-top: 0.15rem;
  word-break: break-word;
}

.stub__pin {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  color: var(--coral);
}

/* --- form --------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.field > label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  font-size: 0.86rem;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 0.95rem 1rem;
  font-family: var(--body);
  font-size: 1.05rem;
  color: var(--mist);
  background: rgba(6, 24, 47, 0.72);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.input::placeholder {
  color: rgba(128, 152, 184, 0.65);
}

.input:focus {
  border-color: var(--coral);
  background: rgba(6, 24, 47, 0.95);
  outline: none;
}

/* PIN entry — one box per digit, mono, because a PIN is a code. */
.pin {
  display: flex;
  gap: 0.6rem;
}

.pin input {
  flex: 1;
  min-width: 0;
  aspect-ratio: 3 / 4;
  max-height: 92px;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.7rem, 9vw, 2.4rem);
  color: var(--mist);
  background: rgba(6, 24, 47, 0.72);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  caret-color: var(--coral);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pin input:focus {
  border-color: var(--coral);
  transform: translateY(-2px);
  outline: none;
}

.pin input.is-set {
  border-color: rgba(242, 93, 90, 0.55);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1.05rem 1.4rem;
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--mist);
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--coral);
  border-color: var(--coral);
  color: #2a0808;
  font-weight: 700;
}

.btn--primary:hover:not(:disabled) {
  background: #ff6e6b;
}

.btn--ghost {
  background: transparent;
}

.btn--sm {
  width: auto;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.notice {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
}

.notice--error {
  background: rgba(242, 93, 90, 0.14);
  border-color: rgba(242, 93, 90, 0.5);
  color: #ffc9c8;
}

.notice--ok {
  background: rgba(78, 53, 223, 0.18);
  border-color: rgba(120, 100, 240, 0.5);
}

.notice[hidden] {
  display: none;
}

/* --- wheel -------------------------------------------------------------- */

.wheel-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.wheel-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* The pointer is a ticket punch biting into the wheel. */
.pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--coral);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
  z-index: 3;
}

.wheel-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2rem;
  color: var(--muted);
}

.wheel-empty[hidden] {
  display: none;
}

/* --- counters ----------------------------------------------------------- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat__num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.spacer {
  flex: 1;
}

/* --- winner takeover ---------------------------------------------------- */

.takeover {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
  padding: 6vw;
  background: linear-gradient(160deg, var(--coral), var(--coral-dim) 62%, #7a1f2a);
  color: #fff;
  animation: takeover-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.takeover[hidden] {
  display: none;
}

@keyframes takeover-in {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: scale(1); }
}

.takeover__eyebrow {
  font-family: var(--mono);
  font-size: clamp(0.7rem, 1.4vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.85;
}

.takeover__name {
  font-family: var(--display);
  font-size: clamp(2.6rem, 13vw, 12rem);
  line-height: 0.92;
  text-transform: uppercase;
  word-break: break-word;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.takeover__pin {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1rem, 2.4vw, 2rem);
  letter-spacing: 0.4em;
  opacity: 0.9;
}

.takeover__prize {
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(1rem, 2.6vw, 2.2rem);
  opacity: 0.95;
}

canvas.confetti {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

/* --- lists -------------------------------------------------------------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
}

.list .pin-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--coral);
  letter-spacing: 0.1em;
}

.list .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.card__title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.footnote {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
