:root {
  --violet: #6B2D91;
  --white: #FFFFFF;
  --ink: #1A1024;
  --lime: #39D353;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--white);
  font-family: "Noto Sans Devanagari", sans-serif;
}

button, input { font: inherit; color: inherit; }

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: default; opacity: 0.45; }

button:focus-visible, .ticker:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}

.is-off { display: none !important; }

.phone {
  width: min(100vw, 440px);
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--ink) url("bg-night.png") center/cover no-repeat;
  display: flex;
  flex-direction: column;
}

.phone.bars { background-image: url("bg-bars.png"); }

#splash {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ink) url("bg-night.png") center/cover no-repeat;
}

#splash p {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  text-shadow: 0 8px 24px var(--ink);
}

.ring {
  width: 156px;
  height: 156px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(from 30deg, var(--violet), var(--lime), var(--violet) 68%, transparent 76%, transparent 100%);
  animation: spin 1.05s linear infinite;
}

.ring img {
  width: 118px;
  height: 118px;
  border-radius: 30px;
  animation: spin 1.05s linear infinite reverse;
}

@keyframes spin { to { transform: rotate(360deg); } }

#gate {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: auto;
  padding: 22px 14px 28px;
  background: var(--ink) url("bg-night.png") center/cover no-repeat;
}

#shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--violet);
}

.logo { width: 46px; height: 46px; border-radius: 14px; }

.brand { flex: 1; min-width: 0; }

.brand strong, .brand small { display: block; }

.brand strong { font-size: 18px; line-height: 1.2; }

.brand small { color: var(--lime); font-size: 12px; }

.mark {
  position: relative;
  width: 54px;
  height: 36px;
  border: 0;
  padding: 0;
  background: transparent;
}

.mark img { width: 54px; height: 28px; object-fit: contain; }

#badge, #day-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--lime);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.ticker {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  border-block: 2px solid var(--violet);
  background: var(--ink);
  color: var(--lime);
  overflow: hidden;
  text-align: left;
  padding: 8px 0;
  font-weight: 700;
}

.ticker-move {
  display: flex;
  width: max-content;
  animation: ticker 16s linear infinite;
}

.ticker.paused .ticker-move { animation-play-state: paused; }

.ticker em {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  background: var(--violet);
  color: var(--white);
  border-radius: 999px;
  padding: 2px 8px;
}

.ticker em:empty { display: none; }

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

#main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 12px 16px;
}

.dockwrap {
  padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(26, 16, 36, 0.72));
}

.dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 4px;
  padding: 10px 8px 8px;
  border-radius: 28px;
  background: var(--violet);
  box-shadow: 0 12px 30px rgba(26, 16, 36, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.sig {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 78px;
  padding: 0;
}

.sig i {
  display: block;
  width: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.38);
}

.sig:nth-child(1) i { height: 16px; }
.sig:nth-child(2) i { height: 28px; }
.sig:nth-child(3) i { height: 42px; }
.sig:nth-child(4) i { height: 56px; }

.sig.on i {
  background: var(--lime);
  box-shadow: 0 0 16px var(--lime);
  animation: pulse 1.5s ease-in-out infinite;
}

.sig.on span { color: var(--lime); }

.sig span { font-size: 13px; font-weight: 700; }

#day-badge { top: 0; right: 8px; }

@keyframes pulse {
  50% { transform: scaleY(1.06); filter: brightness(1.12); }
}

.hero {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 24px;
  background: rgba(107, 45, 145, 0.92);
}

.hero img { width: 72px; height: 72px; border-radius: 18px; }

.hero h2, .hero p { margin: 0; }

.hero h2 { font-size: 22px; }

.kicker { color: var(--lime); font-weight: 700; font-size: 13px; }

.cta, .tapbtn, .solid {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--violet);
  color: var(--white);
  font-weight: 700;
  padding: 14px 16px;
  box-shadow: 0 0 0 3px var(--lime);
  margin-top: 12px;
}

.tapbtn.armed {
  background: var(--lime);
  color: var(--ink);
}

.rule {
  margin: 8px 2px 0;
  color: var(--white);
  font-size: 13px;
  text-shadow: 0 2px 8px var(--ink);
}

.card, .tool, .white, .cell, .sketch, .choice, .level {
  background: var(--white);
  color: var(--ink);
}

.card {
  border-radius: 22px;
  padding: 12px;
  margin-top: 10px;
}

.card.pinned { box-shadow: inset 4px 0 0 var(--lime); }

.card h2, .tape h2, .sheet-panel h2 { margin: 8px 0; font-size: 18px; }

.card p, .sheet-panel p, .tape p { margin: 0 0 4px; line-height: 1.5; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--violet);
  color: var(--white);
  border-radius: 999px;
  padding: 2px 10px 2px 4px;
  font-size: 12px;
  font-weight: 700;
}

.tag img, .shield img { width: 32px; height: 16px; object-fit: contain; }

.pin {
  border: 0;
  border-radius: 999px;
  background: var(--violet);
  color: var(--white);
  font-weight: 700;
  padding: 6px 12px;
}

.pin.on { background: var(--lime); color: var(--ink); }

.tape {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 22px;
  padding: 10px;
  margin-top: 10px;
}

.tape img { width: 36px; height: 72px; object-fit: contain; }

.panel {
  background: rgba(107, 45, 145, 0.92);
  color: var(--white);
  border-radius: 24px;
  padding: 12px;
}

.panel h2 { margin: 6px 0; font-size: 22px; }

.quiet { margin: 0; color: var(--lime); font-weight: 700; font-size: 13px; }

.scoreline { margin: 0 0 8px; font-weight: 700; }

.boards { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }

.boards button {
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  padding: 8px 0;
  font-weight: 700;
}

.boards button.on { background: var(--lime); color: var(--ink); }

.boards button.win { box-shadow: inset 0 0 0 2px var(--lime); }

.boards button.fail { box-shadow: inset 0 0 0 2px var(--white); }

.hits { display: flex; gap: 6px; align-items: end; min-height: 26px; margin: 8px 0; }

.hits i {
  width: 10px;
  height: 24px;
  border-radius: 6px;
  background: var(--lime);
  display: block;
}

.hits i.used { height: 10px; background: var(--white); }

.board-art { width: 112px; height: 112px; object-fit: contain; display: block; margin: 4px auto; }

.slot {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  min-height: 38px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin-top: 6px;
}

.slot.on { background: var(--white); color: var(--ink); }

.slot b { color: var(--violet); }

.choice {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 8px;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.stats div, .white {
  background: var(--white);
  color: var(--ink);
  border-radius: 16px;
  padding: 8px;
}

.stats small, .white small { display: block; font-size: 12px; }

.stats b, .white b { font-size: 18px; }

.shield { display: flex; align-items: center; gap: 6px; color: var(--white); font-weight: 700; text-shadow: 0 2px 8px var(--ink); }

.shield img.dim { opacity: 0.35; }

.track {
  position: relative;
  height: 42px;
  border-radius: 999px;
  background: var(--ink);
  overflow: hidden;
  margin-top: 8px;
}

.zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--lime);
}

.zone.hot { box-shadow: inset 0 0 0 3px var(--white); }

.grow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: var(--violet);
}

.needle {
  position: absolute;
  top: 4px;
  height: 34px;
  width: 16px;
  transform: translateX(-50%);
  left: 0;
  object-fit: contain;
  pointer-events: none;
}

.track.good { box-shadow: 0 0 0 3px var(--lime); }

.track.bad { box-shadow: 0 0 0 3px var(--white); }

.note { min-height: 1.4em; font-weight: 700; color: var(--white); text-shadow: 0 2px 8px var(--ink); }

.subhead { display: flex; align-items: center; gap: 8px; }

.subhead h2 { margin: 0; font-size: 22px; text-shadow: 0 2px 10px var(--ink); }

.back, .ghost {
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  padding: 8px 12px;
}

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }

.cell { border-radius: 12px; padding: 6px 0 8px; text-align: center; font-size: 10px; font-weight: 700; }

.cell u { display: block; height: 8px; margin: 6px 4px 0; border-radius: 99px; background: var(--violet); opacity: 0.25; text-decoration: none; }

.cell.on { background: var(--lime); }

.cell.on u { opacity: 1; background: var(--ink); }

.cell.today { box-shadow: inset 0 0 0 2px var(--violet); }

.tool {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 12px;
  margin-top: 8px;
  font-weight: 700;
}

.tool em { font-style: normal; color: var(--violet); }

.heat {
  height: 160px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  background: var(--white);
  border-radius: 22px;
  padding: 12px;
  margin-top: 10px;
}

.heat div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }

.heat b {
  display: block;
  width: 100%;
  border-radius: 8px 8px 4px 4px;
  background: var(--violet);
  min-height: 8px;
}

.heat div.on b { background: var(--lime); }

.heat span { color: var(--ink); font-size: 10px; font-weight: 700; }

.tablewrap { overflow-x: auto; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; background: var(--white); color: var(--ink); border-radius: 16px; overflow: hidden; font-size: 13px; }

th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(107, 45, 145, 0.2); }

th { color: var(--violet); }

.sketch { border-radius: 20px; padding: 12px; margin-top: 10px; }

.sketch.on { box-shadow: 0 0 0 3px var(--lime); }

.mini {
  position: relative;
  height: 28px;
  border-radius: 99px;
  background: var(--ink);
  overflow: hidden;
  margin: 8px 0;
}

.mini i { position: absolute; top: 0; bottom: 0; background: var(--lime); }

label { display: block; font-size: 13px; font-weight: 700; margin-top: 6px; }

input[type="range"] { width: 100%; accent-color: var(--lime); }

.phrases { display: grid; gap: 8px; margin-top: 8px; }

.phrases button, .level {
  border: 0;
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  font-weight: 700;
  background: var(--white);
  color: var(--ink);
}

.ghost { width: 100%; margin-top: 8px; }

article[data-act] { cursor: pointer; }

.phrases button.on, .level.on { box-shadow: 0 0 0 3px var(--lime); background: var(--lime); color: var(--ink); }

.levels { display: grid; gap: 10px; margin-top: 12px; }

.level { display: flex; align-items: center; gap: 12px; }

.lv { display: flex; align-items: end; gap: 4px; height: 42px; }

.lv i { width: 10px; border-radius: 6px; background: var(--violet); display: block; }

.level.on .lv i { background: var(--ink); }

.dots { display: flex; gap: 6px; margin-bottom: 12px; }

.dots i { width: 28px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.35); display: block; }

.dots i.on, .dots i.done { background: var(--lime); }

.ob-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }

.ob-nav button { border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 700; background: var(--lime); color: var(--ink); }

h1.ob { margin: 8px 0; font-size: 26px; text-shadow: 0 4px 16px var(--ink); }

.lead { color: var(--white); text-shadow: 0 2px 8px var(--ink); }

.ask { display: grid; gap: 8px; margin-top: 12px; }

.ask button { border: 0; border-radius: 18px; background: var(--white); color: var(--ink); font-size: 22px; font-weight: 700; padding: 16px; }

.shake { animation: shake 0.35s ease; }

@keyframes shake {
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

#sheet {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-back { flex: 1; background: rgba(26, 16, 36, 0.72); }

.sheet-panel {
  background: var(--white);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 78%;
  overflow: auto;
}

#toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(118px + env(safe-area-inset-bottom));
  z-index: 10;
  background: var(--violet);
  color: var(--white);
  border: 2px solid var(--lime);
  border-radius: 999px;
  text-align: center;
  padding: 10px 14px;
  font-weight: 700;
}

#gate:not(.is-off) ~ #toast { bottom: 22px; }

.preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--white);
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .ring, .ring img, .ticker-move, .sig.on i, .shake { animation: none; }
}
