/*
 * PHASE 8N -- THE WEEKDAY GAME ROTATION
 *
 * Phone first. Every colour here is a token defined in app.css (--bg-elev,
 * --bg-elev-2, --line, --text, --text-dim, --text-faint, --accent,
 * --accent-dim, --warn, --danger) -- 8B shipped four that did not exist, and
 * a test now pins this sheet to the defined set. No state is carried by
 * colour alone: a choice says SELECTED, your own entry says YOURS, a winner
 * says WINNER with a star, a Risk It verdict says CORRECT or NOT THIS TIME.
 *
 * Every tap target is at least --tap (48px) tall. Inputs are 16px+ so iOS
 * does not zoom the page on focus, and nothing is fixed-position, so the
 * on-screen keyboard cannot cover a field or break the layout.
 */

/* ==========================================================================
   THE CARD -- Home and Games
   ========================================================================== */

.wdcard {
  display: grid;
  gap: 0.35rem;
}

.wdcard--prominent {
  border: 2px solid var(--accent);
  background: var(--bg-elev-2);
}

.wdcard__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.wdcard__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.wdcard__headline {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.wdcard--scheduled .wdcard__headline,
.wdcard--results .wdcard__headline {
  color: var(--text);
}

.wdcard__note {
  margin: 0;
  color: var(--text-dim);
}

.wdcard__go {
  min-height: var(--tap);
  justify-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   THE SCREEN
   ========================================================================== */

.wd__head {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.wd__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.wd__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
}

.wd__status {
  margin: 0;
  color: var(--text-dim);
}

.wd__prompt {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.wd__note {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

.wd-game {
  display: grid;
  gap: 0.75rem;
}

/* ---- the caption picture: its box is reserved before the bytes arrive ---- */

.wd-picture {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.wd-picture__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- writing ------------------------------------------------------------- */

.wd-form {
  display: grid;
  gap: 0.5rem;
}

.wd-form__input,
.wd-form input.field__input {
  min-height: var(--tap);
  font-size: 1.1rem;
}

.wd-form__input {
  min-height: calc(var(--tap) * 1.6);
  resize: vertical;
}

.wd-form__counter {
  margin: 0;
  justify-self: end;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.wd-form__error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

.wd-form__saved {
  margin: 0;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

.wd-form .btn,
.wd-ballot .btn,
.wd-game > .btn,
.wd-question .btn,
.wd-past__open {
  min-height: var(--tap);
  width: 100%;
}

/* ---- ballots, predictions, Risk It answers -------------------------------- */

.wd-ballot {
  display: grid;
  gap: 0.75rem;
}

.wd-ballot__instruction {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.wd-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.wd-option {
  width: 100%;
  min-height: calc(var(--tap) + 8px);
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  text-align: left;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.wd-option__text {
  font-size: 1.1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.wd-option__tag {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.wd-option:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wd-option.is-selected {
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

.wd-option.is-selected .wd-option__tag {
  color: var(--accent);
}

.wd-option[disabled] {
  cursor: default;
}

.wd-option.is-mine {
  border-style: dashed;
  opacity: 0.75;
}

.wd-option.is-right {
  border-color: var(--accent);
}

.wd-option.is-wrong {
  border-color: var(--danger);
}

/* ---- Risk It -------------------------------------------------------------- */

.wd-risk__safe,
.wd-risk__risk {
  min-height: calc(var(--tap) + 12px);
  width: 100%;
  font-size: 1.05rem;
  font-weight: 800;
}

.wd-risk__confirm {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--warn);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 700;
}

.wd-question {
  display: grid;
  gap: 0.75rem;
}

.wd-verdict {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.wd-verdict.is-right {
  border: 2px solid var(--accent);
  color: var(--accent);
}

.wd-verdict.is-wrong {
  border: 2px solid var(--danger);
  color: var(--danger);
}

/* ---- Emoji Decoder --------------------------------------------------------- */

.wd-emoji {
  margin: 0;
  padding: 1rem;
  text-align: center;
  font-size: clamp(2.25rem, 11vw, 3.5rem);
  line-height: 1.25;
  letter-spacing: 0.1em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow-wrap: anywhere;
}

.wd-emoji__answer {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
}

/* ---- results ---------------------------------------------------------------- */

.wd-results {
  display: grid;
  gap: 0.6rem;
}

.wd-results__title {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.wd-ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.wd-ranking__item {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.wd-ranking__item.is-winner {
  border: 2px solid var(--accent);
  background: var(--bg-elev-2);
}

.wd-ranking__badge {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.wd-ranking__text {
  margin: 0.2rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.wd-ranking__author {
  margin: 0;
  color: var(--text-dim);
}

.wd-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.wd-bars__item {
  display: grid;
  gap: 0.25rem;
}

.wd-bars__label {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.wd-bars__item.is-majority .wd-bars__label {
  color: var(--accent);
  font-weight: 800;
}

.wd-bars__bar {
  display: block;
  height: 10px;
  min-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
}

.wd-bars__item.is-majority .wd-bars__bar {
  background: var(--accent);
}

.wd-you {
  display: grid;
  gap: 0.25rem;
}

.wd-you__reward {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

/* ---- past results ------------------------------------------------------------ */

.wd__past,
.wd-past__body {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.wd-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.wd-history__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.wd-history__day {
  margin: 0;
  color: var(--text-dim);
}

/* ---- admin -------------------------------------------------------------------- */

.wd-admin__subtitle {
  margin: 1rem 0 0.25rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.wd-admin__secret {
  border-left: 3px solid var(--warn);
  padding-left: 0.5rem;
}

.wd-admin__warn {
  color: var(--warn);
  font-weight: 700;
}

.wd-admin__thumb {
  display: block;
  max-width: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.wd-admin__items .is-retired {
  opacity: 0.6;
}
