/* Molduras, controles e seus estados */
.bevel-frame {
  --bevel-cut: 9px;
  --bevel-stroke: 2px;
  --bevel-edge: var(--bevel-edge-default);
  --bevel-fill: var(--bevel-fill-default);
  position: relative;
  isolation: isolate;
  background: var(--bevel-edge);
  clip-path: polygon(
    var(--bevel-cut) 0, calc(100% - var(--bevel-cut)) 0, 100% var(--bevel-cut),
    100% calc(100% - var(--bevel-cut)), calc(100% - var(--bevel-cut)) 100%,
    var(--bevel-cut) 100%, 0 calc(100% - var(--bevel-cut)), 0 var(--bevel-cut)
  );
}

.bevel-frame::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: var(--bevel-stroke);
  clip-path: inherit;
  background: var(--bevel-fill);
  pointer-events: none;
}

button:where(.accent-on-focus, .bevel-action, .cta-btn, .accent-chip) {
  border: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/*
  Contrato de accent (obrigatório):
  - Repouso = cinza neutro (bevel padrão).
  - Laranja em :hover / :focus-visible / seleção explícita (aria-pressed|selected|:checked).
  - `.accent-nav` (grades WASD): sem laranja no hover — só foco/seleção (evita 2 cards “ativos”).
  - Nunca pintar laranja em repouso: parece foco/seleção falsa.
  `.bevel-action` é alias legado de `.accent-on-focus` — mesmo contrato.
*/
.accent-on-focus:is(:hover, :focus-visible, :has(:focus-visible)):where(:not(:disabled, [aria-disabled="true"], :has(input:disabled), .accent-nav)),
.bevel-action:is(:hover, :focus-visible):enabled,
.accent-on-focus.accent-nav:is(:focus, :focus-visible, :has(:focus-visible)):where(:not(:disabled, [aria-disabled="true"])) {
  --bevel-stroke: 3px;
  --bevel-edge: var(--accent-edge);
  --bevel-fill: var(--accent-fill);
  color: var(--accent-ink);
  text-shadow: 0 2px 1px var(--accent-ink-shadow);
  box-shadow: var(--control-focus-shadow, none);
  outline: none;
}

.accent-on-focus:is([aria-pressed="true"], [aria-selected="true"], :has(:checked)),
.bevel-action:is([aria-pressed="true"], [aria-selected="true"]) {
  --bevel-stroke: 3px;
  --bevel-edge: var(--accent-edge-picked);
  --bevel-fill: var(--control-picked-fill, var(--accent-fill-picked));
  color: var(--accent-ink-picked);
}

.accent-on-focus:is([aria-pressed="true"], [aria-selected="true"]):focus-visible,
.bevel-action:is([aria-pressed="true"], [aria-selected="true"]):focus-visible {
  outline: 1px solid var(--accent-highlight);
  outline-offset: -4px;
}

.accent-focus-within:has(:focus-visible) {
  --bevel-stroke: 3px;
  --bevel-edge: var(--accent-edge);
  box-shadow: var(--accent-focus-glow);
}

.accent-chip[aria-pressed="true"] {
  border-color: var(--chip-picked-border, var(--accent-chip-picked-border));
  background: var(--chip-picked-fill, var(--accent-chip-picked-fill));
  color: var(--accent-ink-picked);
}

.accent-chip:hover:enabled,
.accent-chip:focus-visible:enabled:not([aria-pressed="true"]) {
  border-color: var(--accent-border);
  background: var(--accent-chip-fill);
  color: var(--accent-ink);
  text-shadow: 0 1px 1px var(--accent-ink-shadow);
}

.accent-chip[aria-pressed="true"]:hover:enabled {
  border-color: var(--accent-highlight);
}

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

.focus-ring:focus-visible,
input:focus-visible + .ui-switch,
.ui-switch:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: -4px;
}

.ui-switch {
  position: relative;
  flex: 0 0 var(--ui-switch-width);
  width: var(--ui-switch-width);
  height: calc(var(--ui-switch-width) * var(--ui-switch-ratio, 0.5));
  border: 1px solid var(--switch-track-border, var(--switch-border));
  border-radius: 999px;
  background: var(--switch-track-fill, var(--switch-fill));
  box-shadow: var(--switch-track-shadow, var(--switch-shadow));
}

.ui-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--switch-knob-fill, var(--switch-knob));
  transition: transform 0.15s ease, background 0.15s ease;
  pointer-events: none;
}

.ui-switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

input:checked + .ui-switch,
.ui-switch:has(input:checked) {
  border-color: var(--switch-checked-border);
  background: var(--switch-checked-fill);
  box-shadow: inset 0 1px 0 var(--switch-checked-glint);
}

input:checked + .ui-switch::after,
.ui-switch:has(input:checked)::after {
  transform: translateX(calc(var(--ui-switch-width) * var(--ui-switch-travel, 0.5)));
  background: var(--switch-checked-knob);
}

@media (prefers-reduced-motion: reduce) {
  .ui-switch::after {
    transition: none;
  }
}

.cta-btn {
  --bevel-fill: var(--bevel-fill-control);
  flex: 0 0 auto;
  width: 100%;
  margin-top: auto;
}

.cta-btn span {
  margin-right: 0.35em;
  font-size: 0.83em;
}

.cta-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-slot {
  box-sizing: border-box;
  width: var(--slot-size);
  height: var(--slot-size);
  display: grid;
  place-items: center;
  padding: var(--slot-padding, 4px);
  overflow: hidden;
}

.icon-slot img,
.icon-slot .asset-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.panel {
  width: min(92%, 520px);
  max-width: 100%;
  max-height: 100%;
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 28px 28px 24px;
  box-shadow: 0 24px 48px var(--shadow);
  overflow: auto;
}

.stat-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.catalog-stats {
  display: grid;
  gap: 0.24em;
  list-style: none;
  color: var(--catalog-stat-ink);
  font-size: var(--catalog-stat-size, 0.95em);
  font-weight: 700;
  line-height: 1.25;
}

.stat-up { color: var(--effect-positive); }
.stat-down { color: var(--effect-negative); }

.eyebrow {
  color: var(--ink-emphasis);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
}

h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--ink);
}

h1 span {
  color: var(--ink-emphasis);
}

h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.tagline {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--button-fill);
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--line);
  border-color: var(--ink-emphasis);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--line);
  border-color: var(--line-raised);
  color: var(--ink-bright);
}

.btn.primary:hover {
  background: var(--button-fill-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.controls {
  list-style: none;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

kbd {
  display: inline-block;
  min-width: 52px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: var(--key-fill);
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  margin-right: 6px;
  text-align: center;
}

.asset-img {
  display: inline-block;
  image-rendering: pixelated;
  vertical-align: middle;
  object-fit: contain;
}

.asset-img { width: 28px; height: 28px; }
.asset-img.xs { width: 18px; height: 18px; }
.asset-img.lg { width: 48px; height: 48px; }
.asset-img.xl { width: 64px; height: 64px; }
.asset-img.dim { opacity: 0.35; }

.game-panel {
  --frame-edge: var(--line-strong);
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  padding: clamp(16px, 2.4vw, 28px);
  border: 2px solid var(--frame-edge);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--ink-shadow), 0 16px 40px var(--shadow);
  clip-path: none;
  scrollbar-color: var(--line-raised) var(--bg);
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(0.88rem, 2vw, 1.2rem);
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--ink-shadow);
}

.panel-heading .tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.game-panel button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.coin { color: var(--coin); }

.tier-card {
  box-shadow: inset 0 4px 0 var(--tier-color), inset 0 0 0 2px #130e09;
}
