:root {
  --face:    #C0C0C0;   /* button / window grey  */
  --hi:      #FFFFFF;   /* bevel highlight       */
  --lo:      #808080;   /* bevel shadow          */
  --shadow:  #000000;   /* bevel outer shadow    */
  --light:   #DFDFDF;   /* bevel inner highlight */
  --navy:    #000080;
  --sky:     #1084D0;
  --desktop: #3A6EA5;
  --white:   #FFFFFF;
  --text:    #000000;

  --ui:    Tahoma, "MS Sans Serif", Verdana, Geneva, sans-serif;
  --comic: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive;
  --times: "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: clamp(0px, 3vw, 34px) clamp(0px, 3vw, 20px);
  background: var(--desktop);
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text);
}

/* ---------- bevels ---------- */
.raised {
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo);
}
.sunken {
  background: var(--white);
  border: 2px solid;
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--light);
}

/* ---------- window ---------- */
.window { max-width: 760px; margin: 0 auto; }

.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px;
  padding: 3px 3px 3px 6px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--sky) 100%);
  color: var(--white);
  font-weight: bold;
  font-size: 13px;
}
.titlebar .name { flex: 1; }

.tb-btns { display: flex; gap: 2px; }
.tb-btn {
  width: 18px; height: 16px;
  display: grid;
  place-items: center;
  background: var(--face);
  color: var(--text);
  border: 1px solid;
  border-color: var(--hi) var(--shadow) var(--shadow) var(--hi);
  box-shadow: inset 1px 1px 0 var(--light), inset -1px -1px 0 var(--lo);
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  cursor: default;
}

button.tb-btn {
  font-family: var(--ui);
  padding: 0;
  cursor: pointer;
}
button.tb-btn:active {
  border-color: var(--shadow) var(--hi) var(--hi) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--lo), inset -1px -1px 0 var(--light);
}
button.tb-btn:focus-visible { outline: 1px dotted var(--white); outline-offset: 1px; }

/* ---------- modal dialog ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .28);
}

.dialog {
  width: min(360px, 100%);
  animation: dlgpop .11s steps(2, end);
}
@keyframes dlgpop { from { transform: scale(.88); } to { transform: scale(1); } }

.dialog .titlebar { margin: 3px; }

.dialog-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 14px;
  text-align: left;
}
.dialog-icon { flex: none; width: 32px; height: 32px; line-height: 0; }
.dialog-icon svg { width: 100%; height: 100%; }

.dialog-text {
  margin: 0;
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  padding: 0 18px 18px;
}
.dialog-actions .btn95 { min-width: 88px; }

/* ---------- menu bar ---------- */
.menubar {
  display: flex;
  gap: 2px;
  margin: 0 3px 3px;
  padding: 1px 2px;
  position: relative;
  z-index: 20;
}

.menu-root { position: relative; }

.menu-label {
  padding: 2px 8px;
  background: transparent;
  border: 0;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.menu-label:hover,
.menu-root.open .menu-label { background: var(--navy); color: var(--white); }
.menu-label:focus-visible { outline: 1px dotted var(--text); outline-offset: -3px; }

.menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 172px;
  padding: 2px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo),
              2px 2px 0 rgba(0, 0, 0, .28);
  text-align: left;
}
.menu-root.open .menu { display: block; }

.menu-item {
  display: block;
  width: 100%;
  padding: 4px 20px 4px 12px;
  background: transparent;
  border: 0;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
a.menu-item:hover,
button.menu-item:hover { background: var(--navy); color: var(--white); }
.menu-item:focus-visible { outline: 1px dotted var(--text); outline-offset: -3px; }

/* the classic embossed grey of an unavailable command */
.menu-item.disabled {
  color: var(--lo);
  text-shadow: 1px 1px 0 var(--hi);
  cursor: default;
}

.menu-sep {
  height: 0;
  margin: 3px 2px;
  border-top: 1px solid var(--lo);
  border-bottom: 1px solid var(--hi);
}

.viewport {
  margin: 0 3px 3px;
  padding: clamp(18px, 4vw, 34px) clamp(14px, 4vw, 40px) 30px;
  text-align: center;
}

/* ---------- masthead ---------- */
h1 {
  font-family: var(--times);
  font-weight: bold;
  color: var(--navy);
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  line-height: 1.05;
  margin: 8px 0 4px;
}
h1.small { font-size: clamp(1.9rem, 6vw, 3rem); }
/* no tagline underneath, so the heading carries its own breathing room */
h1.lone { margin-bottom: 26px; }

.tagline {
  font-family: var(--comic);
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--navy);
  margin: 0 0 26px;
}

/* ---------- buttons ---------- */
.btnbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 auto 30px;
}
.btn95 {
  display: inline-block;
  min-width: 108px;
  padding: 7px 14px;
  background: var(--face);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid;
  border-color: var(--hi) var(--shadow) var(--shadow) var(--hi);
  box-shadow: inset 1px 1px 0 var(--light), inset -1px -1px 0 var(--lo);
}
.btn95:hover { background: #C9C9C9; }
.btn95:active {
  border-color: var(--shadow) var(--hi) var(--hi) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--lo), inset -1px -1px 0 var(--light);
  padding: 8px 13px 6px 15px;
}
.btn95:focus-visible { outline: 1px dotted var(--text); outline-offset: -5px; }

/* ---------- guinea pigs ---------- */
.pet {
  position: relative;
  width: clamp(84px, 19vw, 112px);
  aspect-ratio: 16 / 18;
}
.pet svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

/* guinea pig with a flag pinned over its shoulder */
.petbox { position: relative; display: block; }
.petbox .flag {
  position: absolute;
  top: 2px;
  right: -6px;
  width: 46%;
  line-height: 0;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .45));
}
.petbox .flag svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #2A2A2A;
  background: var(--white);
}

/* two frames alternating on a hard step — the same trick a GIF uses */
@keyframes petflip { 0%, 49.99% { opacity: 1; } 50%, 100% { opacity: 0; } }
.pet .fa, .pet .fb { animation: petflip var(--rate, .9s) steps(1, end) infinite; }
.pet .fb { animation-delay: calc(var(--rate, .9s) / -2); }

.pets {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 26px);
  margin-bottom: 30px;
}
.pet-wrap { display: flex; flex-direction: column; align-items: center; }
.pet-caption {
  font-family: var(--comic);
  font-size: 12px;
  margin-top: 6px;
  color: var(--navy);
}

/* ---------- body copy ---------- */
.copy {
  max-width: 540px;
  margin: 0 auto 26px;
  text-align: left;
  font-family: var(--comic);
  font-size: clamp(.98rem, 2.3vw, 1.14rem);
  line-height: 1.5;
  color: var(--text);
}
.copy p { margin: 0 0 16px; }
.copy p:last-child { margin-bottom: 0; }
.copy.center { text-align: center; }

/* ---------- country grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 9px;
  margin: 0 0 26px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 5px 7px;
  background: var(--face);
  color: var(--text);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  border: 2px solid;
  border-color: var(--hi) var(--shadow) var(--shadow) var(--hi);
  box-shadow: inset 1px 1px 0 var(--light), inset -1px -1px 0 var(--lo);
}
.tile:hover { background: #C9C9C9; }
.tile:active,
.tile.picked {
  border-color: var(--shadow) var(--hi) var(--hi) var(--shadow);
  box-shadow: inset 1px 1px 0 var(--lo), inset -1px -1px 0 var(--light);
}
.tile.picked { background: #B6C6DC; }
.tile:focus-visible { outline: 1px dotted var(--text); outline-offset: -5px; }

.tile .petbox { width: 100%; max-width: 82px; }
.tile .pet { width: 100%; }

.tile .label { line-height: 1.15; }
.tile .cnt {
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.tile.picked .cnt { color: var(--text); }

/* ---------- message form ---------- */
.form95 {
  max-width: 480px;
  margin: 0 auto 26px;
  text-align: left;
}

/* the etched Win95 group box, with its label notched into the border */
.groupbox {
  border: 1px solid var(--lo);
  box-shadow: inset -1px -1px 0 var(--hi), 1px 1px 0 var(--hi);
  padding: 6px 16px 16px;
  margin: 0;
  min-width: 0;
}
.groupbox > legend {
  padding: 0 6px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: bold;
  color: var(--navy);
  background: var(--white);
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--ui);
  font-size: 12px;
}
.field .opt { color: var(--lo); }

.form95 input[type="text"],
.form95 textarea {
  display: block;
  width: 100%;
  padding: 4px 6px;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  border: 2px solid;
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--light);
  border-radius: 0;
}
.form95 textarea { resize: vertical; line-height: 1.4; }
.form95 input[type="text"]:focus,
.form95 textarea:focus { outline: 1px dotted var(--navy); outline-offset: -4px; }
.form95 ::placeholder { color: #9AA0A6; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.form-actions .btn95 { min-width: 96px; }
.form-actions .btn95:disabled { color: var(--lo); text-shadow: 1px 1px 0 var(--hi); cursor: default; }

.counter-text {
  font-family: var(--ui);
  font-size: 11px;
  color: var(--lo);
  font-variant-numeric: tabular-nums;
}

/* honeypot — off-screen rather than hidden, so bots still fill it in */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- wells / counter ---------- */
.well {
  display: inline-block;
  padding: 9px 16px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
  box-shadow: inset 1px 1px 0 var(--shadow), inset -1px -1px 0 var(--light);
  font-family: var(--ui);
  font-size: 13px;
}
.odometer {
  display: inline-block;
  background: #000000;
  border: 1px solid var(--lo);
  padding: 3px 8px;
  margin-left: 5px;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  letter-spacing: 3px;
  color: #4DFF4D;
  font-variant-numeric: tabular-nums;
}
.smallprint {
  margin: 14px 0 0;
  font-family: var(--ui);
  font-size: 11px;
  color: #444444;
}

/* ---------- status bar ---------- */
.statusbar { display: flex; gap: 3px; margin: 0 3px 3px; }
.status-cell {
  padding: 3px 7px;
  font-size: 11px;
  border: 1px solid;
  border-color: var(--lo) var(--hi) var(--hi) var(--lo);
}
.status-cell.grow { flex: 1; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  .pet .fa { animation: none; opacity: 1; }
  .pet .fb { animation: none; opacity: 0; }
}
