:root {
  color-scheme: light;
  --bg: #F4F2F7;
  --surface: #f7f7fa;
  --ink: #1f2937;
  --muted: #606875;
  --accent: #6f339c;
  --line: #e1e2e8;
  --button-bg: #6f339c;
  --button-hover: #59267e;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --surface: #1b2333;
  --ink: #f9fafb;
  --muted: #c0c6d2;
  --accent: #bc7bec;
  --line: #364052;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #111827;
    --surface: #1b2333;
    --ink: #f9fafb;
    --muted: #c0c6d2;
    --accent: #bc7bec;
    --line: #364052;
  }
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); }

main {
  width: min(100%, 72rem);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { color: inherit; font-size: 1.5rem; font-weight: 750; text-decoration: none; }
header p { color: var(--muted); margin: .4rem 0 0; }

.frame {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame p { color: var(--muted); text-align: center; }
.frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: .75rem;
}
[hidden] { display: none !important; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
button {
  background: var(--button-bg);
  border: 1px solid var(--button-bg);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  padding: .8rem 1.1rem;
}
button:hover { background: var(--button-hover); border-color: var(--button-hover); }
button.secondary { background: transparent; border-color: var(--accent); color: var(--accent); }
button.secondary:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }
button:disabled { cursor: wait; opacity: .5; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.icon-button { width: 3rem; height: 3rem; padding: .75rem; display: inline-flex; align-items: center; justify-content: center; }
.icon-button svg { width: 1.5rem; height: 1.5rem; }

@media (max-width: 40rem) {
  main { padding: 1rem; gap: 1rem; }
}

@media print {
  @page { margin: 0; }
  body { background: white; }
  main { display: block; width: 100%; height: auto; padding: 1cm; }
  .site-header, #status, noscript { display: none; }
  .frame { display: block; min-height: 0; }
  .frame img { max-width: 100%; max-height: calc(100vh - 2cm); margin: auto; border: 0; border-radius: 0; }
}
