:root {
  --silver: #c0c0c0;
  --silver-hi: #dfdfdf;
  --shade: #808080;
  --dark: #0a0a0a;
  --navy: #000080;
  --gold: #f5d33b;
  --link: #0000ee;
  --ui: Tahoma, "MS Sans Serif", Verdana, Geneva, sans-serif;
  --serif: "Times New Roman", Times, serif;
  --bevel-out: inset -1px -1px var(--dark), inset 1px 1px #fff, inset -2px -2px var(--shade), inset 2px 2px var(--silver-hi);
  --bevel-in: inset -1px -1px #fff, inset 1px 1px var(--shade), inset -2px -2px var(--silver-hi), inset 2px 2px var(--dark);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  margin: 0;
  background: #000;
  color: #000;
  font-family: var(--serif);
  font-size: 16px;
  padding-bottom: 56px;
  -webkit-text-size-adjust: 100%;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#page { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 24px 12px 32px; }

/* ---------- header ---------- */
header { text-align: center; color: var(--gold); }
h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  font-size: clamp(40px, 9vw, 64px);
  margin: 8px 0 0;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #7a5c00;
}
.welcome { margin: 2px 0 16px; font-size: 11px; color: #3d3410; letter-spacing: 1px; }
.ticker {
  display: block;
  background: var(--navy);
  color: #fff;
  font-family: "Courier New", monospace;
  font-weight: bold;
  padding: 4px 0;
  margin-bottom: 20px;
  border: 2px solid var(--gold);
}

/* ---------- layout ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
#posts { grid-column: 1 / -1; }
@media (max-width: 720px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Win95 window ---------- */
.win { background: var(--silver); box-shadow: var(--bevel-out); padding: 3px; font-family: var(--ui); font-size: 13px; }
.titlebar {
  background: linear-gradient(90deg, var(--navy), #1084d0);
  color: #fff;
  font-weight: bold;
  padding: 3px 3px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.tb-btns { display: flex; gap: 2px; }
.tb-btns b, .tb-x {
  width: 18px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--silver); color: #000; font: bold 11px/1 var(--ui); box-shadow: var(--bevel-out); border: 0; padding: 0;
}
.tb-x { cursor: pointer; font-size: 14px; }
.tb-x:active { box-shadow: var(--bevel-in); }
.win-body { padding: 10px; }

/* ---------- controls ---------- */
.btn {
  font: 13px var(--ui);
  color: #000;
  background: var(--silver);
  border: 0;
  box-shadow: var(--bevel-out);
  padding: 6px 14px;
  min-height: 30px;
  cursor: pointer;
}
.btn:active { box-shadow: var(--bevel-in); padding: 7px 13px 5px 15px; }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
.btn[disabled] { color: var(--shade); text-shadow: 1px 1px #fff; cursor: default; }
.btn-big { font-weight: bold; padding: 8px 22px; }

label { display: block; margin: 12px 0 4px; }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  font: 16px var(--ui); /* 16px stops iPhones from zooming in on focus */
  padding: 5px 6px;
  border: 0;
  background: #fff;
  box-shadow: var(--bevel-in);
  border-radius: 0;
  -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 90px; }
input[type="file"] { font: 13px var(--ui); max-width: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; cursor: pointer; }
.check input { margin: 2px 0 0; width: 16px; height: 16px; flex: none; }
.muted { color: #444; font-size: 12px; }
.hint { font-size: 12px; color: #333; margin: 6px 0 0; }
.error { color: #b00000; font-weight: bold; min-height: 0; margin: 10px 0 0; }
.error:empty { display: none; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.row-center { display: flex; justify-content: center; margin-top: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.where {
  background: #fff;
  box-shadow: var(--bevel-in);
  padding: 8px;
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.pix-pin { width: 14px; height: 20px; image-rendering: pixelated; flex: none; }
#photo-preview { display: block; max-width: 160px; max-height: 120px; margin-top: 8px; box-shadow: var(--bevel-in); padding: 2px; background: #fff; }

/* ---------- map ---------- */
.map-body { padding: 6px; }
#map { height: 380px; box-shadow: var(--bevel-in); background: #1a1a2e; }
@media (max-width: 720px) { #map { height: 300px; } }
.leaflet-container { font-family: var(--ui); }
.leaflet-tile-pane { filter: saturate(1.35) contrast(1.08); }
.leaflet-tile { image-rendering: pixelated; image-rendering: crisp-edges; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { border-radius: 0; background: var(--silver); box-shadow: var(--bevel-out); }
.leaflet-popup-content { font: 13px var(--ui); margin: 10px 12px; }
.legend { margin: 6px 2px 0; font-size: 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fuzz { display: inline-block; width: 14px; height: 14px; border: 2px dashed #ff2a2a; border-radius: 50%; }

/* ---------- guestbook panel (like the 1999 reference) ---------- */
.tabs { display: flex; gap: 2px; padding-left: 0; }
.tab { background: #9a9a9a; color: #5a5a5a; font: 13px Arial, sans-serif; padding: 5px 14px; min-width: 80px; }
.tab.on { background: var(--silver); color: #000; }
.panel-body { background: var(--silver); padding: 14px 16px 18px; min-height: 200px; }
.panel-body h2 { font-family: var(--serif); font-weight: bold; font-size: 26px; margin: 0 0 12px; }

.post { border-top: 1px solid var(--shade); box-shadow: 0 1px 0 #fff inset; padding: 14px 0; display: flow-root; }
.post:first-child { border-top: 0; box-shadow: none; padding-top: 4px; }
.post-photo {
  float: left; width: 110px; height: 110px; object-fit: cover; margin: 2px 12px 6px 0;
  cursor: zoom-in; background: #fff; padding: 2px; box-shadow: var(--bevel-in);
}
.post-head { margin: 0 0 2px; font-size: 18px; }
.post-head b { font-weight: bold; }
.post-meta { font-size: 14px; font-style: italic; color: #222; margin: 0 0 6px; }
.post-meta a { color: var(--link); }
.post-msg { margin: 0; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .del { float: right; margin-left: 8px; padding: 3px 8px; min-height: 0; font-size: 12px; }
.loading, .empty { font-style: italic; }
.new-flash { animation: flash 1.2s steps(2) 3; }
@keyframes flash { 50% { background: var(--gold); } }

/* ---------- footer ---------- */
footer { text-align: center; color: var(--gold); margin-top: 28px; font-size: 15px; }
.counter { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.odometer {
  font: bold 20px "Courier New", monospace;
  color: #ff3b3b;
  background: #111;
  border: 2px inset #666;
  padding: 2px 6px;
  letter-spacing: 4px;
  text-shadow: 0 0 4px #ff0000;
}
.made { font-size: 13px; margin-top: 10px; }

/* ---------- dialogs ---------- */
.dialog, .viewer, .admin {
  position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 380px);
}
.viewer { width: min(94vw, 720px); }
.viewer img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.admin { width: min(94vw, 560px); max-height: 80vh; display: flex; flex-direction: column; }
.admin[hidden], .dialog[hidden], .viewer[hidden] { display: none; }
.admin .win-body { overflow: auto; }
.admin-note { margin: 0 0 8px; }
#secret-list { background: #fff; box-shadow: var(--bevel-in); padding: 4px 10px; font-family: var(--serif); font-size: 15px; min-height: 80px; }
.pass-form { display: flex; gap: 14px; align-items: flex-start; }
.pass-form label { margin-top: 0; }
.pass-tort { width: 48px; image-rendering: pixelated; flex: none; margin-top: 4px; }

/* ---------- start menu + taskbar ---------- */
.start-menu { position: fixed; left: 2px; bottom: 40px; z-index: 60; display: flex; width: 230px; }
.start-menu[hidden] { display: none; }
.start-side { background: linear-gradient(0deg, var(--navy), #1084d0); width: 26px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.start-side span { writing-mode: vertical-rl; transform: rotate(180deg); color: #c0c0c0; font: bold 18px Arial, sans-serif; letter-spacing: 1px; }
.start-side b { color: #fff; }
.start-menu ul { list-style: none; margin: 0; padding: 2px; flex: 1; }
.start-menu a { display: block; padding: 10px 12px; color: #000; text-decoration: none; font: 14px var(--ui); }
.start-menu a:hover, .start-menu a:focus { background: var(--navy); color: #fff; outline: none; }

#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: 40px; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); height: calc(40px + env(safe-area-inset-bottom));
  background: var(--silver); box-shadow: inset 0 1px #fff, inset 0 2px var(--silver-hi);
  display: flex; align-items: center; gap: 6px; font-family: var(--ui); font-size: 13px;
}
.start { font-weight: bold; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; min-height: 30px; }
.start img { width: 18px; image-rendering: pixelated; }
.start[aria-expanded="true"] { box-shadow: var(--bevel-in); }
.amp { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.amp-btn { padding: 0; width: 30px; min-height: 30px; font-size: 12px; }
.amp-btn:active { padding: 1px 0 0 1px; }
.amp-screen {
  flex: 1; min-width: 0; height: 30px; margin-left: 4px; background: #000; color: #00ff3c;
  font: 13px "Courier New", monospace; box-shadow: var(--bevel-in); overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; padding: 0 6px;
}
.amp-screen span { display: inline-block; }
.amp-screen.scrolling span { animation: ampscroll 9s linear infinite; padding-left: 100%; }
@keyframes ampscroll { to { transform: translateX(-100%); } }
.tray { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 4px; box-shadow: var(--bevel-in); flex: none; }
.tray-tort { background: none; border: 0; padding: 2px; cursor: pointer; display: flex; }
.tray-tort img { width: 24px; image-rendering: pixelated; }
.tray-tort:focus-visible { outline: 1px dotted #000; }
@media (max-width: 480px) {
  .start { padding: 4px 6px; }
  .start-label { display: none; }
  #clock { display: none; }
}
.pix-marker { image-rendering: pixelated; }
#photo-preview[hidden] { display: none; }
.leaflet-bar { border: 0 !important; box-shadow: none !important; }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--silver); color: #000; border: 0 !important; border-radius: 0 !important;
  box-shadow: var(--bevel-out); margin-bottom: 2px; font-family: var(--ui);
}
.leaflet-bar a:active { box-shadow: var(--bevel-in); }

.bad-ideas {
  display: flex; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 6px;
  color: #000; font: 12px var(--ui); text-decoration: none; white-space: nowrap;
}
.bad-ideas:hover, .bad-ideas:focus-visible { text-decoration: underline; color: #8b0000; outline: none; }
.bad-ideas img {
  width: 16px; height: 16px; image-rendering: pixelated;
  filter: drop-shadow(0 0 2px #ff1a1a) drop-shadow(0 0 5px #ff0000);
  animation: redglow 2.4s ease-in-out infinite;
}
@keyframes redglow { 50% { filter: drop-shadow(0 0 1px #ff1a1a) drop-shadow(0 0 2px #ff0000); } }
@media (prefers-reduced-motion: reduce) { .bad-ideas img { animation: none; } }

.badwin {
  position: fixed; z-index: 55; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(96vw, 860px); height: min(82vh, 680px); display: flex; flex-direction: column;
}
.badwin[hidden] { display: none; }
.badwin-body { flex: 1; min-height: 0; padding: 4px 4px 2px; display: flex; }
.badwin iframe { flex: 1; width: 100%; border: 0; background: #fff; box-shadow: var(--bevel-in); padding: 2px; }
.tb-link {
  height: 16px; display: inline-flex; align-items: center; padding: 0 6px; margin-right: 2px;
  background: var(--silver); color: #000; font: 11px var(--ui); text-decoration: none; box-shadow: var(--bevel-out); white-space: nowrap;
}
.tb-link:active { box-shadow: var(--bevel-in); }
.statusbar { display: flex; justify-content: space-between; gap: 8px; padding: 2px 4px; font-size: 11px; }
.statusbar span { box-shadow: var(--bevel-in); padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 480px) { .statusbar span:first-child { display: none; } .badwin { height: 78vh; } }

/* ---------- tortoise panel ---------- */
.admin { width: min(96vw, 620px); }
.w95tabs { display: flex; gap: 0; margin-bottom: -2px; position: relative; z-index: 1; padding-left: 2px; }
.w95tab {
  font: 13px var(--ui); background: var(--silver); border: 0; padding: 6px 12px 5px; cursor: pointer;
  box-shadow: inset 1px 1px #fff, inset -1px 0 var(--dark), inset -2px 0 var(--shade);
  margin-top: 3px;
}
.w95tab[aria-selected="true"] { margin-top: 0; padding-bottom: 8px; font-weight: bold; }
.w95panel { box-shadow: var(--bevel-out); padding: 10px; }
.w95panel[hidden] { display: none; }
.sunken-list { background: #fff; box-shadow: var(--bevel-in); padding: 4px 10px; font-family: var(--serif); font-size: 15px; min-height: 80px; max-height: 46vh; overflow: auto; }
.scan-list { font: 12px var(--ui); padding: 2px; }
.scan-row { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-bottom: 1px solid #e4e4e4; }
.scan-when { flex: none; width: 120px; color: #333; }
.scan-where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-posted { flex: none; color: #006400; font-weight: bold; }
.scan-lurk { flex: none; color: #666; }
.truck-mini { width: 30px; height: 16px; image-rendering: pixelated; flex: none; }
.icon-pick { border: 1px solid var(--shade); box-shadow: 1px 1px #fff; margin: 8px 0; padding: 4px 10px 8px; display: flex; gap: 18px; flex-wrap: wrap; }
.icon-pick label { margin: 4px 0 0; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.icon-pick img { width: 48px; image-rendering: pixelated; }
.row-start { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
@media (max-width: 480px) { .scan-when { width: 92px; } .w95tab { padding: 6px 8px 5px; } }

/* ---------- host replies ---------- */
.reply { margin: 10px 0 0 24px; padding: 8px 10px; background: #e8e8e8; box-shadow: var(--bevel-in); clear: both; }
.reply-head { margin: 0 0 4px; font: bold 13px var(--ui); display: flex; align-items: center; gap: 6px; }
.reply-head img { width: 26px; image-rendering: pixelated; }
.reply-form { clear: both; margin-top: 10px; }
.reply-form textarea { min-height: 70px; }
.truck-marker { filter: drop-shadow(0 0 3px #000); }

/* ---------- konami ---------- */
body.comic, body.comic * { font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", cursive !important; }
#konami { position: fixed; left: 0; bottom: 48px; z-index: 70; pointer-events: none; width: 100%; height: 0; }
#konami[hidden] { display: none; }
#konami img { position: absolute; bottom: 0; left: 0; width: min(42vw, 300px); image-rendering: pixelated; transform: translateX(-110%); }
#konami .k-bubble {
  position: absolute; bottom: min(26vw, 190px); left: 0; transform: translateX(-110%);
  background: #fff; border: 2px solid #000; padding: 6px 10px; font: bold 16px "Comic Sans MS", cursive; white-space: nowrap;
}
#konami.go img, #konami.go .k-bubble { animation: crawl 15s steps(60) forwards; }
@keyframes crawl { from { left: 0; transform: translateX(-110%); } to { left: 100%; transform: translateX(10%); } }
@media (prefers-reduced-motion: reduce) {
  #konami.go img, #konami.go .k-bubble { animation: none; left: 50%; transform: translateX(-50%); }
}
