/* ลอยกระทงออนไลน์ — night river under the full moon of the twelfth month */
:root {
  --ink: #0e1a3d;          /* night sky */
  --sheet: #121f4a;        /* panels */
  --river: #0b2a4a;
  --moon: #f7e9bf;         /* moonlight cream: titles */
  --flame: #f4a53b;        /* candle flame: primary action */
  --flame-ink: #2a1606;
  --lotus: #ec8fb1;        /* hearts */
  --leaf: #6fae55;
  --text: #f3ecda;
  --muted: rgba(243, 236, 218, .74);
  --line: rgba(243, 236, 218, .18);
  --glass: rgba(10, 19, 48, .78);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font: 400 16px/1.6 "IBM Plex Sans Thai Looped", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--flame); outline-offset: 2px; }
[hidden] { display: none !important; }

#river { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

/* ---------- sky text ---------- */
.sky {
  position: fixed;
  top: calc(var(--safe-t) + clamp(18px, 4vh, 44px));
  left: clamp(18px, 5vw, 64px);
  max-width: min(62vw, 560px);
  pointer-events: none;
}
.sky h1 {
  margin: 0;
  font: 700 clamp(56px, 12vw, 124px)/.95 "Charm", serif;
  color: var(--moon);
  text-shadow: 0 0 28px rgba(247, 233, 191, .35);
}
.sky h1 .h1-sub { display: block; margin-top: .15em; font: 600 clamp(20px, 3.6vw, 32px)/1.2 "IBM Plex Sans Thai Looped", system-ui, sans-serif; text-shadow: none; }
.lede { margin: .5em 0 0; font-size: clamp(16px, 2.1vw, 20px); color: var(--muted); max-width: 26em; text-wrap: balance; }
.count { margin: .35em 0 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count span { color: var(--moon); font-weight: 600; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: #fff;
  color: #3a2a1a;
  font-size: 14px;
  text-decoration: none;
  pointer-events: auto; /* the sky header ignores taps so the river stays tappable */
}
.brand img { display: block; width: 120px; height: auto; }

/* "how to" panel: real, openable text for people and search engines (never hide it with .sr or display:none) */
.about { width: fit-content; margin-top: 6px; font-size: 14px; color: var(--muted); pointer-events: auto; } /* .sky ignores taps; this one must open */
.about summary { min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.about summary::-webkit-details-marker { display: none; }
.about summary::before { content: "▸"; text-decoration: none; }
.about[open] summary::before { content: "▾"; }
.about[open] { max-width: 26em; max-height: 50vh; overflow: auto; padding: 0 14px 12px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(8px); }
.about p, .about ol { margin: .4em 0; }
.about ol { padding-left: 1.2em; }

.invite {
  position: fixed;
  top: calc(var(--safe-t) + 14px);
  right: 14px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 15px;
  backdrop-filter: blur(8px);
}
.admin-badge {
  position: fixed;
  top: calc(var(--safe-t) + 66px);
  right: 14px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: #7a1f2b;
  font-size: 14px;
}
.admin-badge button { margin-left: 6px; border: 0; border-radius: 999px; padding: 4px 12px; background: rgba(255,255,255,.16); }

/* ---------- dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 14px);
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(2, 6, 20, .45);
}
.dock button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.dock svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.dock .primary { padding: 0 22px; background: var(--flame); color: var(--flame-ink); }
.dot { position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--lotus); }

.primary {
  border: 0;
  border-radius: 999px;
  background: var(--flame);
  color: var(--flame-ink);
  font-weight: 600;
}
.primary:disabled { opacity: .6; cursor: wait; }

/* ---------- sheets ---------- */
.sheet {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
  max-height: min(92dvh, 920px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--sheet);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.sheet::backdrop { background: rgba(4, 9, 26, .62); }
.sheet { overscroll-behavior: contain; } /* no pull-to-refresh that would wipe a drawing */
.sheet-inner { padding: 0 clamp(16px, 3vw, 28px) calc(var(--safe-b) + 24px); }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 calc(-1 * clamp(16px, 3vw, 28px)) 8px;
  padding: calc(var(--safe-t) + 14px) clamp(16px, 3vw, 28px) 12px;
  background: var(--sheet);
  border-bottom: 1px solid var(--line);
}
.sheet h2 { margin: 0; font: 700 clamp(28px, 4vw, 36px)/1.1 "Charm", serif; color: var(--moon); }
.close { width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 18px; }

@media (max-width: 640px) {
  .sheet { width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; }
}

/* ---------- draw ---------- */
.draw-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); align-items: start; padding-top: 8px; }
/* wide screens: tools on the left, the drawing pad on the right (owner, 24 Nov); phones keep the pad on top */
.draw-grid .pad-col { order: 2; }
.draw-grid .tools-col { order: 1; }
@media (max-width: 760px) { .draw-grid { grid-template-columns: 1fr; } .draw-grid .pad-col, .draw-grid .tools-col { order: 0; } }
/* a long press or a stroke that wanders off the pad must draw, not select the sheet's text */
#drawSheet { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#drawSheet input, #drawSheet textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

.pad-col { min-width: 0; }
@media (max-width: 760px) { .pad-col { position: static; } }
.pad-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 22% at 50% 80%, rgba(244, 165, 59, .2), transparent 70%),
    linear-gradient(#1c3a68 0%, #12305a 70%, #0b2546 100%);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pad-wrap::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 78%;
  border-top: 2px dashed rgba(243, 236, 218, .28);
  pointer-events: none;
}
.pad-wrap::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 78%; bottom: 0;
  background: rgba(8, 30, 58, .45);
  pointer-events: none;
}
#padBase, #pad, #padSign { position: absolute; inset: 0; width: 100%; height: 100%; }
#padSign { z-index: 2; pointer-events: none; }
#pad { touch-action: none; cursor: crosshair; z-index: 1; }
.waterline { position: absolute; right: 10px; top: calc(78% + 4px); font-size: 12px; color: var(--muted); pointer-events: none; z-index: 2; }
.hint { margin: 8px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

.tools { margin: 0 0 14px; padding: 0; border: 0; }
.tools legend { padding: 0; margin-bottom: 6px; font-size: 14px; color: var(--muted); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.seg input:checked + span { background: var(--moon); color: var(--ink); border-color: var(--moon); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--flame); outline-offset: 2px; }
.sz { display: inline-block; border-radius: 50%; background: currentColor; }
.sz.s { width: 6px; height: 6px; }
.sz.m { width: 11px; height: 11px; }
.sz.l { width: 18px; height: 18px; }

.swatches { display: grid; grid-template-columns: repeat(6, 44px); gap: 8px; }
.swatches label { position: relative; width: 44px; height: 44px; }
.swatches input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.swatches span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); cursor: pointer; }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--moon); }
.swatches input:focus-visible + span { outline: 3px solid var(--flame); outline-offset: 4px; }

.pad-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.pad-actions button, .row > button:not(.primary), .more, #codeForm button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
}
.pad-actions button:disabled { opacity: .45; cursor: default; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin-bottom: 4px; font-size: 15px; }
.field em { font-style: normal; color: var(--muted); font-size: 14px; }
.field input, .field textarea, #codeInput, .link-box {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  font-size: 16px; /* 16px stops iOS from zooming in */
  resize: vertical;
}
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font-size: 15px; color: var(--muted); }
.check b { color: var(--text); }
.check input { width: 22px; height: 22px; margin: 3px 0 0; accent-color: var(--flame); flex: none; }
.form-msg { min-height: 1.6em; margin: 10px 0; color: #ffb4a8; font-size: 15px; }
.big { width: 100%; min-height: 56px; font-size: 18px; }

/* ---------- contest + mine grids ---------- */
.rules { margin: 4px 0 12px; color: var(--muted); max-width: 46em; }
.sort { margin-bottom: 16px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.entry { position: relative; display: flex; flex-direction: column; gap: 6px; }
.entry img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 14px;
  background: linear-gradient(#1c3a68, #0b2546);
  display: block;
}
.entry-name { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-wish {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* short in the grid; "อ่านต่อ" opens it */
  overflow: hidden;
  margin: -4px 0 0;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.entry-wish.long { cursor: pointer; }
.entry-wish.open { display: block; -webkit-line-clamp: unset; }
.wish-more { align-self: flex-start; margin: -4px 0 2px; padding: 2px 0; border: 0; background: none; color: var(--flame); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.entry-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rank {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--moon);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.rank.r2 { background: #d9dde8; }
.rank.r3 { background: #e3b48a; }
.votes { display: flex; flex-wrap: wrap; gap: 6px; }
.vote {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.vote svg { width: 18px; height: 18px; flex: none; fill: none; stroke-width: 2; stroke-linecap: round; }
.vote .n:empty { display: none; }
.vote.beauty svg { stroke: var(--lotus); }
.vote.beauty[aria-pressed="true"] { background: rgba(236, 143, 177, .18); border-color: var(--lotus); }
.vote.beauty[aria-pressed="true"] svg { fill: var(--lotus); }
.vote.fun svg { stroke: #f2c230; }
.vote.fun[aria-pressed="true"] { background: rgba(242, 194, 48, .16); border-color: #f2c230; }
.vote.fun[aria-pressed="true"] svg { fill: rgba(242, 194, 48, .35); }
.vote:disabled { cursor: default; opacity: .75; }
.rank.rn { background: rgba(10, 19, 48, .82); color: var(--text); }

/* leaderboard podium: 1st in the middle and taller, 2nd left, 3rd right */
/* tops aligned and stepped by rank, so a long name or wish under 2nd place can never lift it above 1st */
.podium { display: flex; justify-content: center; align-items: flex-start; gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; }
.podium .entry[data-rank="2"] { margin-top: 28px; }
.podium .entry[data-rank="3"] { margin-top: 48px; }
.podium .entry { flex: 1 1 0; min-width: 0; max-width: 210px; }
.podium .entry:nth-child(1) { order: 2; max-width: 250px; }
.podium .entry:nth-child(1) img { box-shadow: 0 0 0 3px var(--moon); }
.podium .entry:nth-child(2) { order: 1; }
.podium .entry:nth-child(3) { order: 3; }
@media (max-width: 520px) { .podium { gap: 8px; } .podium .vote { padding: 0 8px; font-size: 13px; } }
.tag { font-size: 13px; color: var(--muted); }
.hide-btn { min-height: 40px; padding: 0 12px; border: 1px solid #b0475a; border-radius: 999px; background: transparent; color: #ffb4c0; }
.empty { color: var(--muted); }
.more { display: block; margin: 18px auto 0; }

/* ---------- mine ---------- */
.code-label { margin: 8px 0 0; color: var(--muted); }
.code { margin: 2px 0 6px; font-size: clamp(28px, 7vw, 40px); font-weight: 600; letter-spacing: .06em; color: var(--moon); font-variant-numeric: tabular-nums; }
.note { margin: 0 0 12px; color: var(--muted); max-width: 40em; font-size: 15px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row .primary { min-height: 48px; padding: 0 20px; }
.link-box { margin: 12px 0 20px; font-size: 14px; color: var(--muted); }
.other-code { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.other-code summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
#codeForm { margin-top: 8px; flex-wrap: nowrap; }
#codeInput { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- popover + toast ---------- */
.popover {
  position: fixed;
  z-index: 5;
  width: min(280px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--sheet);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.pop-name { margin: 0; font-weight: 600; color: var(--moon); }
.pop-wish { margin: 4px 0 0; overflow-wrap: anywhere; }
.pop-wish:empty { display: none; }
#popActions:not(:empty) { margin-top: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 92px);
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--moon);
  color: #1c1405;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  width: max-content; /* left:50% would otherwise cap it at half the screen */
  opacity: 0;
  visibility: hidden; /* keeps a hidden action button out of the Tab order */
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s, visibility .25s;
}
.toast.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.toast button { flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--ink); color: var(--moon); font-weight: 600; }

/* share-image mode: just the scene and the title */
.og .dock, .og .invite, .og .toast, .og .admin-badge, .og .count, .og .about { display: none !important; }

@media (max-width: 640px) {
  .sky { top: calc(var(--safe-t) + 64px); } /* clear the invite button */
  .about[open] { max-height: calc(100dvh - var(--safe-b) - 380px); } /* stop above the dock; old browsers keep 50vh */
}
@media (max-width: 420px) {
  .dock button { padding: 0 12px; font-size: 15px; }
  .dock .primary { padding: 0 16px; }
  .invite { padding: 0 12px; font-size: 14px; }
  .sky { max-width: 70vw; }
}
@media (max-width: 380px) {
  .dock svg { display: none; } /* 360 px Android: the labels alone fit */
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* Shown only if app.js never ran (parse error on an old WebView): it appears after 3 s unless the script removed it. */
.old-browser {
  position: fixed;
  left: 16px; right: 16px; top: 40%;
  z-index: 20;
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--moon);
  color: #1c1405;
  text-align: center;
  opacity: 0;
  animation: old-browser-in 0s 3s forwards;
}
@keyframes old-browser-in { to { opacity: 1; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* colour picker: the rainbow ring opens the device colour wheel */
.swatches .custom-color { padding: 5px; border-radius: 50%; background: conic-gradient(#e53935, #fdd835, #43a047, #00acc1, #3949ab, #8e24aa, #e53935); cursor: pointer; }
.swatches .custom-color input { position: static; opacity: 1; display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
.custom-color input::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.custom-color input::-moz-color-swatch { border: 0; border-radius: 50%; }
.swatches .custom-color.on { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--moon); }

/* flower kinds and ready-made bases */
.tools legend em { font-style: normal; font-size: 13px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.pick { position: relative; }
.pick input { position: absolute; inset: 0; margin: 0; opacity: 0; }
.pick span { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; padding: 6px 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .04); cursor: pointer; text-align: center; }
.pick b { font-weight: 400; font-size: 13px; line-height: 1.3; }
.pick canvas { width: 40px; height: 40px; }
#baseTypes .pick canvas { width: 52px; height: 52px; border-radius: 10px; background: linear-gradient(#1c3a68, #0b2546); }
.pick input:checked + span { border-color: var(--moon); background: rgba(247, 233, 191, .14); box-shadow: inset 0 0 0 1px var(--moon); }
.pick input:focus-visible + span { outline: 3px solid var(--flame); outline-offset: 2px; }
.base-set { margin-top: 14px; }
/* sign on the krathong */
.sign-colors { margin-top: 10px; grid-template-columns: repeat(6, 36px); }
.sign-colors label { width: 36px; height: 36px; }
.brand span { white-space: nowrap; }
@media (max-width: 420px) { .brand { font-size: 13px; gap: 8px; } .brand img { width: 96px; } }
.size-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.size-row > span { min-width: 96px; font-size: 14px; color: var(--muted); }
.seg-sm span { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* vote press effect: the button gives under the finger, the icon pops, hearts / laughing faces fly out */
.vote { transition: transform .12s ease-out, background-color .2s, border-color .2s; -webkit-user-select: none; user-select: none; }
.vote:active:not(:disabled) { transform: scale(.92); }
.vote.pop svg { animation: vote-pop .55s cubic-bezier(.2, 1.6, .4, 1); }
.vote.pop .n { animation: vote-count .45s ease-out; }
.vote.unpop svg { animation: vote-unpop .3s ease-out; }
@keyframes vote-pop { 0% { transform: scale(1); } 35% { transform: scale(1.6) rotate(-10deg); } 100% { transform: scale(1); } }
@keyframes vote-count { 0% { transform: translateY(0); } 40% { transform: translateY(-5px); } 100% { transform: translateY(0); } }
@keyframes vote-unpop { 0% { transform: scale(1); } 50% { transform: scale(.7); } 100% { transform: scale(1); } }
.vote .n { display: inline-block; }
.burst {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: vote-burst .85s ease-out forwards;
}
.burst.beauty { color: var(--lotus); text-shadow: 0 0 6px rgba(236, 143, 177, .6); }
@keyframes vote-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) {
  .vote, .vote.pop svg, .vote.pop .n, .vote.unpop svg { transition: none; animation: none; }
}
@media (max-width: 400px) { .podium .vote .lbl { display: none; } } /* icon + number fit the narrow podium columns */

/* themed confirm box (ask) */
.ask {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--sheet);
  color: var(--text);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.ask::backdrop { background: rgba(4, 9, 26, .72); }
.ask[open] { animation: ask-in .22s ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.ask-inner { padding: 24px 22px 20px; }
.ask-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 8px; border-radius: 50%; background: radial-gradient(circle, rgba(244, 165, 59, .35), rgba(244, 165, 59, 0) 70%); }
.ask-icon svg { width: 36px; height: 36px; }
.ask h2 { margin: 0 0 8px; font: 700 26px/1.25 "Charm", serif; color: var(--moon); }
.ask p { margin: 0 0 22px; color: var(--muted); white-space: pre-line; }
.ask-actions { display: flex; flex-wrap: wrap-reverse; gap: 10px; }
.ask-actions button { flex: 1 1 140px; min-height: 48px; border-radius: 999px; font-size: 16px; font-weight: 600; }
.ask-cancel { border: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.ask.danger .ask-icon { background: radial-gradient(circle, rgba(217, 68, 59, .4), rgba(217, 68, 59, 0) 70%); }
.ask.danger #askOk { background: #d9443b; color: #fff; }
.ask-input { display: block; width: 100%; min-height: 48px; margin: -8px 0 20px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 16px; text-align: center; }
.ask-input[hidden] { display: none; }
.share-img { display: block; width: 100%; height: auto; max-height: 52vh; object-fit: contain; margin: 4px 0 14px; border-radius: 14px; }
.share .ask-actions { flex-wrap: wrap; } /* main action first, Close last */
.share .ask-actions > * { flex: 1 1 140px; min-height: 48px; border-radius: 999px; font-size: 16px; font-weight: 600; }
.share-save { display: inline-flex; align-items: center; justify-content: center; background: var(--moon); color: #1c1405; text-decoration: none; }
.share .ask-actions > [hidden] { display: none; }
.share-btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: 14px; font-weight: 600; }
.enter-btn { border-color: transparent; background: var(--flame); color: var(--flame-ink); } /* the main action on a floated-only krathong */
.del-btn { min-height: 36px; padding: 0 12px; border: 1px solid rgba(217, 68, 59, .5); border-radius: 999px; background: none; color: #ff9b93; font-size: 14px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .ask[open] { animation: none; } }
