:root{
  --bg: #070707;
  --bgSolid: #070707;

  --card: rgba(20,20,20,.92);       /* more solid = no split showing through */
  --stroke: rgba(255,255,255,.10);
  --shadow: rgba(0,0,0,.65);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.55);
  --orange: #ff4d00;

  --r: 22px;
  --r2: 16px;
}

html[data-theme="light"]{
  --bg: #f6f6f6;
  --bgSolid:#f6f6f6;

  --card: rgba(255,255,255,.92);
  --stroke: rgba(0,0,0,.10);
  --shadow: rgba(0,0,0,.12);

  --text: rgba(0,0,0,.88);
  --muted: rgba(0,0,0,.55);
  --orange: #ff4d00;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);

  /* FIX: uniform background (no split band) */
  background: var(--bgSolid);
}

/* Optional soft glow, but single layer only (won’t band) */
body::before{
  content:"";
  position:fixed;
  inset:-40px;
  pointer-events:none;
  background: radial-gradient(900px 520px at 50% 0%, rgba(255,77,0,.16), transparent 60%);
  opacity: .9;
}

.hidden{ display:none !important; }

/* ===== Topbar ===== */
.topbar{
  width: 100%;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0));
  backdrop-filter: blur(10px);
}

html[data-theme="light"] .topbar{
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,0));
}

.brandBlock{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brandMark{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(255,77,0,.12);
}

.brandText{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}

.brandName{
  font-weight: 900;
  letter-spacing: .4px;
}

.productName{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .2px;
}

.topActions{
  display:flex;
  align-items:center;
  gap: 10px;
}

.seg{
  display:flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.22);
}

html[data-theme="light"] .seg{
  background: rgba(0,0,0,.03);
}

.segBtn{
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor:pointer;
}

.segBtn.is-active{
  background: rgba(255,255,255,.10);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
}

html[data-theme="light"] .segBtn.is-active{
  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.08);
}

.iconBtn{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.22);
  display:grid;
  place-items:center;
  cursor:pointer;
}

html[data-theme="light"] .iconBtn{
  background: rgba(0,0,0,.03);
}

.icon{
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
}

/* ===== Pages ===== */
.page{
  width: 100%;
  min-height: calc(100vh - 66px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  padding: 6px 14px 28px;
  gap: 14px;
}

/* ===== Wheel outside card ===== */
.wheelStage{
  width: min(520px, 92vw);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 8px;
  margin-top: 4px;
}

.wheelWrap{
  position: relative;
  width: min(380px, 92vw); /* mobile fills nicely */
  aspect-ratio: 1/1;
  display:grid;
  place-items:center;
}

.wheelImg{
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: rotate(0deg);
  will-change: transform;
  user-select:none;
  -webkit-user-drag:none;
  filter: drop-shadow(0 22px 28px rgba(0,0,0,.55));
}

.pointerImg{
  position:absolute;
  top: -8%;
  left: 50%;
  transform: translateX(-50%);
  width: 22%;
  height:auto;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,.6));
}

.wheelNote{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-align:center;
}

/* ===== Card (more solid) ===== */
.card{
  width: min(520px, 92vw);
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: 0 24px 60px var(--shadow);
  padding: 16px 16px 18px;
}

.codeCard{
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items: center;
}

.codeCard .cardTitle,
.codeCard .hint{
  width: 100%;
  text-align: center;
}

.cardTitle{
  font-weight: 900;
  letter-spacing: .4px;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

/* a11y-only label */
.srOnly{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

.input{
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  color: var(--text);
  padding: 0 16px;
  outline:none;
  box-shadow: inset 0 10px 16px rgba(0,0,0,.30);
}

html[data-theme="light"] .input{
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.10);
  box-shadow: inset 0 10px 16px rgba(0,0,0,.06);
}

.input:focus{
  border-color: rgba(255,77,0,.35);
  box-shadow: inset 0 10px 16px rgba(0,0,0,.30), 0 0 0 3px rgba(255,77,0,.12);
}

.btn{
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.04));
  color: var(--orange);
  font-weight: 900;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor:pointer;
  box-shadow: 0 16px 28px rgba(0,0,0,.45), inset 0 10px 16px rgba(0,0,0,.30);
}

.btn:active{ transform: translateY(1px); }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

.btn--ghost{
  /* Same theme as primary button, just less emphasis */
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  color: var(--orange);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 12px 18px rgba(0,0,0,.35);
}

.btn--ghost:hover{ border-color: rgba(255,77,0,.22); }

html[data-theme="light"] .btn--ghost{
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.02));
  border-color: rgba(0,0,0,.10);
}
html[data-theme="light"] .btn--ghost:hover{ border-color: rgba(255,77,0,.22); }


.hint{
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.hint--center{ text-align:center; }

/* ===== WINNING ===== */
.winCard{
  width: min(860px, 92vw);
  padding: 18px 18px 20px;
}

.winTop{
  text-align:center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.winTitle{
  font-size: clamp(26px, 4.4vw, 44px);
  font-weight: 900;
  letter-spacing: 1.2px;
  color: var(--orange);
}

.winSubtitle{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.rows{
  margin-top: 14px;
  display:grid;
  gap: 10px;
}

.row{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items:center;
  padding: 12px 14px;
  border-radius: var(--r2);
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.08);
}

html[data-theme="light"] .row{
  background: rgba(0,0,0,.02);
}

.key{
  color: var(--orange);
  font-size: 20px;
  font-weight: 300;
  text-transform: lowercase;
}

.val{
  font-weight: 900;
  color: rgba(255,255,255,.86);
  word-break: break-word;
}

html[data-theme="light"] .val{
  color: rgba(0,0,0,.82);
}

.val--accent{
  color: var(--orange);
}

.winActions{
  width: min(860px, 92vw);
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items:center;
  margin-top: 4px;
}

/* Mobile */
@media (max-width: 420px){
  .wheelWrap{ width: min(380px, 96vw); }
  .row{ grid-template-columns: 92px 1fr; }
  .key{ font-size: 18px; }
}



/* ===== HISTORY ===== */
.historyCard{
  width: min(860px, 92vw);
  margin: 0 auto;
  padding: 18px 18px 20px;
}

.historyHeader{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.historyHeaderTitle{
  text-align: center;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--orange);
}

.historyHeaderSpacer{ width: 1px; height: 1px; }

.historyTable{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(0,0,0,.18);
}

html[data-theme="light"] .historyTable{
  background: rgba(255,255,255,.55);
  border-color: rgba(0,0,0,.10);
}

.historyTableHead{
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.8fr 1.1fr;
  gap: 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  border-bottom: 1px solid rgba(255,255,255,.10);
}

html[data-theme="light"] .historyTableHead{
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.02));
  border-bottom-color: rgba(0,0,0,.10);
}

.historyTableBody{ display:block; }

.historyRow{
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.8fr 1.1fr;
  gap: 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  align-items: center;
}

html[data-theme="light"] .historyRow{
  border-bottom-color: rgba(0,0,0,.08);
}

.historyRow:nth-child(even){
  background: rgba(255,255,255,.02);
}
html[data-theme="light"] .historyRow:nth-child(even){
  background: rgba(0,0,0,.02);
}

.historyRow:last-child{ border-bottom: 0; }

.hCell{
  font-size: 13px;
  color: var(--text);
  min-width: 0; /* allow ellipsis */
}

.historyTableHead .hCell{
  font-size: 12px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
}

.hCell--name{
  text-align: left;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hCell--prize{
  text-align: right;
  font-weight: 900;
  color: var(--orange);
  white-space: nowrap;
}

.hCell--code{
  text-align: center;
  font-weight: 900;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.hCell--date{
  text-align: right;
  font-size: 12px;
  color: rgba(255,255,255,.78);
  white-space: nowrap;
}

html[data-theme="light"] .hCell--date{
  color: rgba(0,0,0,.72);
}

.historyEmpty{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.historyActions{
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (max-width: 520px){
  .historyCard{ padding: 16px; }
  .historyTableHead, .historyRow{
    grid-template-columns: 1.2fr 0.9fr 0.8fr 1.1fr;
    padding: 10px 12px;
  }
  .hCell{ font-size: 12px; }
  .hCell--date{ font-size: 11px; }
}



