/* 実装: 色・間隔・動きはここでまとめて管理します。 */
:root {
  color-scheme: dark;
  --black: #030506;
  --panel: #080d0f;
  --panel-2: #0c1316;
  --ink: #b8c5c7;
  --muted: #68787b;
  --line: #29383b;
  --line-bright: #41575a;
  --phosphor: #9fb9b7;
  --warning: #86614d;
  --danger: #7c443e;
  --shadow: rgba(0, 0, 0, 0.72);
  --mono: "MS Gothic", "Osaka-Mono", "Noto Sans Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--black);
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(27, 41, 43, 0.13), transparent 38rem),
    var(--black);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: 0.055em;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--phosphor);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  transform: translateY(-180%);
  border: 1px solid var(--line-bright);
  background: var(--panel);
  color: var(--ink);
}

.skip-link:focus {
  transform: translateY(0);
}

.boot-screen,
.warning-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 1.25rem;
  background: #000;
}

.boot-box {
  width: min(22rem, 82vw);
  text-align: center;
}

.boot-message {
  min-height: 2rem;
  margin: 0 0 1.7rem;
  color: #9ba6a7;
  font-size: 0.78rem;
}

.progress-track {
  height: 2px;
  overflow: hidden;
  background: #172022;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: #718688;
  box-shadow: 0 0 8px rgba(143, 172, 173, 0.35);
  transition: width 120ms linear;
}

.progress-value {
  display: block;
  margin-top: 0.65rem;
  color: #465356;
  font-size: 0.62rem;
  text-align: right;
}

.warning-screen {
  z-index: 90;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 3px),
    #050708;
}

.system-dialog {
  width: min(35rem, 94vw);
  border: 1px solid #526063;
  box-shadow: 1.5rem 2rem 5rem #000;
  background: #101719;
}

.dialog-titlebar {
  display: flex;
  justify-content: space-between;
  padding: 0.38rem 0.65rem;
  background: #263336;
  color: #c0c9ca;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.dialog-body {
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  gap: 1rem;
  min-height: 10rem;
  padding: 2rem 2rem 1.25rem;
  font-size: 0.82rem;
}

.warning-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--warning);
  color: #a77a5e;
}

.dialog-body p {
  margin: 0 0 1rem;
}

.warning-extra {
  color: #9a7168;
}

.dialog-actions {
  padding: 0.85rem 1rem;
  border-top: 1px solid #2a3739;
  text-align: right;
}

.system-button {
  min-width: 8rem;
  min-height: 2.55rem;
  padding: 0.5rem 1rem;
  border: 1px solid #506063;
  border-radius: 0;
  background: #172123;
  color: #c6cfd0;
  cursor: pointer;
}

.system-button:hover {
  border-color: #718588;
  background: #202d2f;
}

.system-button:active {
  transform: translate(1px, 1px);
}

.site-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1.25rem, 4vw, 3.5rem);
  animation: shell-arrive 850ms ease-out both;
}

.site-shell::before {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(0deg, rgba(177, 207, 208, 0.026) 0, rgba(177, 207, 208, 0.026) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: soft-light;
}

.ambient-noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.23;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 17% 13%, transparent 0 1px, rgba(91, 112, 114, 0.1) 1px 2px, transparent 2px 4px),
    linear-gradient(112deg, transparent 47%, rgba(78, 98, 99, 0.03) 50%, transparent 53%);
  animation: noise-drift 12s steps(4, end) infinite;
}

.site-header,
.archive-main,
.site-footer {
  width: min(68rem, 100%);
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.8rem 2rem;
  align-items: end;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 1rem;
  align-items: baseline;
  width: max-content;
  color: inherit;
  text-decoration: none;
}

.brand-main {
  color: #c8d4d4;
  font-size: clamp(2.1rem, 5vw, 3.7rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.09em;
}

.brand-sub {
  color: #748689;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
}

.header-readout {
  display: grid;
  justify-items: end;
  gap: 0.3rem;
  font-size: 0.64rem;
}

.clock {
  color: #536365;
}

.status {
  color: #829b91;
  letter-spacing: 0.1em;
}

.status i {
  display: inline-block;
  width: 0.38rem;
  height: 0.38rem;
  margin-right: 0.5rem;
  border: 1px solid #6f8b7f;
  border-radius: 50%;
  background: #435a51;
  box-shadow: 0 0 0.7rem rgba(87, 130, 111, 0.24);
}

.status.is-watching {
  color: #a07a6f;
}

.archive-nav {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.7rem;
}

.nav-button {
  padding: 0.15rem 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: #6d7d80;
  font-size: 0.78rem;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: #58696b;
  color: #bdc7c8;
}

.nav-button.is-unknown {
  color: #886b65;
  animation: soft-appear 1.7s ease-out both;
}

.archive-main {
  min-height: 58vh;
  padding-block: clamp(3.2rem, 8vw, 7rem);
  outline: none;
}

.content-section {
  animation: content-reveal 560ms ease-out both;
}

.content-section h1 {
  margin: 0 0 clamp(2rem, 5vw, 4rem);
  color: #aebabb;
  font-size: clamp(1.25rem, 2.7vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.18em;
}

.section-index {
  margin-bottom: 0.65rem;
  color: #4e5c5e;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
}

.surveillance-frame {
  position: relative;
  width: min(52rem, 100%);
  aspect-ratio: 16 / 8.4;
  overflow: hidden;
  border: 1px solid #283638;
  background:
    repeating-linear-gradient(90deg, transparent 0 7%, rgba(127, 152, 153, 0.018) 7.2% 7.3%),
    radial-gradient(ellipse at 50% 35%, #1e2a2c 0%, #101719 28%, #070b0d 70%);
  box-shadow: inset 0 0 5rem #000, 0 1.5rem 4rem var(--shadow);
}

.surveillance-frame::before {
  position: absolute;
  z-index: 5;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(176, 204, 204, 0.045) 3px 4px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 13%, transparent 87%, rgba(0, 0, 0, 0.38));
}

.surveillance-frame::after {
  position: absolute;
  z-index: 6;
  top: -30%;
  left: 0;
  width: 100%;
  height: 20%;
  content: "";
  pointer-events: none;
  background: linear-gradient(transparent, rgba(163, 192, 193, 0.05), transparent);
  animation: scan-pass 9s linear infinite;
}

.monitor-meta {
  position: absolute;
  z-index: 8;
  color: rgba(166, 184, 184, 0.58);
  font-size: clamp(0.46rem, 1.2vw, 0.63rem);
  letter-spacing: 0.08em;
}

.top-left { top: 0.7rem; left: 0.8rem; }
.top-right { top: 0.7rem; right: 0.8rem; color: #84655e; }
.bottom-left { bottom: 0.7rem; left: 0.8rem; }
.bottom-right { right: 0.8rem; bottom: 0.7rem; }

.corridor {
  position: absolute;
  inset: 8% 9%;
  clip-path: polygon(0 0, 100% 0, 79% 100%, 21% 100%);
  background:
    linear-gradient(111deg, transparent 0 30%, #1b2628 30.3% 30.6%, transparent 31%),
    linear-gradient(249deg, transparent 0 30%, #1b2628 30.3% 30.6%, transparent 31%),
    linear-gradient(#121a1c 0 45%, #0b1113 45%);
  filter: blur(0.35px);
}

.corridor::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 55%;
  content: "";
  background: repeating-linear-gradient(90deg, transparent 0 11%, rgba(123, 145, 146, 0.035) 11.2% 11.5%);
}

.ceiling-light {
  position: absolute;
  top: 15%;
  left: 50%;
  width: 9%;
  height: 1.6%;
  transform: translateX(-50%);
  background: rgba(165, 183, 179, 0.28);
  box-shadow: 0 0 1.8rem rgba(142, 167, 165, 0.14);
}

.light-two {
  top: 31%;
  width: 6%;
  opacity: 0.45;
}

.door {
  position: absolute;
  bottom: 14%;
  left: 45.5%;
  width: 9%;
  height: 31%;
  border: 1px solid rgba(85, 106, 108, 0.28);
  background: #080c0d;
}

.figure {
  position: absolute;
  z-index: 2;
  right: 8%;
  bottom: 3%;
  width: 0.8%;
  height: 15%;
  border-radius: 45% 45% 10% 10%;
  background: rgba(1, 2, 2, 0.88);
  opacity: 0;
  transition: opacity 6s ease;
}

.surveillance-frame.has-figure .figure {
  opacity: 0.58;
}

.focus-mark {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  width: 12%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0.22;
  background:
    linear-gradient(#8ca0a0, #8ca0a0) left top / 22% 1px no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) left top / 1px 22% no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) right top / 22% 1px no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) right top / 1px 22% no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) left bottom / 22% 1px no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) left bottom / 1px 22% no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) right bottom / 22% 1px no-repeat,
    linear-gradient(#8ca0a0, #8ca0a0) right bottom / 1px 22% no-repeat;
}

.intro-copy {
  max-width: 48rem;
  margin: clamp(2rem, 5vw, 4rem) 0;
  color: #8d9b9d;
}

.system-claim {
  color: #68787a;
}

.system-claim.is-watching {
  color: #a07870;
}

.record-log {
  max-width: 48rem;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.record-log li {
  display: grid;
  grid-template-columns: 9.5rem 1fr auto;
  gap: 1rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid rgba(46, 61, 63, 0.55);
  color: #768689;
  font-size: 0.72rem;
}

.record-log b {
  color: #536466;
  font-weight: 400;
}

.record-log .today-entry {
  color: #9aadae;
}

.record-log .new-log {
  color: #98736a;
  animation: soft-appear 2s ease both;
}

.system-copy,
.form-intro,
.contact-form,
.you-section {
  max-width: 43rem;
}

.system-copy > p {
  margin: 0 0 2rem;
}

.spec-list {
  margin: 3rem 0;
  border-top: 1px solid var(--line);
}

.spec-list div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.spec-list dt {
  color: var(--muted);
}

.spec-list dd {
  margin: 0;
  color: #a1aeaf;
}

.privacy-statement {
  padding-left: 1rem;
  border-left: 1px solid #526466;
  color: #aebabb;
}

.small-copy {
  color: #556366;
  font-size: 0.67rem;
}

.dummy-code {
  max-width: 43rem;
  margin-top: 3.5rem;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid #202c2e;
  background: #050809;
  color: #5f6d6f;
  font-size: 0.68rem;
  line-height: 1.7;
}

.form-intro {
  margin: -2rem 0 3rem;
  color: #6f7e80;
}

.contact-form {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.15rem 1.5rem;
  align-items: start;
}

.contact-form label {
  padding-top: 0.55rem;
  color: #788789;
  font-size: 0.72rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #354547;
  border-radius: 0;
  background: rgba(7, 11, 12, 0.72);
  color: #b7c3c4;
  caret-color: #819495;
}

.contact-form input {
  min-height: 2.65rem;
  padding: 0.4rem 0.6rem;
}

.contact-form textarea {
  min-height: 9rem;
  padding: 0.65rem;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: #697d7f;
  background: #0b1112;
}

.submit-button {
  grid-column: 2;
  justify-self: end;
  margin-top: 0.6rem;
}

.form-response {
  min-height: 5rem;
  max-width: 36rem;
  margin: 3rem 0 0 8.5rem;
  color: #99736b;
}

.form-response p {
  margin: 0 0 0.7rem;
}

.ghost-line {
  margin-top: 4rem;
  color: #755b56;
  font-size: 0.65rem;
}

.site-footer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 2rem;
  align-items: end;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
  color: #546164;
  font-size: 0.6rem;
}

.site-footer p {
  margin: 0.1rem 0;
}

.last-update {
  padding: 0;
  border: 0;
  background: transparent;
  color: #3e4a4c;
  font-size: 0.52rem;
  cursor: pointer;
}

.last-update:hover,
.last-update:focus-visible {
  color: #7d8b8d;
}

.devtools-warning {
  grid-column: 1 / -1;
  margin-top: 1rem !important;
  color: #353f41;
  font-size: 0.48rem;
}

.sound-toggle {
  position: fixed;
  z-index: 30;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  min-height: 2.2rem;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border: 1px solid #283638;
  background: rgba(5, 9, 10, 0.92);
  color: #5d6c6e;
  font-size: 0.54rem;
  cursor: pointer;
}

.sound-toggle b {
  color: #8ba09d;
  font-weight: 400;
}

.system-toast {
  position: fixed;
  z-index: 40;
  right: 1.5rem;
  bottom: 4.4rem;
  max-width: calc(100vw - 3rem);
  padding: 0.5rem 0.75rem;
  border-left: 1px solid #705650;
  background: rgba(4, 7, 8, 0.92);
  color: #9b7770;
  font-size: 0.62rem;
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 450ms ease, transform 450ms ease;
  pointer-events: none;
}

.system-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.edge-message {
  position: fixed;
  z-index: 25;
  top: 46%;
  right: 0.2rem;
  color: #554340;
  font-size: 0.47rem;
  letter-spacing: 0.04em;
  opacity: 0;
  writing-mode: vertical-rl;
  transition: opacity 1.6s ease;
}

.edge-message.is-visible {
  opacity: 0.72;
}

.glitch-once {
  animation: screen-glitch 260ms steps(2, end) both;
}

@keyframes shell-arrive {
  from { opacity: 0; filter: brightness(1.6) contrast(1.5); }
  to { opacity: 1; filter: none; }
}

@keyframes content-reveal {
  from { opacity: 0; transform: translateY(0.45rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes soft-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scan-pass {
  from { transform: translateY(0); }
  to { transform: translateY(650%); }
}

@keyframes noise-drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  35% { transform: translate3d(2%, -1%, 0); }
  70% { transform: translate3d(-1%, 1.5%, 0); }
}

@keyframes screen-glitch {
  0% { transform: translate(0); filter: none; }
  25% { transform: translate(-3px, 1px); filter: contrast(1.8); }
  50% { transform: translate(3px, -1px); filter: hue-rotate(18deg); }
  100% { transform: translate(0); filter: none; }
}

@media (max-width: 650px) {
  body {
    font-size: 14px;
    letter-spacing: 0.035em;
  }

  .site-shell {
    padding: 1.1rem;
  }

  .site-header {
    gap: 1.2rem;
  }

  .brand {
    gap: 0.65rem;
  }

  .brand-sub {
    max-width: 7rem;
    font-size: 0.55rem;
  }

  .archive-nav {
    gap: 0.5rem 1.2rem;
  }

  .archive-main {
    padding-block: 3.5rem;
  }

  .surveillance-frame {
    aspect-ratio: 4 / 3;
  }

  .record-log li {
    grid-template-columns: 6.6rem 1fr auto;
    gap: 0.5rem;
    font-size: 0.64rem;
  }

  .contact-form {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .contact-form label {
    margin-top: 0.65rem;
  }

  .submit-button {
    grid-column: 1;
  }

  .form-response {
    margin-left: 0;
  }

  .dialog-body {
    grid-template-columns: 1.8rem 1fr;
    gap: 0.75rem;
    min-height: 12rem;
    padding: 1.5rem 1.2rem 1rem;
  }

  .warning-mark {
    width: 1.7rem;
    height: 1.7rem;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .last-update {
    justify-self: start;
  }
}

@media (max-width: 390px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .header-readout {
    justify-items: start;
  }

  .record-log li {
    grid-template-columns: 1fr auto;
  }

  .record-log time {
    grid-column: 1 / -1;
    color: #536164;
  }

  .spec-list div {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .ambient-noise,
  .surveillance-frame::after {
    animation: none !important;
  }
}
