:root {
  --bg: #faf9f5;
  --card: #ffffff;
  --fg: #24242c;
  --muted: #6f6f80;
  --border: #d9d8e4;
  --accent: #5b5bd6;
  --accent-soft: #ececfa;
  --ok-fg: #1d6b43;
  --ok-bg: #e6f4ec;
  --err-fg: #a4271f;
  --err-bg: #fbe9e7;
  --glow: rgba(29, 107, 67, 0.28);
  --shimmer: rgba(29, 107, 67, 0.22);
  --grid: rgba(36, 36, 44, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131a;
    --card: #181c26;
    --fg: #e6e8f0;
    --muted: #969cb2;
    --border: #2c3140;
    --accent: #9d9df2;
    --accent-soft: #272b40;
    --ok-fg: #7fd6a4;
    --ok-bg: #17301f;
    --err-fg: #f2a29b;
    --err-bg: #3a211f;
    --glow: rgba(127, 214, 164, 0.28);
    --shimmer: rgba(127, 214, 164, 0.25);
    --grid: rgba(230, 232, 240, 0.05);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  /* graph-paper dot grid */
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--fg);
  font: 16px/1.5 ui-monospace, "SF Mono", Menlo, "Cascadia Code", Consolas,
        monospace;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

main {
  width: 100%;
  max-width: 27rem;
  padding: 1.25rem 0.9rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  margin-bottom: 0.9rem;
}

.card-title { margin: 0 0 0.6rem; font-weight: 700; }

.field { margin-bottom: 0.9rem; }

.field label, .label-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.label-row label { margin-bottom: 0; }

input[type="text"], input:not([type]), input[type="number"] {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
  width: 100%;
}

input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

input::placeholder { color: var(--muted); opacity: 0.8; }

.at-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding-left: 0.6rem;
}

.at-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }

.at-wrap .at { color: var(--muted); font-weight: 700; user-select: none; }

.at-wrap input {
  border: none;
  padding-left: 0.1rem;
  flex: 1;
  min-width: 0;
}

.at-wrap input:focus { outline: none; }

button { font: inherit; cursor: pointer; }

#place {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#place:hover:not(:disabled) { filter: brightness(1.08); }
#place:disabled { opacity: 0.5; cursor: default; }

/* ------------------------------ tooltips ------------------------------ */
/* tabindex on .tip makes tap-to-focus show these on touchscreens */

.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.7rem;
  cursor: help;
  position: relative;
  user-select: none;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.45rem);  /* below the tip: the top of the page can't clip it */
  left: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.4;
  width: max-content;
  max-width: min(15rem, 80vw);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 2;
  text-transform: none;
  letter-spacing: normal;
}

.tip:hover::after, .tip:focus::after { opacity: 1; visibility: visible; }

.tip:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --------------------------- reveal settings --------------------------- */

.radio-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.radio-row input[type="radio"] { accent-color: var(--accent); }

.radio-label { display: inline; }

#n {
  width: 3.6em;
  padding: 0.2rem 0.35rem;
  text-align: center;
  font-size: 16px; /* <16px makes iOS zoom on focus */
}

.roster-box { margin-left: 1.6rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.chip .x {
  border: none;
  background: none;
  color: inherit;
  padding: 0 0 0 0.1rem;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
}

.chip .x:hover { opacity: 1; }

/* ------------------------------- status -------------------------------- */

#banner {
  border-radius: 3px;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

#banner.err { background: var(--err-bg); color: var(--err-fg); }
#banner.ok { background: var(--ok-bg); color: var(--ok-fg); }

.msg { margin: 0 0 0.2rem; }

/* One tile per expected bidder: gray until they bid, green once they have,
   a one-shot shimmer sweep when their bid changes */

.tiles { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }

.tile {
  flex: 1 1 8.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.45rem 0.65rem;
  background-color: var(--bg);
  background-repeat: no-repeat;
  transition: border-color 0.5s, box-shadow 0.5s, background-color 0.5s;
}

.tile-name { font-weight: 700; font-size: 0.85rem; color: var(--muted); }

.tile-bid {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  word-break: break-word;
}

.tile.has-bid {
  border-color: var(--ok-fg);
  background-color: var(--ok-bg);
  box-shadow: 0 0 10px var(--glow);
}

.tile.has-bid .tile-name { color: var(--ok-fg); }

.tile.has-bid .tile-bid { color: inherit; font-style: normal; }

.tile.updated {
  background-image: linear-gradient(105deg,
    transparent 40%, var(--shimmer) 50%, transparent 60%);
  background-size: 250% 100%;
  animation: shimmer 1.1s ease-out;
}

@keyframes shimmer {
  from { background-position: 130% 0; }
  to   { background-position: -130% 0; }
}

footer { text-align: center; margin-top: 1.4rem; font-size: 0.8rem; }

footer a { color: var(--muted); }
