/* NopsieRun website: the game's pixel font and textures (all scaled up without blur). */

@font-face {
  font-family: "NopsiePixel";
  src: url("assets/PixelFont.ttf") format("truetype");
}

:root {
  --sky: #0daff7;
  --green: #2a9a00;
  --green-dark: #1b6b00;
  --blue: #0e80e6;
  --red: #e00000;
  --yellow: #ffe14d;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --board: #222222;
  --px: 3px;            /* one texture pixel */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "NopsiePixel", monospace;
  font-size: 22px;
  line-height: 1.35;
  color: var(--text);
  background: var(--sky);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
}

img { image-rendering: pixelated; }

a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Sky with the hills of the overworld (they stay at the bottom of the screen) ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--sky);
  overflow: hidden;
}

/* Each layer goes down to the bottom of the screen in its own color, so no sky shows between them. */
.hills {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background-repeat: repeat-x, no-repeat;
  background-size: 384px 96px, 100% 100%;
}

.hills-light {
  height: 206px;
  background-image: url("assets/hills_light.png"), linear-gradient(#088906, #088906);
  background-position: 0 0, 0 90px;
}

.hills-mid {
  height: 151px;
  background-image: url("assets/hills_mid.png"), linear-gradient(#016300, #016300);
  background-position: 130px 0, 0 90px;
}

.hills-dark {
  height: 96px;
  background-image: url("assets/hills_dark.png"), linear-gradient(#002d00, #002d00);
  background-position: 260px 0, 0 90px;
}

/* ---------- Top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.72);
  border-bottom: var(--px) solid #000;
}

.logo img {
  display: block;
  height: 75px;           /* 59x50 texture, 1.5x */
  width: auto;
}

.logo:hover img { transform: scale(1.05); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.tabs a, .btn {
  display: inline-block;
  font-family: inherit;
  font-size: 20px;
  color: #fff;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  padding: 8px 16px;
  border: 12px solid transparent;
  border-image: url("assets/btn_blue.png") 4 fill / 12px stretch;
  image-rendering: pixelated;
  background: none;
  cursor: pointer;
  line-height: 1.1;
  white-space: nowrap;
}

.tabs a { padding: 2px 8px; }

.tabs a.active, .btn.green { border-image-source: url("assets/btn_green.png"); }
.btn.red { border-image-source: url("assets/btn_red.png"); }
.btn.small { font-size: 17px; padding: 0 6px; }
.btn:hover, .tabs a:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active, .tabs a:active { transform: translateY(2px); }
.btn:disabled { filter: grayscale(0.8) brightness(0.8); cursor: default; transform: none; }

.session {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.session .me {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 20px;
}

.menu-button {
  display: none;
  font-size: 30px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

/* ---------- Page ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: 1150px;
  margin: 0 auto;
  padding: 26px 18px 60px;
}

h1, h2, h3 {
  font-weight: normal;
  margin: 0 0 14px;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
  line-height: 1.1;
}

h1 { font-size: 46px; }
h2 { font-size: 32px; }
h3 { font-size: 26px; }

/* The black board of the game (rounded pixel corners). */
.board {
  border: 12px solid transparent;
  border-image: url("assets/panel_black.png") 4 fill / 12px stretch;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.board.green { border-image-source: url("assets/panel_green.png"); }
.board.danger { max-width: 560px; }
.board.danger h2 { color: #ff6b6b; }

.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > * { flex: 1 1 320px; min-width: 0; }

.muted { color: var(--muted); }
.small { font-size: 17px; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.center { text-align: center; }
.right { margin-left: auto; }
.gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.title-line {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.title-line h1, .title-line h2 { margin: 0; }

/* ---------- Home ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 30px;
}

.hero > div { flex: 1; min-width: 0; }

/* Big PLAY NOW in the welcome box (bottom right) and docked at the bottom right of every page. */
.btn.play-big {
  align-self: flex-end;
  font-size: 40px;
  padding: 14px 30px;
  border-width: 15px;
  border-image-width: 15px;
}

.btn.play-docked {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  font-size: 30px;
  padding: 10px 22px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}
.hero img.big-logo { height: 200px; flex: none; }

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

/* ---------- News ---------- */

.news-picture {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #6e6e6e;
  display: block;
  margin: 6px 0 12px;
  image-rendering: auto;
}

.date { color: var(--yellow); font-size: 17px; }

/* ---------- Forms ---------- */

input, textarea, select {
  font-family: inherit;
  font-size: 20px;
  color: #000;
  background: #fff;
  border: var(--px) solid #000;
  padding: 8px 10px;
  width: 100%;
  outline: none;
}

input:focus, textarea:focus, select:focus { border-color: var(--yellow); }
textarea { resize: vertical; min-height: 110px; }
label { display: block; margin: 10px 0 4px; }

.form { max-width: 520px; margin: 0 auto; }
.form .btn { margin-top: 16px; }
.error { color: #ff6b6b; min-height: 1.3em; margin-top: 8px; }

/* ---------- Lists ---------- */

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: rgba(255, 255, 255, 0.07); }
.list-item.selected { background: rgba(42, 154, 0, 0.45); }

.avatar {
  width: 48px;
  height: 48px;
  flex: none;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #777;
  margin-right: 6px;
}

.dot.on { background: #3cff3c; }

.badge {
  display: inline-block;
  font-size: 16px;
  padding: 2px 8px;
  background: #555;
  color: #fff;
  white-space: nowrap;
}

.badge.admin { background: var(--red); }
.badge.moderator { background: #e07b00; }
.badge.bug { background: #b3261e; }
.badge.feedback { background: #2f6fd6; }
.badge.status-open { background: #666; }
.badge.status-progress { background: #e0a800; color: #000; }
.badge.status-planned { background: #2f6fd6; }
.badge.status-fixed { background: #2a9a00; }
.badge.status-intended { background: #7b4cc2; }
.badge.status-other { background: #444; }

.count { background: var(--red); color: #fff; font-size: 16px; padding: 0 7px; }

/* ---------- Social ---------- */

.social { display: grid; grid-template-columns: 360px 1fr; gap: 18px; }

.chat-log {
  height: 380px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  margin-bottom: 10px;
}

.message { margin: 6px 0; overflow-wrap: anywhere; }
.message .from { color: var(--yellow); }
.message.mine .from { color: #7dff7d; }
.message.held .body { color: #ff9a2e; }
.chat-send { display: flex; gap: 8px; }
.chat-send input { flex: 1; }
.chat-send .btn { margin: 0; }

/* ---------- Forum ---------- */

.thread-row .title { font-size: 22px; }
.thread-row .info { font-size: 16px; color: var(--muted); }
.likes { font-size: 18px; white-space: nowrap; }
.like-button { background: none; border: none; color: #fff; font-family: inherit; font-size: 20px; cursor: pointer; padding: 2px 6px; }
.like-button.liked { color: #ff5577; }
.like-button:disabled { cursor: default; }
.comment { padding: 10px 0; border-bottom: 2px solid rgba(255, 255, 255, 0.12); }
.comment:last-child { border-bottom: none; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; flex: 1 1 200px; }

/* ---------- Shop ---------- */

.soon {
  text-align: center;
  padding: 50px 10px;
}

.soon img { height: 96px; animation: hop 1.4s ease-in-out infinite; }
.soon h1 { font-size: 64px; margin-top: 20px; }

/* ---------- Ground at the bottom (grass and dirt of the game) ---------- */

.ground {
  height: 144px;
  background:
    url("assets/grass.png") repeat-x top left / 48px 48px,
    url("assets/dirt.png") repeat left 0 top 48px / 48px 48px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16px;
}

.ground-text { font-size: 18px; text-shadow: 2px 2px 0 #000; }

/* ---------- PLAY NOW window ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay[hidden] { display: none; }

.window {
  position: relative;
  width: 100%;
  max-width: 620px;
  text-align: center;
  padding: 24px 24px 28px;
  margin: 0;
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.window .close {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.window .close img { width: 48px; height: 48px; display: block; }
.window .close:hover { filter: brightness(1.2); }

.choices {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.choices .btn { font-size: 28px; padding: 10px 22px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 140%);
  transition: transform 0.25s;
  z-index: 50;
  border: 12px solid transparent;
  border-image: url("assets/panel_black.png") 4 fill / 12px stretch;
  padding: 6px 16px;
  max-width: 90vw;
}

.toast.show { transform: translate(-50%, 0); }
.toast.bad { color: #ff7b7b; }

.loading::after {
  content: "";
  animation: dots 1s steps(4) infinite;
}

@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; }
}

/* ---------- Small screens ---------- */

@media (max-width: 980px) {
  .menu-button { display: block; margin-left: auto; }
  .top { flex-wrap: wrap; }
  .tabs { display: none; order: 5; flex-basis: 100%; flex-direction: column; }
  .tabs.open { display: flex; }
  .session { margin-left: 0; }
  .social { grid-template-columns: 1fr; }
  h1 { font-size: 36px; }
  .hero { flex-wrap: wrap; justify-content: center; }
  .btn.play-big { align-self: center; font-size: 30px; }
  .btn.play-docked { font-size: 22px; right: 12px; bottom: 12px; padding: 6px 14px; }
  .hero img.big-logo { height: 140px; }
}
