:root {
  color-scheme: dark;
  --pixel-bg: #101222;
  --pixel-panel: #1b1e35;
  --pixel-panel-light: #252a48;
  --pixel-ink: #f0efff;
  --pixel-muted: #a4a8c7;
  --pixel-cyan: #62f4e3;
  --pixel-pink: #ff6ad5;
  --pixel-yellow: #ffe66d;
  --pixel-green: #8dff8a;
  --pixel-shadow: #070811;
}

* {
  box-sizing: border-box;
}

body {
  color: var(--pixel-ink);
  font-family: "Courier New", Courier, monospace;
  background-color: var(--pixel-bg);
  background-image:
    linear-gradient(rgba(98, 244, 227, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 244, 227, 0.035) 1px, transparent 1px);
  background-size: 16px 16px;
}

a {
  color: var(--pixel-cyan);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--pixel-yellow);
}

button,
input,
textarea,
select {
  border: 2px solid var(--pixel-cyan);
  border-radius: 0;
  font: inherit;
}

button {
  padding: 8px 12px;
  color: var(--pixel-bg);
  background: var(--pixel-cyan);
  box-shadow: 4px 4px 0 var(--pixel-shadow);
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
}

button:hover {
  color: var(--pixel-bg);
  background: var(--pixel-yellow);
  border-color: var(--pixel-yellow);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--pixel-shadow);
}

input,
textarea,
select {
  padding: 8px 10px;
  color: var(--pixel-ink);
  background: #101222;
}

input::placeholder,
textarea::placeholder {
  color: var(--pixel-muted);
}

:focus-visible {
  outline: 3px solid var(--pixel-yellow);
  outline-offset: 3px;
}

.menu-wrapper {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9999;
  font-size: 1rem;
}

.menu-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  color: var(--pixel-yellow);
  background: var(--pixel-panel);
  border: 3px solid var(--pixel-yellow);
  box-shadow: 4px 4px 0 var(--pixel-shadow);
  cursor: pointer;
  font-size: 1.5rem;
}

.menu-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--pixel-shadow);
}

.menu-content {
  position: absolute;
  top: 56px;
  left: 0;
  display: none;
  min-width: 150px;
  padding: 8px;
  background: var(--pixel-panel);
  border: 3px solid var(--pixel-pink);
  box-shadow: 5px 5px 0 var(--pixel-shadow);
}

.menu-content a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--pixel-ink);
  text-decoration: none;
  white-space: nowrap;
}

.menu-content a:hover {
  color: var(--pixel-bg);
  background: var(--pixel-cyan);
  text-shadow: none;
}

.home-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #222b4a;
  background-image:
    radial-gradient(#fff0a8 1.5px, transparent 2px),
    radial-gradient(#b8d5ff 1px, transparent 2px),
    linear-gradient(to bottom, #222b4a 0%, #334568 53%, #52715c 53%, #52715c 100%);
  background-position: 8% 12%, 83% 20%, 0 0;
  background-size: 97px 83px, 131px 107px, 100% 100%;
}

.village-scene {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 76px 24px 24px;
  isolation: isolate;
}

.village-scene::before {
  position: absolute;
  z-index: -1;
  right: -5%;
  bottom: 22%;
  left: -5%;
  height: 30%;
  background: #394d58;
  clip-path: polygon(0 100%, 0 48%, 12% 48%, 12% 24%, 24% 24%, 24% 40%, 38% 40%, 38% 14%, 53% 14%, 53% 35%, 68% 35%, 68% 18%, 83% 18%, 83% 42%, 100% 42%, 100% 100%);
  content: "";
}

.village-scene::after {
  position: absolute;
  z-index: -1;
  right: -5%;
  bottom: 0;
  left: -5%;
  height: 29%;
  background:
    linear-gradient(90deg, transparent 0 12%, #65905c 12% 14%, transparent 14% 30%, #65905c 30% 32%, transparent 32% 71%, #65905c 71% 73%, transparent 73%),
    repeating-linear-gradient(0deg, #496e50 0 20px, #527a54 20px 40px);
  border-top: 6px solid #8eaa65;
  content: "";
}

.village-intro {
  margin-bottom: clamp(24px, 6vh, 58px);
  text-align: center;
  text-shadow: 3px 3px 0 #11182a;
}

.village-kicker {
  margin-bottom: 8px;
  color: var(--pixel-cyan);
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.22em;
}

.village-intro h1 {
  color: var(--pixel-yellow);
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
  text-shadow: 4px 4px 0 #d84f9d, 8px 8px 0 #11182a;
}

.village-intro > p:last-child {
  margin-top: 16px;
  color: #f0efff;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
}

.village-houses {
  display: grid;
  width: min(100%, 980px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: clamp(8px, 2.5vw, 28px);
}

.village-house {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  color: var(--pixel-ink);
  text-align: center;
  text-decoration: none;
  transition: transform 120ms steps(2, end);
}

.village-house:nth-child(even) {
  transform: translateY(18px);
}

.village-house:hover,
.village-house:focus-visible {
  color: var(--pixel-yellow);
  transform: translateY(-8px);
}

.village-house:nth-child(even):hover,
.village-house:nth-child(even):focus-visible {
  transform: translateY(10px);
}

.house-sprite {
  display: flex;
  width: min(100%, 176px);
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(6px 7px 0 rgba(8, 15, 24, 0.42));
  image-rendering: pixelated;
}

.house-roof {
  z-index: 1;
  width: 100%;
  height: 67px;
  background: var(--roof-color, #d95f62);
  clip-path: polygon(0 100%, 0 55%, 13% 55%, 13% 32%, 27% 32%, 27% 12%, 39% 12%, 39% 0, 61% 0, 61% 12%, 73% 12%, 73% 32%, 87% 32%, 87% 55%, 100% 55%, 100% 100%, 84% 100%, 84% 78%, 70% 78%, 70% 100%, 30% 100%, 30% 78%, 16% 78%, 16% 100%);
}

.house-body {
  position: relative;
  display: flex;
  width: 82%;
  height: 100px;
  justify-content: space-around;
  align-items: flex-start;
  padding: 17px 9px 0;
  background: var(--wall-color, #f3ca79);
  border: 5px solid #34283f;
  border-top: 0;
  box-shadow: inset 0 -8px 0 rgba(52, 40, 63, 0.12);
}

.house-window {
  width: 29px;
  height: 27px;
  background: #a6eff0;
  border: 4px solid #34283f;
  box-shadow: inset -4px -4px 0 rgba(50, 80, 105, 0.25);
}

.house-door {
  align-self: flex-end;
  width: 30px;
  height: 54px;
  background: #80533e;
  border: 4px solid #34283f;
  border-bottom: 0;
}

.house-label {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  padding: 7px 10px;
  background: #20243a;
  border: 2px solid #aeb8a1;
  box-shadow: 4px 4px 0 rgba(8, 15, 24, 0.5);
}

.house-label strong {
  color: var(--pixel-yellow);
  font-size: 1rem;
  text-transform: uppercase;
}

.house-label small {
  color: #d3d5e7;
  font-size: 0.68rem;
}

.house-chat {
  --roof-color: #d95f62;
  --wall-color: #f0c879;
}

.house-notes {
  --roof-color: #9c75c7;
  --wall-color: #e6d7a1;
}

.house-news {
  --roof-color: #4a9d8e;
  --wall-color: #edbd79;
}

.house-upload {
  --roof-color: #5384c4;
  --wall-color: #e4d7ae;
}

.village-footer {
  margin-top: clamp(32px, 7vh, 64px);
  color: #dce5b5;
  font-size: 0.75rem;
  text-align: center;
}

.chat-page {
  display: flex;
  min-height: 100vh;
  height: auto;
  align-items: center;
  justify-content: center;
  padding: 76px 20px 20px;
  background-color: var(--pixel-bg);
  color: var(--pixel-green);
}

.chat-page #wrapper {
  width: min(92vw, 1100px);
  height: min(78vh, 760px);
  min-height: 440px;
  border: 4px solid var(--pixel-green);
  background: #0c100f;
  box-shadow: 8px 8px 0 var(--pixel-shadow);
}

.chat-page #sidebar {
  width: 220px;
  border-right: 3px solid var(--pixel-green);
  background: #111915;
}

.chat-page #topbar,
.chat-page #inputArea {
  border-color: var(--pixel-green);
  background: #111915;
}

.chat-page .room {
  padding: 6px 8px;
  border: 2px solid var(--pixel-green);
}

.chat-page .room.active {
  background: var(--pixel-green);
}

.chat-page .room-del {
  border: 2px solid var(--pixel-green);
}

.chat-page input[type="text"],
.chat-page button {
  border: 2px solid var(--pixel-green);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--pixel-shadow);
}

.chat-page button {
  color: #0b100b;
  background: var(--pixel-green);
}

.chat-page button:hover,
.chat-page .room-del:hover {
  color: #0b100b;
  background: var(--pixel-yellow);
}

.chat-page hr {
  border-color: var(--pixel-green) !important;
}

.news-page {
  min-height: 100vh;
  background-color: var(--pixel-bg);
  color: var(--pixel-ink);
}

.news-page header {
  border-bottom: 4px solid var(--pixel-cyan);
  background: #171a2d;
  box-shadow: 0 6px 0 var(--pixel-shadow);
}

.news-page header h1 {
  color: var(--pixel-yellow);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.news-page .container {
  max-width: 1000px;
}

.news-page .meta,
.news-page footer {
  color: var(--pixel-muted);
}

.news-page .card {
  margin-bottom: 16px;
  padding: 16px;
  color: var(--pixel-ink);
  background: var(--pixel-panel);
  border: 3px solid var(--pixel-cyan);
  border-radius: 0;
  box-shadow: 6px 6px 0 var(--pixel-shadow);
}

.news-page .card h3 a {
  color: var(--pixel-yellow);
}

.news-page .card p,
.news-page .card .small {
  color: var(--pixel-muted);
}

.news-page .tab,
.news-page .timer {
  display: inline-block;
  padding: 7px 10px;
  color: var(--pixel-cyan);
  background: var(--pixel-panel);
  border: 2px solid var(--pixel-cyan);
  border-radius: 0;
}

.news-page .tab.active,
.news-page .tab:hover {
  color: var(--pixel-bg);
  background: var(--pixel-cyan);
}

.news-page .timer {
  color: var(--pixel-yellow);
  border-color: var(--pixel-yellow);
}

.notes-page,
.admin-page,
.upload-page {
  min-height: 100vh;
  padding: 76px 16px 32px;
  background-color: var(--pixel-bg);
  color: var(--pixel-ink);
}

.notes-page {
  max-width: none;
  margin: 0;
}

.notes-page > .container,
.admin-page > .container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  background: var(--pixel-panel);
  border: 3px solid var(--pixel-cyan);
  border-radius: 0;
  box-shadow: 7px 7px 0 var(--pixel-shadow);
}

.notes-page #dropzone,
.upload-page #dropzone {
  color: var(--pixel-muted);
  background: #12152a;
  border: 3px dashed var(--pixel-pink);
  border-radius: 0;
}

.notes-page #dropzone.dragover,
.upload-page #dropzone.dragover {
  color: var(--pixel-green);
  border-color: var(--pixel-green);
}

.notes-page textarea {
  min-height: 300px;
  background: #101222;
}

.notes-page .muted,
.notes-page .hint {
  color: var(--pixel-muted);
}

.notes-page .note,
.upload-page .file {
  margin: 8px 0;
  padding: 10px;
  background: var(--pixel-panel);
  border: 2px solid var(--pixel-panel-light);
}

.notes-page .badge {
  color: var(--pixel-bg);
  background: var(--pixel-cyan);
  border-radius: 0;
}

.notes-page .badge.private {
  color: var(--pixel-bg);
  background: var(--pixel-pink);
}

.notes-page .delete,
.upload-page .delete {
  color: var(--pixel-pink);
}

.admin-page .container {
  max-width: 980px;
}

.admin-page h1,
.admin-page h2,
.notes-page h2,
.upload-page h2 {
  color: var(--pixel-yellow);
}

.admin-page .feed {
  border-color: var(--pixel-panel-light);
}

.admin-page .feed > div {
  overflow-wrap: anywhere;
}

.admin-page .pill {
  color: var(--pixel-bg);
  background: var(--pixel-cyan);
  border: 0;
  border-radius: 0;
}

.admin-page .msg {
  color: var(--pixel-green);
}

.admin-page .err {
  color: var(--pixel-pink);
}

.upload-page {
  max-width: 800px;
  margin: 0 auto;
}

.upload-page #progress {
  height: 14px;
  background: #252a48;
  border: 2px solid var(--pixel-cyan);
}

.upload-page #bar {
  background: var(--pixel-green);
}

@media (max-width: 650px) {
  .village-scene {
    min-height: 100svh;
    justify-content: flex-start;
    padding: 86px 16px 28px;
  }

  .village-intro {
    margin-bottom: 26px;
  }

  .village-houses {
    width: min(100%, 440px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .village-house,
  .village-house:nth-child(even) {
    transform: none;
  }

  .village-house:hover,
  .village-house:focus-visible,
  .village-house:nth-child(even):hover,
  .village-house:nth-child(even):focus-visible {
    transform: translateY(-5px);
  }

  .house-sprite {
    width: min(100%, 150px);
  }

  .house-roof {
    height: 56px;
  }

  .house-body {
    height: 84px;
    padding-top: 12px;
  }

  .house-window {
    width: 23px;
    height: 23px;
  }

  .house-door {
    width: 25px;
    height: 48px;
  }

  .village-footer {
    margin-top: 24px;
  }

  .chat-page {
    align-items: stretch;
    padding: 76px 12px 12px;
  }

  .chat-page #wrapper {
    width: 100%;
    height: auto;
    min-height: calc(100vh - 88px);
    flex-direction: column;
  }

  .chat-page #sidebar {
    width: 100%;
    max-height: 34vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 3px solid var(--pixel-green);
  }

  .chat-page #main {
    min-height: 42vh;
  }

  .news-page header .container {
    padding-left: 60px;
  }

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

  .notes-page > .container,
  .admin-page > .container {
    padding: 16px;
  }

  .menu-wrapper {
    top: 12px;
    left: 12px;
  }
}
