:root {
  color-scheme: dark;
  --bg: #050505;
  --page: #101010;
  --panel: #151515;
  --panel2: #0b0b0b;
  --text: #d8d8d8;
  --muted: #a5a5a5;
  --line: #555;
  --line-dark: #333;
  --yellow: #fff3a0;
  --link: #66d9ff;
  --visited: #b69cff;
  --red: #ff6969;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 96px),
    #000;
  color: var(--text);
  font-family: "MS PGothic", "Osaka", "Hiragino Kaku Gothic ProN", monospace, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--link);
  text-decoration: underline;
}

a:visited {
  color: var(--visited);
}

hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid #000;
}

.page {
  width: min(860px, calc(100% - 20px));
  margin: 12px auto 28px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--page);
}

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.site-header {
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--yellow);
  font-size: 12px;
  letter-spacing: .14em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0 0 8px;
  color: #f2f2f2;
  font-size: clamp(30px, 8vw, 50px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #000;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 14px;
  color: #eee;
  font-size: 20px;
  font-weight: 700;
}

.visitor,
.updated {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.visitor span {
  display: inline-block;
  padding: 0 5px;
  border: 1px inset #777;
  background: #000;
  color: var(--yellow);
  font-family: Consolas, "MS PGothic", monospace;
  letter-spacing: .08em;
}

.old-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin-top: 10px;
  font-size: 13px;
}

.lead {
  max-width: 720px;
  margin: 0 auto 14px;
  color: #cfcfcf;
  text-align: left;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.lead p {
  margin-bottom: 12px;
}

.lead p:last-child {
  margin-bottom: 0;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.status-row span {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: #070707;
  color: var(--yellow);
  font-size: 13px;
}

main {
  padding-top: 2px;
}

.notice,
.empty-state,
.old-section,
.system-messages {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #090909;
  color: var(--muted);
  text-align: left;
  overflow-wrap: anywhere;
}

.notice p,
.empty-state p,
.system-messages p {
  margin-bottom: 0;
  white-space: pre-line;
}

.empty-state p + p {
  margin-top: 8px;
}

code {
  color: var(--yellow);
}

.old-section h2 {
  margin-bottom: 8px;
  color: var(--yellow);
  font-size: 16px;
  text-align: center;
}

.old-section p {
  margin-bottom: 10px;
}

.muted {
  color: #888;
}

.caution-note,
.system-messages .error,
.inline-result.error,
.inline-result .error {
  color: var(--red);
}

.system-messages .ok,
.inline-result .ok {
  color: var(--yellow);
}

.old-form {
  margin: 12px 0;
  padding: 10px;
  border: 1px dotted #555;
  background: #050505;
}

.old-form label {
  display: block;
  margin-bottom: 9px;
  color: #cfcfcf;
}

.old-form input[type="text"],
.old-form input[type="password"],
.old-form input[type="file"],
.old-form textarea {
  width: 100%;
  margin-top: 3px;
  padding: 5px;
  border: 2px inset #777;
  border-radius: 0;
  background: #000;
  color: #ddd;
  font-family: "MS PGothic", "Osaka", "Hiragino Kaku Gothic ProN", monospace, sans-serif;
  font-size: 13px;
}

.old-form textarea {
  resize: vertical;
}

.old-form input[type="checkbox"] {
  vertical-align: middle;
}

.check-line {
  padding: 6px;
  border: 1px solid #333;
  background: #080808;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  margin: 8px 0 0;
  text-align: right;
}

.inline-result {
  min-height: 1.7em;
  margin: 4px 0 8px;
  white-space: pre-line;
}

.inline-result p {
  margin: 0 0 4px;
}

.guestbook-list {
  margin-top: 12px;
}

.guestbook-post {
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #444;
  background: #060606;
  color: #cfcfcf;
}

.post-head {
  margin-bottom: 6px;
  color: var(--yellow);
  font-family: Consolas, "MS PGothic", monospace;
  font-size: 12px;
}

.post-body {
  margin-bottom: 0;
  color: #bfbfbf;
  white-space: normal;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid #444;
  background: #060606;
}

.admin-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid #555;
  background: #000;
  filter: blur(6px) grayscale(.2) brightness(.75);
  transform: scale(1.04);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.logout-form {
  text-align: right;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: #060606;
}

.archive-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 4px 4px 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}

.archive-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line-dark);
  filter: blur(9px) grayscale(.2) saturate(.72) brightness(.72);
  transform: scale(1.08);
  transition: filter .16s ease;
}

.archive-card:hover img,
.archive-card:focus-visible img {
  filter: blur(8px) grayscale(.12) saturate(.82) brightness(.82);
}

.archive-card span {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  padding: 2px 4px;
  border-top: 1px solid var(--line-dark);
  background: #050505;
  color: #f3f3f3;
  font-family: Consolas, "MS PGothic", monospace;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
}

.dialog,
.image-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.dialog[open],
.image-dialog[open] {
  display: grid;
  place-items: center;
}

.dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(0, 0, 0, .82);
}

.dialog-card {
  width: min(92vw, 460px);
  padding: 16px;
  border: 2px ridge #777;
  border-radius: 0;
  background: #101010;
  box-shadow: none;
}

.caution-label {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 16px;
  font-weight: 700;
}

.warning-text {
  margin-bottom: 0;
  color: #d4d4d4;
  line-height: 1.8;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  min-height: 36px;
  padding: 6px 14px;
  border: 2px outset #777;
  border-radius: 0;
  background: #1e1e1e;
  color: #e5e5e5;
  cursor: pointer;
}

.btn:active {
  border-style: inset;
}

.btn.primary {
  background: #2b2b13;
  color: var(--yellow);
}

.btn.ghost {
  color: #c9c9c9;
}

.btn:focus-visible,
.archive-card:focus-visible {
  outline: 1px dotted var(--yellow);
  outline-offset: 2px;
}

.image-shell {
  width: min(100vw, 900px);
  max-height: 100dvh;
  border: 1px solid var(--line);
  background: #050505;
  overflow: auto;
}

.image-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #101010;
}

.image-head span {
  color: var(--yellow);
  font-family: Consolas, "MS PGothic", monospace;
}

#fullImage {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 230px);
  object-fit: contain;
  background: #000;
}

.restore-meta {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #0a0a0a;
  color: #9f9f9f;
  font-family: Consolas, "MS PGothic", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.restore-meta div {
  display: grid;
  grid-template-columns: minmax(86px, .34fr) 1fr;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dotted #444;
}

.restore-meta div:last-child {
  border-bottom: 0;
}

.restore-meta dt {
  color: #777;
}

.restore-meta dd {
  margin: 0;
  color: #c5c5c5;
  word-break: break-word;
}

.site-footer {
  margin-top: 18px;
  color: #aaa;
  font-size: 12px;
  text-align: center;
}

.site-footer p {
  margin: 3px 0;
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .page {
    width: calc(100% - 12px);
    margin-top: 6px;
    padding: 10px;
  }

  h1 {
    font-size: clamp(27px, 8.8vw, 36px);
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: .1em;
  }

  .old-menu {
    gap: 4px 8px;
    font-size: 12px;
  }

  .lead {
    line-height: 1.8;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .archive-card {
    padding: 3px 3px 22px;
  }

  .archive-card span {
    font-size: 11px;
  }

  .dialog-card {
    width: calc(100vw - 24px);
    padding: 14px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .btn {
    width: 100%;
    min-height: 42px;
  }

  .image-dialog[open] {
    place-items: stretch;
  }

  .image-shell {
    width: 100vw;
    height: 100dvh;
    border: 0;
  }

  .image-head {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  #fullImage {
    max-height: calc(100dvh - 260px);
  }

  .restore-meta {
    font-size: 11px;
  }

  .restore-meta div {
    grid-template-columns: 82px 1fr;
    gap: 8px;
  }

  .admin-item {
    grid-template-columns: 56px 1fr;
  }

  .admin-item img {
    width: 56px;
    height: 56px;
    max-height: none;
  }
}

@media (min-width: 560px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 820px) {
  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
}
