:root {
  color-scheme: dark;
  --bg: #030405;
  --fg: #e8ecef;
  --muted: #8d9499;
  --dim: #4f565c;
  --line: rgba(232, 236, 239, 0.11);
  --panel: rgba(18, 20, 22, 0.72);
  --accent: #8bd8cf;
  --accent-cold: #9fb7ff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--fg);
  background:
    radial-gradient(circle at 50% 42%, rgba(139, 216, 207, 0.07), transparent 24rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 44px),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 8vh 7vw;
  z-index: -1;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 0 90px rgba(255, 255, 255, 0.025),
    0 0 120px rgba(139, 216, 207, 0.035);
}

a {
  color: inherit;
  text-decoration: none;
}

.room-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px);
}

.home-room {
  display: grid;
  min-height: calc(100vh - clamp(56px, 10vw, 128px));
  grid-template-rows: 1fr auto 1fr;
  align-items: center;
}

.status-block {
  display: grid;
  gap: 4px;
  align-self: end;
  justify-self: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1.45;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 9vw, 104px);
  font-weight: 300;
  line-height: 0.95;
  text-align: center;
}

.object-grid {
  display: grid;
  width: min(100%, 720px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-self: start;
  justify-self: center;
  margin-top: clamp(42px, 8vh, 84px);
}

.room-object {
  position: relative;
  display: grid;
  min-height: 82px;
  padding: 16px;
  overflow: visible;
  align-content: end;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  color: var(--muted);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.room-object::after {
  content: attr(data-state);
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.room-object:hover,
.room-object:focus-visible {
  border-color: rgba(139, 216, 207, 0.38);
  background: rgba(139, 216, 207, 0.045);
  color: var(--fg);
  outline: none;
  transform: translateY(-3px);
}

.room-object:hover::after,
.room-object:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.object-light {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(139, 216, 207, 0.42);
  opacity: 0.45;
  animation: breathe 4.8s ease-in-out infinite;
}

.object-name {
  font-size: 15px;
  font-weight: 300;
}

.identity-card {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 2;
  display: grid;
  width: 210px;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(159, 183, 255, 0.22);
  background: rgba(5, 7, 9, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.identity-object:hover .identity-card,
.identity-object:focus-visible .identity-card {
  opacity: 1;
  transform: translate(-50%, 0);
}

.page-shell {
  display: grid;
  align-content: center;
  gap: 84px;
}

.back-link {
  position: fixed;
  top: clamp(24px, 5vw, 48px);
  left: clamp(24px, 5vw, 48px);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  transition: color 160ms ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.quiet-page {
  display: grid;
  width: min(100%, 560px);
  gap: 24px;
  margin: 0 auto;
}

.quiet-page h1 {
  font-size: clamp(38px, 8vw, 84px);
  text-align: left;
}

.quiet-page p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 3vw, 18px);
  font-weight: 300;
  line-height: 1.75;
}

.notes-shell,
.note-shell {
  display: grid;
  align-content: start;
  padding-top: clamp(96px, 15vh, 160px);
}

.notes-page,
.note-detail {
  display: grid;
  width: min(100%, 680px);
  gap: 34px;
  margin: 0 auto;
}

.notes-page h1,
.note-detail h1 {
  font-size: clamp(42px, 8vw, 86px);
  text-align: left;
}

.notes-feed {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.note-feed-item {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 24px 0 26px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: color 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.note-feed-item::before {
  position: absolute;
  top: 31px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(139, 216, 207, 0.36);
  content: "";
  opacity: 0.38;
  animation: breathe 5.8s ease-in-out infinite;
}

.note-feed-item:hover,
.note-feed-item:focus-visible {
  border-color: rgba(139, 216, 207, 0.28);
  color: var(--fg);
  outline: none;
  transform: translateY(-2px);
}

.note-date {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.note-title {
  color: var(--fg);
  font-size: clamp(18px, 3.6vw, 24px);
  font-weight: 300;
  line-height: 1.25;
}

.note-preview {
  max-width: 48rem;
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
}

.note-detail {
  gap: 20px;
}

.note-detail h1 {
  margin-top: 8px;
  line-height: 1.08;
}

.note-body {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 3.2vw, 21px);
  font-weight: 300;
  line-height: 1.85;
  white-space: pre-line;
}

.note-footer {
  width: min(100%, 680px);
  margin: 64px auto 0;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.muted-line {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-shell {
  display: grid;
  align-content: start;
  padding-top: clamp(42px, 8vh, 92px);
}

.admin-panel {
  display: grid;
  width: min(100%, 620px);
  gap: 28px;
  margin: 0 auto;
}

.admin-panel[hidden] {
  display: none;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.admin-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-panel h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 86px);
  font-weight: 300;
  line-height: 0.98;
  text-align: left;
}

.admin-form {
  display: grid;
  gap: 18px;
}

.admin-form label {
  display: grid;
  gap: 8px;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.025);
  color: var(--fg);
  font: inherit;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  padding: 14px;
  resize: vertical;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.admin-form textarea {
  min-height: 220px;
}

.admin-form input:focus,
.admin-form textarea:focus {
  border-color: rgba(139, 216, 207, 0.44);
  background: rgba(139, 216, 207, 0.035);
  box-shadow: 0 0 0 1px rgba(139, 216, 207, 0.08);
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-form button,
.ghost-button,
.danger-button {
  min-height: 46px;
  border: 1px solid rgba(139, 216, 207, 0.28);
  border-radius: 0;
  background: rgba(139, 216, 207, 0.045);
  color: var(--fg);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.admin-form button:hover,
.admin-form button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible {
  border-color: rgba(139, 216, 207, 0.56);
  background: rgba(139, 216, 207, 0.08);
  outline: none;
  transform: translateY(-2px);
}

.ghost-button,
.ghost-link,
.danger-button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
}

.ghost-link {
  display: inline-grid;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.ghost-link:hover,
.ghost-link:focus-visible {
  border-color: rgba(139, 216, 207, 0.38);
  background: rgba(139, 216, 207, 0.045);
  color: var(--fg);
  outline: none;
  transform: translateY(-2px);
}

.danger-button {
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.018);
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: rgba(255, 120, 120, 0.42);
  background: rgba(255, 120, 120, 0.055);
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.5;
  transform: none;
}

.admin-message {
  min-height: 18px;
  margin: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-preview {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.admin-preview[hidden] {
  display: none;
}

.admin-preview time {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-preview h2 {
  margin: 0;
  color: var(--fg);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 300;
  line-height: 1.2;
}

.admin-preview p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 3vw, 19px);
  font-weight: 300;
  line-height: 1.8;
  white-space: pre-line;
}

.manage-panel {
  display: grid;
  gap: 18px;
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.manage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.manage-heading h2 {
  margin: 0;
  color: var(--fg);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 300;
  line-height: 1.15;
}

.manage-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.manage-note {
  display: grid;
  gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.manage-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.note-id {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.manage-note-title {
  margin: 0;
  color: var(--fg);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.35;
}

.manage-note-preview {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
}

.manage-note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.26;
    transform: scale(0.92);
  }

  50% {
    opacity: 0.72;
    transform: scale(1.08);
  }
}

@media (max-width: 680px) {
  body::before {
    inset: 18px;
  }

  .room-shell {
    padding: 24px;
  }

  .home-room {
    min-height: calc(100vh - 48px);
    grid-template-rows: 0.85fr auto 1.15fr;
  }

  .object-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 44px;
  }

  .room-object {
    min-height: 64px;
  }

  .room-object::after {
    opacity: 1;
    transform: none;
  }

  .identity-card {
    left: auto;
    right: 0;
    bottom: calc(100% + 8px);
    width: min(220px, 78vw);
    transform: translateY(6px);
  }

  .identity-object:hover .identity-card,
  .identity-object:focus-visible .identity-card {
    transform: translateY(0);
  }

  .page-shell {
    gap: 64px;
    align-content: end;
    padding-bottom: 18vh;
  }

  .back-link {
    position: static;
  }

  .notes-shell,
  .note-shell {
    padding-top: 24px;
  }

  .notes-page,
  .note-detail,
  .note-footer {
    width: 100%;
  }

  .note-feed-item {
    padding: 22px 0 24px 20px;
  }

  .admin-shell {
    padding-top: 28px;
  }

  .admin-heading {
    align-items: start;
    flex-direction: column;
  }

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

  .admin-heading-actions,
  .manage-heading,
  .manage-note-actions {
    width: 100%;
  }

  .admin-heading-actions {
    align-items: stretch;
  }

  .ghost-link,
  .ghost-button,
  .danger-button {
    justify-content: center;
  }

  .manage-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
