:root {
  color-scheme: dark;
  --background: #15151c;
  --surface: #1d1d27;
  --line: #444457;
  --foreground: #f7f5ff;
  --muted: #bcb8cc;
  --accent: #d3baff;
  background: var(--background);
  color: var(--foreground);
  font: 16px/1.5 system-ui, sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; }

.preview-page {
  max-width: 37rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.125rem);
  letter-spacing: -.035em;
  line-height: 1.05;
  margin: 0 0 1.25rem;
}

output { display: block; color: var(--muted); font-size: .9rem; }

.preview-channel {
  display: grid;
  gap: .3rem;
  justify-items: start;
  margin-bottom: 1rem;
}

.preview-channel select {
  max-width: 100%;
  min-height: 2.75rem;
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.preview-actions {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}

input { font: inherit; max-width: 100%; }
input[type="file"] { display: block; margin-top: .4rem; }

button:not(.showbox-button) {
  color: inherit;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  font: inherit;
  padding: .5rem .85rem;
  min-height: 2.75rem;
  justify-self: start;
  cursor: pointer;
}

button:not(.showbox-button):disabled { opacity: .6; cursor: default; }

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

.market-header, .market {
  width: min(100% - 2rem, 74rem);
  margin: 0 auto;
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.5rem;
  border-bottom: 1px solid var(--line);
}

a { color: var(--accent); }
.wordmark { font-weight: 750; color: var(--foreground); font-size: 1.15rem; text-decoration: none; }
.market { padding: clamp(2rem, 5vw, 4rem) 0; }
.market-subtitle { color: var(--muted); margin: -.55rem 0 2rem; }
.market-layout { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 3fr); gap: clamp(1rem, 3vw, 2rem); }
.market-catalog { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.market-catalog a {
  display: grid;
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.market-catalog a:hover, .market-catalog a[aria-current] { background: var(--surface); }
.market-catalog a[aria-current] strong { color: var(--accent); }
.market-catalog small, #selected-app { color: var(--muted); }
.market-catalog strong { font-weight: 650; }
.market-preview { min-width: 0; max-width: 35rem; }
.market-preview-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .75rem; }
.market-preview-heading h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.15; }
#selected-app { margin: .25rem 0 .85rem; }
#market-player { max-width: 35rem; }
#market-player iframe {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.12;
  border: 0;
  background: var(--background);
}
.market-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .75rem; }
.market-actions a { display: inline-flex; min-height: 2.75rem; align-items: center; padding-inline: .5rem; }
.market-embed { display: grid; gap: .55rem; margin-top: 1rem; }
.market-embed[hidden] { display: none; }
.market-embed textarea { resize: vertical; font: .9rem/1.5 ui-monospace, monospace; color: inherit; background: var(--surface); padding: .65rem; border: 1px solid var(--line); }
.market-message { color: var(--muted); min-height: 1.4rem; }
.embedded-page { padding: .35rem; }
.embedded-page main { max-width: 44rem; margin: 0 auto; }
.embedded-page [hidden] { display: none; }

@media (max-width: 720px) {
  .market-layout { grid-template-columns: 1fr; }
  .market-preview { grid-row: 1; }
  .market-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
}
