/* Lotjar — a glass jar on a dark counter, one hot accent. Phone first; the CA rides a side rail at every width. */
:root {
  --ground: #131217;
  --shelf: #1b1920;
  --edge: #2b2832;
  --ink: #f1ecf4;
  --dim: #9a93a5;
  --hot: #ff2e8e;
  --hot-soft: rgba(255, 46, 142, .16);
  --coin-a: #9d99a4;
  --coin-b: #55525c;
  --rail-w: 46px;
  --f-show: "Bagel Fat One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --f-text: "Onest", system-ui, -apple-system, sans-serif;
  --f-code: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.5 var(--f-text);
  padding: 18px calc(var(--rail-w) + 16px) 40px 16px;
  overflow-x: hidden;
}
a { color: inherit; }
code { font-family: var(--f-code); }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- the CA rail: a vertical tab on the right edge (phone/tablet), a full rail on the left (desktop) ---------- */
.lj-rail {
  position: fixed; z-index: 30; right: 0; top: 50%; transform: translateY(-50%);
  width: var(--rail-w); padding: 12px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: #1f1c25; border: 1px solid var(--edge); border-right: 0;
  border-radius: 16px 0 0 16px; box-shadow: -8px 0 30px rgba(0,0,0,.45);
}
.lj-rail-logo { width: 28px; height: 28px; border-radius: 50%; display: block; }
.lj-rail-k, .lj-addr { writing-mode: vertical-rl; }
.lj-rail-k { font: 500 10px/1 var(--f-code); letter-spacing: .14em; color: var(--hot); text-transform: uppercase; }
.lj-addr { font: 500 10.5px/1 var(--f-code); color: var(--ink); user-select: all; -webkit-user-select: all; letter-spacing: .02em; }
.lj-addr.is-blank { color: var(--dim); letter-spacing: .1em; }
.lj-copy {
  writing-mode: vertical-rl; border: 0; background: var(--hot); color: #19060f;
  font: 700 11px/1 var(--f-text); letter-spacing: .08em; padding: 10px 7px; border-radius: 99px;
}
.lj-copy[data-done="1"] { background: var(--ink); }
.lj-gm { writing-mode: vertical-rl; font: 400 10px/1 var(--f-code); color: var(--dim); text-decoration: none; letter-spacing: .1em; }
.lj-gm:hover { color: var(--ink); }

/* ---------- shell: one column on the phone; the wrappers vanish so the number leads ---------- */
.lj-shell, .lj-stage, .lj-aside { display: contents; }

/* ---------- the number ---------- */
.lj-big { margin: 6px 0 4px; font: 400 clamp(84px, 27vw, 128px)/.92 var(--f-show); letter-spacing: -.02em; }
.lj-big-n { display: block; color: var(--ink); text-shadow: 0 0 40px rgba(255, 46, 142, .25); }
.lj-big[data-hot="1"] .lj-big-n { color: var(--hot); text-shadow: 0 0 46px rgba(255, 46, 142, .55); }
.lj-big-u { display: block; margin-top: 8px; font: 500 15px/1.3 var(--f-text); letter-spacing: 0; color: var(--dim); }
.lj-big-u b { color: var(--ink); font-weight: 700; }
.lj-callout { margin: 10px 0 18px; font-size: 16px; line-height: 1.5; color: #d9d3e0; max-width: 46ch; }
.lj-callout b { color: var(--ink); }
.lj-callout code { font-size: 12px; color: var(--hot); word-break: break-all; }

/* ---------- the jar ---------- */
.lj-counter {
  position: relative; padding: 16px 14px 18px; margin-bottom: 26px;
  background: radial-gradient(120% 80% at 50% 0%, #26222d 0%, var(--shelf) 60%); border: 1px solid var(--edge); border-radius: 26px;
}
.lj-jarhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.lj-jarno { font: 400 22px/1 var(--f-show); }
.lj-mood { font: 500 11px/1 var(--f-code); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.lj-mood[data-m="filling"], .lj-mood[data-m="drawn"] { color: var(--hot); }
.lj-mood[data-m="lidded"] { color: #ffd0e6; }

.lj-jar { position: relative; width: min(100%, 290px); margin: 10px auto 0; padding-top: 34px; }
.lj-lid {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 58%; height: 26px; border-radius: 9px 9px 5px 5px;
  background: linear-gradient(180deg, #c99a6c 0%, #a87a4f 55%, #8c6440 100%);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.4);
  transition: transform .5s cubic-bezier(.3,1.4,.5,1), opacity .3s;
}
.lj-jar[data-mode="open"] .lj-lid { transform: translate(-50%, -22px) rotate(-9deg); opacity: .35; }
.lj-neck { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); width: 64%; height: 14px; border-radius: 6px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); }
.lj-glass {
  position: relative; border-radius: 30px 30px 40px 40px; padding: 18px 16px 16px;
  background: linear-gradient(100deg, rgba(255,255,255,.07), rgba(255,255,255,.02) 40%, rgba(255,255,255,.05));
  border: 1.5px solid rgba(255,255,255,.2); box-shadow: inset 0 0 40px rgba(255,255,255,.04), 0 24px 40px rgba(0,0,0,.45);
  overflow: hidden;
}
.lj-shine { position: absolute; top: 10%; left: 7%; width: 9px; height: 70%; border-radius: 9px; background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0)); pointer-events: none; }
.lj-slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; direction: ltr; }
/* lot 1 sits at the bottom of the glass: the grid fills bottom-up */
.lj-slots { display: flex; flex-wrap: wrap-reverse; }
.lj-slot { width: calc(50% - 6px); aspect-ratio: 1 / .62; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; }
.lj-slot-n { font: 400 19px/1 var(--f-show); }
.lj-slot-w { font: 500 10px/1 var(--f-code); margin-top: 4px; opacity: .85; }
.lj-slot.is-empty { border: 1.5px dashed rgba(255,255,255,.16); color: rgba(255,255,255,.28); }
.lj-slot.is-in {
  background: radial-gradient(70% 60% at 40% 35%, var(--coin-a) 0%, #77737e 45%, var(--coin-b) 100%);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.28), inset 0 3px 0 rgba(255,255,255,.18), 0 6px 10px rgba(0,0,0,.35);
  color: #232128;
}
.lj-slot.is-mine { box-shadow: inset 0 -5px 0 rgba(0,0,0,.28), 0 0 0 3px var(--hot), 0 6px 10px rgba(0,0,0,.35); }
.lj-slot.is-next { border: 2px dashed var(--hot); color: var(--hot); background: var(--hot-soft); animation: ljPulse 1.6s ease-in-out infinite; }
.lj-slot.is-next .lj-slot-w { font-family: var(--f-text); font-weight: 700; letter-spacing: .02em; }
.lj-slot.is-landed { animation: ljLand .7s cubic-bezier(.3,1.5,.5,1); }
.lj-slot.is-drawn {
  background: radial-gradient(70% 60% at 40% 35%, #ff8cc0 0%, var(--hot) 55%, #b5115d 100%); color: #1d0611;
  box-shadow: 0 0 0 3px #ffd0e6, 0 0 34px 6px rgba(255,46,142,.7); z-index: 2; animation: ljGlow 1.4s ease-in-out infinite alternate;
}
.lj-slot.is-out { opacity: .28; filter: grayscale(1); }
.lj-falling { position: absolute; top: 0; left: 50%; width: 46px; height: 28px; margin-left: -23px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(70% 60% at 40% 35%, #ff8cc0 0%, var(--hot) 60%, #b5115d 100%); box-shadow: 0 0 20px rgba(255,46,142,.7); }
.lj-falling.is-go { animation: ljFall .8s cubic-bezier(.5,0,.8,.4); }
@keyframes ljPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes ljLand { 0% { transform: translateY(-120px) scale(.8); opacity: 0; } 70% { opacity: 1; } 100% { transform: none; } }
@keyframes ljGlow { from { box-shadow: 0 0 0 3px #ffd0e6, 0 0 22px 2px rgba(255,46,142,.55); } to { box-shadow: 0 0 0 3px #ffd0e6, 0 0 44px 10px rgba(255,46,142,.85); } }
@keyframes ljFall { 0% { opacity: 1; transform: translateY(-40px); } 100% { opacity: 0; transform: translateY(200px); } }

.lj-say { margin: 16px 2px 10px; text-align: center; font-size: 15px; color: #dcd6e3; }
.lj-say em { font-style: normal; color: var(--hot); font-weight: 700; }
.lj-meter { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; padding: 0 6px; }
.lj-meter i { height: 5px; border-radius: 3px; background: var(--edge); }
.lj-meter i.on { background: var(--hot); }

/* ---------- drop a lot ---------- */
.lj-drop { padding: 16px 4px 2px; margin-top: 16px; border-top: 1px solid var(--edge); }
.lj-drop-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lj-drop-h { font: 400 20px/1 var(--f-show); }
.lj-plug { border: 1px solid var(--edge); background: transparent; border-radius: 99px; padding: 7px 14px; font-size: 13px; color: var(--dim); }
.lj-plug[data-on="1"] { color: var(--ink); border-color: var(--hot); font-family: var(--f-code); font-size: 12px; }
.lj-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.lj-pick-b { border: 1px solid var(--edge); background: #17151b; border-radius: 14px; padding: 11px 0; font-weight: 500; color: var(--dim); }
.lj-pick-b[aria-pressed="true"] { color: var(--ink); border-color: var(--hot); background: var(--hot-soft); }
.lj-go { width: 100%; border: 0; border-radius: 16px; padding: 17px 10px; background: var(--hot); color: #1a0510; font: 700 17px/1 var(--f-text); box-shadow: 0 10px 30px rgba(255,46,142,.3); }
.lj-go:disabled { opacity: .6; }
.lj-small { margin: 10px 2px 0; font-size: 13px; line-height: 1.5; color: var(--dim); }
.lj-claim { width: 100%; margin-top: 12px; border: 1.5px solid var(--hot); border-radius: 14px; background: transparent; padding: 13px; font-weight: 700; color: var(--hot); }
.lj-claim[hidden] { display: none; }

/* ---------- the roll (plays as they land) ---------- */
.lj-h { font: 400 22px/1.1 var(--f-show); margin: 0 0 12px; }
.lj-roll-wrap { margin-bottom: 18px; }
.lj-roll { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--edge); }
.lj-roll li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--edge); font-size: 14px; }
.lj-roll time { font: 400 12px/1.6 var(--f-code); color: var(--dim); }
.lj-roll li.k-drawn span { color: var(--hot); font-weight: 700; }
.lj-roll li.k-full span { color: #ffd0e6; }
.lj-roll li.is-new { animation: ljPrint .6s ease-out; background: linear-gradient(90deg, var(--hot-soft), transparent 70%); }
.lj-roll li.lj-roll-quiet { display: block; color: var(--dim); font-size: 14px; }
@keyframes ljPrint { from { opacity: 0; transform: translateY(-8px); clip-path: inset(0 100% 0 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }

.lj-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 28px; }
.lj-stats div { padding: 12px 10px; border-radius: 16px; background: var(--shelf); border: 1px solid var(--edge); }
.lj-stats b { display: block; font: 400 24px/1 var(--f-show); }
.lj-stats span { font-size: 12px; color: var(--dim); }

/* ---------- the menu card ---------- */
.lj-card { padding: 20px 18px; border-radius: 24px; background: #18161d; border: 1px solid var(--edge); margin-bottom: 18px; }
.lj-menu { list-style: none; margin: 0 0 16px; padding: 0; }
.lj-menu li { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; font-size: 15px; }
.lj-menu span { color: #dcd6e3; }
.lj-menu i { flex: 1; min-width: 16px; border-bottom: 2px dotted #3d3945; transform: translateY(-4px); }
.lj-menu b { font-family: var(--f-code); font-weight: 500; font-size: 13px; color: var(--ink); text-align: right; }
.lj-example { border-radius: 18px; padding: 14px; background: var(--hot-soft); border: 1px solid rgba(255,46,142,.35); }
.lj-example p { margin: 8px 0 0; font-size: 14.5px; }
.lj-chip { display: inline-block; font: 500 10.5px/1 var(--f-code); letter-spacing: .12em; text-transform: uppercase; color: var(--hot); }

.lj-check { font-size: 14px; color: #d0cad8; overflow-wrap: anywhere; }
.lj-check code { font-size: 12px; }
.lj-check .lj-okay { color: var(--hot); font-weight: 700; }
.lj-jars { list-style: none; margin: 0; padding: 0; }
.lj-jars li { padding: 11px 0; border-top: 1px solid var(--edge); font-size: 14px; }
.lj-jars small { display: block; margin-top: 3px; font: 400 11px/1.5 var(--f-code); color: var(--dim); overflow-wrap: anywhere; }
.lj-wallet { margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--shelf); font-size: 13.5px; overflow-wrap: anywhere; }

.lj-foot { padding: 18px 2px 0; font-size: 12.5px; color: var(--dim); }
.lj-foot div { margin-bottom: 8px; }
.lj-foot span { display: block; font: 500 10px/1.4 var(--f-code); letter-spacing: .12em; text-transform: uppercase; }
.lj-foot code { font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.lj-foot-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.lj-foot-links a { text-decoration: none; color: var(--ink); }
.lj-foot-links a.is-off { display: none; }

.lj-toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.lj-toasts div { background: var(--ink); color: var(--ground); padding: 11px 14px; border-radius: 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---------- tablet: wider measure, bigger jar ---------- */
@media (min-width: 640px) {
  :root { --rail-w: 54px; }
  body { padding: 28px calc(var(--rail-w) + 32px) 48px 32px; font-size: 16px; }
  .lj-addr { font-size: 12px; }
  .lj-big { font-size: 150px; }
  .lj-callout { font-size: 18px; }
  .lj-jar { width: 360px; }
  .lj-slot-n { font-size: 24px; }
  .lj-slot-w { font-size: 11px; }
  .lj-counter { max-width: 620px; }
}

/* ---------- desktop: the rail moves to the left edge, the page recomposes into jar + roll ---------- */
@media (min-width: 1000px) {
  :root { --rail-w: 232px; }
  body { padding: 40px 40px 56px calc(var(--rail-w) + 40px); }
  .lj-rail {
    left: 0; right: auto; top: 0; bottom: 0; transform: none; width: var(--rail-w);
    padding: 30px 22px; align-items: flex-start; justify-content: flex-end; gap: 12px;
    border-radius: 0; border: 0; border-right: 1px solid var(--edge); box-shadow: none;
    background: linear-gradient(180deg, #1a1820 0%, #141217 100%);
  }
  .lj-rail-logo { width: 56px; height: 56px; margin-bottom: auto; }
  .lj-rail-k, .lj-addr, .lj-copy, .lj-gm { writing-mode: horizontal-tb; }
  .lj-addr { font-size: 13.5px; line-height: 1.5; word-break: break-all; }
  .lj-copy { padding: 11px 18px; font-size: 13px; }
  .lj-shell {
    display: grid; max-width: 1140px; margin: 0 auto;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); column-gap: 44px; align-items: start;
  }
  .lj-stage, .lj-aside { display: block; }
  .lj-aside { position: sticky; top: 30px; }
  .lj-card, .lj-foot { grid-column: 1 / -1; }
  #rules { grid-column: 1; }
  .lj-history { grid-column: 2; grid-row: 2; }
  .lj-foot { grid-row: 3; }
  .lj-big { font-size: 190px; margin-top: 0; }
  .lj-big-u { font-size: 17px; }
  .lj-callout { font-size: 19px; max-width: 52ch; }
  .lj-counter { display: grid; grid-template-columns: 330px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 30px; max-width: none; padding: 22px 26px 24px; }
  .lj-jarhead { grid-column: 1 / -1; }
  .lj-jar { grid-column: 1; grid-row: 2 / 5; width: 330px; margin-top: 4px; }
  .lj-say { grid-column: 2; grid-row: 2; text-align: left; font-size: 17px; margin: 18px 0 12px; }
  .lj-meter { grid-column: 2; grid-row: 3; padding: 0; }
  .lj-drop { grid-column: 2; grid-row: 4; align-self: start; border-top: 0; padding: 22px 0 0; margin: 0; }
  .lj-roll { max-height: 640px; overflow: auto; }
}
@media (min-width: 1500px) {
  .lj-big { font-size: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
