:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #11161d;
  --panel-2: #151d26;
  --text: #f4f7fb;
  --muted: #a8b4c2;
  --line: #2c3847;
  --accent: #37d67a;
  --accent-2: #f7bf45;
  --danger: #ff7676;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(55, 214, 122, 0.18), transparent 28rem),
    linear-gradient(180deg, #0c1117 0%, var(--bg) 55%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.arcade-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: end;
  min-height: 260px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(40px, 8vw, 86px);
  line-height: 0.94;
}

.hero p:last-child {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.status-card,
.launcher,
.player-shell,
.notes article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 22, 29, 0.86);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
}

.status-card {
  padding: 20px;
}

.status-card__label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  line-height: 1.35;
}

.launcher {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  margin-top: 28px;
  padding: 18px;
}

.field span,
.rom-drop__title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}

.rom-drop {
  min-height: 96px;
  padding: 16px;
  border: 1px dashed #4f6176;
  border-radius: 8px;
  background: #0d131a;
  cursor: pointer;
}

.rom-drop:hover {
  border-color: var(--accent);
}

.rom-drop span:last-of-type {
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.rom-drop input,
.import-button input {
  display: none;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1a222c;
  color: var(--text);
  cursor: pointer;
}

button:hover,
.import-button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

#startBtn {
  border-color: #59e394;
  background: var(--accent);
  color: #06100a;
  font-weight: 900;
}

.player-shell {
  margin-top: 18px;
  padding: 12px;
  background: #050608;
}

#game {
  width: 100%;
  min-height: min(68vh, 720px);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #090c10;
  background-size: 32px 32px;
}

#game::before {
  content: "Carregue uma ROM para iniciar";
  color: var(--muted);
}

#game:has(canvas)::before,
#game:has(iframe)::before {
  content: "";
}

.notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.notes article {
  padding: 18px;
}

.notes h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.notes p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.is-error {
  color: var(--danger);
}

@media (max-width: 760px) {
  .hero,
  .launcher,
  .notes {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(38px, 14vw, 64px);
  }

  #game {
    min-height: 52vh;
  }
}
[hidden] { display: none !important; }
dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid #526170; border-radius: 8px; background: #12171d; color: var(--text); overflow: auto; }
dialog::backdrop { background: #000b; }
.control-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.control-header h2 { margin: 0; font-size: 22px; }
.control-header p { margin: 6px 0 0; color: var(--muted); }
#closeControls { width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 24px; flex-shrink: 0; }
.snes-pad { margin: 28px 0 18px; color: #242730; }
.shoulders { display: flex; justify-content: space-between; padding: 0 38px; }
.shoulders > div { width: 110px; background: #a5a8b1; border-radius: 12px 12px 0 0; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }
.pad-body { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: center; min-height: 210px; padding: 20px; border-radius: 70px; background: #d6d8de; border: 4px solid #afb3bc; box-shadow: inset 0 -8px #bfc2ca; }
.dpad, .face-buttons { width: 150px; height: 150px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); justify-self: center; }
.face-buttons { height: 186px; }
.dir, .face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-weight: bold; }
.dir { background: #333741; color: white; font-size: 17px; }
.up, .x { grid-area: 1 / 2; }
.left, .y { grid-area: 2 / 1; }
.down, .b { grid-area: 3 / 2; }
.right, .a { grid-area: 2 / 3; }
.face b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 18px; box-shadow: inset 0 -3px #0004; }
.x b { background: #236ab5; }.y b { background: #218451; }.b b { background: #b18a08; }.a b { background: #ca3944; }
kbd { min-width: 28px; max-width: 100%; padding: 3px 5px; border: 1px solid #626a77; border-bottom-width: 3px; border-radius: 4px; background: #1d232d; color: #fff; font: 600 12px ui-monospace, monospace; text-align: center; overflow-wrap: anywhere; }
.pad-center { text-align: center; }.pad-center > strong { font-size: 12px; }
.system-keys { display: flex; justify-content: center; gap: 16px; margin-top: 22px; font-size: 11px; font-weight: bold; }
.system-keys > div { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.control-caption { font-size: 13px; color: var(--muted); text-align: center; }
.control-help { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.control-help h3 { margin: 0; font-size: 16px; }.control-help ol { padding-left: 22px; line-height: 1.6; font-size: 14px; color: var(--muted); }
.control-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }.control-footer span { font-size: 13px; color: var(--muted); }
@media (max-width: 540px) {
  dialog { padding: 16px; }.control-header h2 { font-size: 18px; }
  .pad-body { padding: 12px 8px; gap: 4px; min-height: 150px; border-radius: 42px; grid-template-columns: 1fr 0.8fr 1fr; }
  .dpad, .face-buttons { width: min(96px, 100%); min-width: 0; height: 162px; }.face b { width: 26px; height: 26px; font-size: 15px; }
  .dir { font-size: 12px; }.dir kbd, .face kbd { font-size: 10px; min-width: 22px; padding: 2px; }
  .pad-center > strong { font-size: 9px; }.system-keys { flex-direction: column; gap: 8px; font-size: 10px; margin-top: 14px; }.system-keys kbd { white-space: nowrap; }
  .shoulders { padding: 0 18px; }.shoulders > div { width: 80px; }.control-footer { flex-wrap: wrap; }
}
@media (max-width: 380px) { .system-keys { flex-direction: column; gap: 8px; margin-top: 8px; }.pad-center { min-width: 0; }.pad-center > strong { overflow-wrap: anywhere; } }
