/* Shared tokens and base styles. Owner: ui-dev. admin.html may link it. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #5c5c66;
  --border: #c9c7c0;
  --accent: #2f5d8a;
  --danger: #a33030;
  --radius: 8px;
  --gap: 12px;
  --ok: #2d7a46;
  --warn: #8a5a00;
  --surface-2: #eceae4;
  --tag-foil-sheen: linear-gradient(135deg, rgb(255 255 255 / 0%) 18%, rgb(255 255 255 / 85%) 34%, rgb(205 225 255 / 55%) 46%, rgb(255 240 200 / 70%) 58%, rgb(255 255 255 / 0%) 74%);
  --tag-foil-base: #eef3fb;
  --tag-foil-badge: #5b6f9a;
  --tag-nature-tint: #e3f3dc;
  --tag-nature-badge: #3f7d3a;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--accent);
}
.badge--sandbox { border-color: var(--warn); color: var(--warn); background: #fff6e0; }
.badge--warn { border-color: var(--warn); color: var(--warn); }

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn small { font-size: 0.7rem; color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary small { color: #dfe8f1; }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--quiet { border-color: transparent; background: transparent; }
.btn--icon { min-width: 36px; padding: 6px 10px; font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; font-size: 0.9rem; }
.form input, .form select, .manual__input {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.form button[type="submit"], .form .btn { align-self: flex-start; margin-top: 6px; }
.form-error { margin: 0; color: var(--danger); font-weight: 600; }

dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
dialog::backdrop { background: rgb(0 0 0 / 40%); }

.rules-modal {
  width: min(720px, 92vw);
  max-height: 85vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}
.rules-modal::backdrop { background: rgb(0 0 0 / 40%); }
.rules-modal__head {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: var(--gap) 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.rules-modal__head h2 { margin: 0; font-size: 1.2rem; }
.rules-modal__close { margin-left: auto; }
.rules-modal__body { padding: 0 16px 16px; line-height: 1.5; }
.rules-modal__body table { border-collapse: collapse; }
.rules-modal__body th, .rules-modal__body td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }

.controls-modal { width: min(780px, 94vw); }
.controls-tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--border); }
.controls-tab { padding: 6px 14px; border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); color: var(--text); cursor: pointer; }
.controls-tab[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.controls-tab[hidden] { display: none; }
.controls-modal__body { max-height: 65vh; overflow-y: auto; }
.controls-modal__body code { font-size: 0.85em; }
.app-header .controls-button { margin-right: 8px; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 340px; }
.toast { padding: 10px 14px; border-radius: var(--radius); background: var(--text); color: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 25%); }
.toast--error { background: var(--danger); }

/* Tags (RULES 2.3). Shared with the admin page. Tints stay light so dark text and suit colors read. */
.card.card--foil { background: var(--tag-foil-sheen), var(--tag-foil-base); }
.card.card--nature { background: var(--tag-nature-tint); }
.card.card--foil.card--nature { background: var(--tag-foil-sheen), var(--tag-nature-tint); }
.card.card--foil { box-shadow: inset 0 0 0 1px rgb(120 150 210 / 55%); }
.card.card--nature { box-shadow: inset 0 0 0 1px rgb(80 150 70 / 45%); }
.card.card--foil.card--nature { box-shadow: inset 0 0 0 1px rgb(120 150 210 / 55%), inset 0 0 0 2px rgb(80 150 70 / 40%); }
.card__tags { position: absolute; top: 2px; right: 3px; display: flex; gap: 2px; }
.card__tagbadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  font-size: 11px; font-weight: 800; line-height: 1; text-transform: lowercase;
  color: #fff; border: 1px solid rgb(0 0 0 / 30%);
}
.card__tagbadge--foil { background: var(--tag-foil-badge); }
.card__tagbadge--nature { background: var(--tag-nature-badge); }
.card--mini .card__tags { display: flex; top: 1px; right: 1px; }
.card--mini .card__tagbadge { width: 11px; height: 11px; font-size: 9px; }
.card--big .card__tagbadge { width: 18px; height: 18px; font-size: 13px; }
