:root {
  color-scheme: light;
  --ink: #222;
  --muted: #555;
  --line: #ccc;
  --page: #ececec;
  --link: #0645ad;
  --danger: #8d2d2d;
  --danger-bg: #f8e8e4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 Arial, Helvetica, sans-serif;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 42rem);
  grid-template-areas:
    "top"
    "main"
    "bottom"
    "copy";
  gap: 0.8rem;
  justify-content: center;
  max-width: 76rem;
  margin: 0 auto;
  padding: 1rem;
}

.layout.has-sides {
  grid-template-columns: 160px minmax(0, 42rem) 160px;
  grid-template-areas:
    "top top top"
    "left main right"
    "bottom bottom bottom"
    "copy copy copy";
}

main {
  grid-area: main;
  min-width: 0;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  padding: 1rem 1.1rem 1.3rem;
}

.ad-top { grid-area: top; }
.ad-left { grid-area: left; }
.ad-right { grid-area: right; }
.ad-bottom { grid-area: bottom; }

.ad-slot {
  border: 1px solid var(--line);
  background: #fff;
  min-width: 0;
  overflow: hidden;
}

.ad-frame {
  display: block;
  width: 100%;
  height: 250px;
  border: 0;
  background: #fff;
}

.ad-frame-short {
  height: 90px;
}

.copyright {
  grid-area: copy;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

h1 {
  font-size: 1.65rem;
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 0.55rem;
}

h2 {
  font-size: 1rem;
  line-height: 1.3;
  margin: 1.15rem 0 0.35rem;
}

p {
  margin: 0.45rem 0;
}

.steps {
  margin: 0.2rem 0 1rem;
  padding-left: 1.2rem;
}

.steps li {
  margin: 0.15rem 0;
}

label {
  display: block;
  font-weight: 650;
  margin: 0.85rem 0 0.3rem;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

textarea,
input[type="password"],
select,
.copy-url,
.message-text,
.bar,
.bars {
  text-align: left;
}

textarea,
input[type="password"],
input[type="text"],
select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 0;
  padding: 0.45rem 0.5rem;
}

textarea {
  min-height: 10rem;
  resize: vertical;
}

.file-pick {
  position: relative;
  display: inline-block;
  margin-top: 0.35rem;
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-pick label,
button,
.nav-button {
  display: inline-block;
  margin: 0.35rem 0.35rem 0 0;
  background: #f3f3f3;
  color: #222;
  border: 1px solid #888;
  border-radius: 2px;
  font: inherit;
  font-weight: 650;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  text-decoration: none;
}

.nav {
  margin: 0 0 0.8rem;
}

.file-pick label {
  margin: 0;
}

.file-pick:focus-within label,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #0645ad;
  outline-offset: 2px;
}

a {
  color: #0645ad;
}

.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 0.6rem 0.7rem;
}

.picture-box {
  margin-top: 1.4rem;
  border: 1px solid #111;
  padding: 0.15rem 0.9rem 0.85rem;
}

.picture-box h2 {
  margin-top: 0.7rem;
}

.picture-box label {
  margin-top: 0.35rem;
}

.copy-url {
  overflow-wrap: anywhere;
  font-family: Consolas, ui-monospace, monospace;
  font-size: 0.92rem;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0.65rem 0.7rem;
}

.message-text,
.page-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.photo {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 0.9rem;
}

.bars {
  margin-top: 0.8rem;
}

.bar {
  background: #000;
  color: #000;
  margin: 0 0 0.35rem;
  padding: 0.15rem 0.5rem;
  min-height: 1.45em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}

.bar:hover,
.bar:active {
  background: #fff;
  color: #111;
}

.bar::selection {
  background: #000;
  color: #000;
}

.photo-wrap {
  display: inline-block;
  background: #000;
  line-height: 0;
  max-width: 100%;
  margin-top: 0.9rem;
}

.photo-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  opacity: 0;
}

.photo-wrap:hover img,
.photo-wrap:active img {
  opacity: 1;
}

@media (max-width: 860px) {
  .layout,
  .layout.has-sides {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main"
      "bottom"
      "left"
      "right"
      "copy";
  }
}

.admin {
  max-width: 42rem;
  margin: 1rem auto;
}

.admin-list {
  padding-left: 1.1rem;
}

.admin-list form {
  display: inline;
}

@media (max-width: 640px) {
  .fields {
    grid-template-columns: 1fr;
  }
}
