/* ==========================================================================
   VotingSite · player-decided attributes.
   The post-vote micro survey, the "what players say" panel, the owner-vs-
   players callout and the compact chips.

   Loaded after style.css and reusing its tokens (--bg, --bg-elev, --panel,
   --panel-2, --border, --text, --muted, --accent, --gold, --danger, --r).
   Mobile-first; every option is a full-size tap target before it is anything
   else, because this card is answered on a phone straight after voting.
   ========================================================================== */

/* --------------------------------------------------------------- survey -- */
.attr-survey { margin: 0 0 var(--gap); }

.attr-survey-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 6px;
}

.attr-survey-note {
  margin: 0 0 var(--gap);
  font-size: .82rem;
  color: var(--muted);
  max-width: 60ch;
}

.attr-q {
  border: 0;
  padding: 0;
  margin: 0 0 var(--gap);
}
.attr-q-title {
  padding: 0;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.attr-q-hint {
  margin: 4px 0 0;
  font-size: .76rem;
  color: var(--muted);
}

/* Radio cards. The native control stays in the DOM (keyboard, no-JS, form
   validation) but is visually replaced by the whole card. */
.attr-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.attr-opt { position: relative; display: block; cursor: pointer; }
.attr-opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.attr-opt-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 12px 10px;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.attr-opt-icon { font-size: 1.4rem; line-height: 1; }
.attr-opt-label { font-size: .84rem; font-weight: 600; line-height: 1.25; }

.attr-opt:hover .attr-opt-body { border-color: var(--muted); }
.attr-opt input:focus-visible + .attr-opt-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.attr-opt input:checked + .attr-opt-body {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .attr-opt input:active + .attr-opt-body { transform: scale(.98); }
}

.attr-survey-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.attr-skip {
  font-size: .82rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attr-skip:hover { color: var(--text); }

/* ---------------------------------------------------------------- panel -- */
.attr-panel { margin: 0 0 var(--gap); }

.attr-panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.attr-panel-head .card-title { flex: 1 1 auto; }
.attr-panel-count {
  font-size: .76rem;
  color: var(--muted);
  white-space: nowrap;
}
.attr-panel-sub {
  margin: 0 0 var(--gap);
  font-size: .8rem;
  color: var(--muted);
  max-width: 62ch;
}

.attr-empty {
  margin: 0;
  padding: 14px;
  font-size: .84rem;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: var(--r);
}

.attr-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.attr-group {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft, var(--border));
  border-radius: var(--r);
}
.attr-group.is-thin { opacity: .72; }

.attr-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.attr-group-title {
  margin: 0;
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: .9rem;
  letter-spacing: .2px;
}
.attr-group-count,
.attr-group-foot { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.attr-group-foot { margin: 8px 0 0; white-space: normal; }

.attr-thin { margin: 0; font-size: .8rem; color: var(--muted); }

/* ----------------------------------------------------------------- bars -- */
.attr-bars { display: grid; gap: 6px; }

.attr-row {
  display: grid;
  grid-template-columns: minmax(96px, 9rem) 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}
.attr-row-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attr-row-icon { font-size: .95rem; line-height: 1; flex: 0 0 auto; }

.attr-bar {
  display: block;
  height: 10px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  overflow: hidden;
}
.attr-bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 99px;
  background: var(--muted);
}

.attr-row-pct {
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  color: var(--muted);
  min-width: 3ch;
  text-align: right;
}

/* The winning answer is the one the filters use · give it the weight. */
.attr-row.is-top .attr-row-label,
.attr-row.is-top .attr-row-pct { color: var(--text); font-weight: 700; }
.attr-row.is-top .attr-bar-fill { background: var(--accent); }
.attr-row.is-top[data-tone="warn"] .attr-bar-fill { background: var(--danger); }
.attr-row.is-top[data-tone="warn"] .attr-row-pct { color: var(--danger); }
.attr-row.is-top[data-tone="neutral"] .attr-bar-fill { background: var(--cyan, var(--accent)); }

/* ------------------------------------------------------------- mismatch -- */
/* Warning tone, not an accusation: amber by default, red only when the gap is
   wide. The owner reads this card too. */
.attr-mismatch {
  display: flex;
  gap: 10px;
  padding: 12px;
  margin: 0 0 var(--gap);
  border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--border));
  border-left-width: 3px;
  border-radius: var(--r);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.attr-mismatch[data-severity="high"] {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.attr-mismatch-icon { font-size: 1rem; line-height: 1.4; color: var(--gold); flex: 0 0 auto; }
.attr-mismatch[data-severity="high"] .attr-mismatch-icon { color: var(--danger); }

.attr-mismatch-body { min-width: 0; }
.attr-mismatch-title {
  display: block;
  font-family: var(--font-display);
  font-size: .88rem;
  margin-bottom: 3px;
}
.attr-mismatch-text { margin: 0; font-size: .82rem; overflow-wrap: anywhere; }
.attr-mismatch-foot { margin: 6px 0 0; font-size: .74rem; color: var(--muted); }

.attr-claim,
.attr-community {
  display: inline-block;
  padding: 0 5px;
  border-radius: var(--r-sm, 5px);
  font-weight: 700;
  white-space: nowrap;
}
.attr-claim { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.attr-community { background: color-mix(in srgb, var(--gold) 26%, transparent); }
.attr-mismatch[data-severity="high"] .attr-community { background: color-mix(in srgb, var(--danger) 24%, transparent); }

/* ---------------------------------------------------------------- chips -- */
.attr-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.attr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 7px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attr-chip-icon { font-size: .8rem; line-height: 1; }
.attr-chip[data-tone="good"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.attr-chip[data-tone="warn"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* ----------------------------------------------------------- light theme -- */
html[data-theme="light"] .attr-opt-body,
html[data-theme="light"] .attr-group,
html[data-theme="light"] .attr-chip,
html[data-theme="light"] .attr-empty { background: var(--bg-elev); }
html[data-theme="light"] .attr-opt input:checked + .attr-opt-body {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elev));
}
html[data-theme="light"] .attr-bar { background: color-mix(in srgb, var(--border) 90%, transparent); }
html[data-theme="light"] .attr-mismatch { background: color-mix(in srgb, var(--gold) 12%, var(--bg-elev)); }
html[data-theme="light"] .attr-mismatch[data-severity="high"] { background: color-mix(in srgb, var(--danger) 8%, var(--bg-elev)); }
html[data-theme="light"] .attr-claim { background: color-mix(in srgb, var(--muted) 18%, transparent); }

/* -------------------------------------------------------------- desktop -- */
@media (min-width: 720px) {
  .attr-groups { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .attr-opts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* A phone gets one column of wide, obvious targets rather than a cramped grid. */
@media (max-width: 420px) {
  .attr-opts { grid-template-columns: 1fr 1fr; }
  .attr-opts[data-count="3"] { grid-template-columns: 1fr; }
  .attr-opt-body { min-height: 72px; }
  .attr-row { grid-template-columns: minmax(80px, 7rem) 1fr auto; font-size: .78rem; }
}
