* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #7ec8e8 0%, #9ad48a 48%, #5aaa50 100%);
  font-family: 'Press Start 2P', monospace;
  color: #fff8ef;
  image-rendering: pixelated;
}

#game-container {
  position: relative;
  border: 4px solid #c47838;
  border-radius: 4px;
  box-shadow:
    0 0 0 4px #5a3a18,
    0 0 40px rgba(80, 140, 60, 0.35),
    inset 0 0 60px rgba(0, 0, 0, 0.2);
  background: #203018;
}

#home-link {
  position: absolute;
  top: -28px;
  left: 0;
  font-size: 7px;
  color: #5a3a10;
  text-decoration: none;
}

#home-link:hover {
  color: #fff;
}

#fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20;
  width: 34px;
  height: 34px;
  border: 2px solid #c47838;
  border-radius: 4px;
  background: rgba(32, 48, 24, 0.88);
  color: #f0d060;
  font: 12px 'Press Start 2P', monospace;
  line-height: 1;
  cursor: pointer;
}

#fullscreen-btn:hover,
#fullscreen-btn:focus-visible {
  background: #f0d060;
  color: #203018;
}

#game-container:fullscreen,
#game-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #203018;
}

#game-container:fullscreen #game,
#game-container:-webkit-full-screen #game {
  width: min(100vw, calc((100vh - 64px) * 5 / 3));
  height: min(calc(100vh - 64px), calc(100vw * 3 / 5));
  margin: 0 auto;
}

#game-container:fullscreen #action-bar,
#game-container:-webkit-full-screen #action-bar {
  margin-top: auto;
}

#game-container:fullscreen #controls-help,
#game-container:-webkit-full-screen #controls-help {
  bottom: 8px;
}

#game-container:fullscreen #home-link,
#game-container:-webkit-full-screen #home-link {
  top: 8px;
  left: 8px;
  z-index: 20;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 50px;
  pointer-events: none;
}

.hud-row {
  display: flex;
  gap: 16px;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 #000;
  font-size: 8px;
  line-height: 1.6;
  flex-wrap: wrap;
}

#time-label {
  color: #f4d35e;
}

#money-label {
  color: #95d5b2;
}

#job-label {
  color: #90e0ef;
}

.bars {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bar i {
  font-style: normal;
  font-size: 9px;
  text-shadow: 1px 1px 0 #000;
}

.bar span {
  display: block;
  width: 52px;
  height: 8px;
  background: #111;
  border: 2px solid #000;
}

.bar b {
  display: block;
  height: 100%;
  width: 50%;
  background: #2a9d8f;
}

#energy-bar { background: #f4d35e; }
#hunger-bar { background: #e76f51; }
#mood-bar { background: #90e0ef; }
#hygiene-bar { background: #4cc9f0; }
#health-bar { background: #e63946; }

#pet-label,
#prompt-label,
#toast-label {
  font-size: 7px;
  line-height: 1.6;
  text-shadow: 2px 2px 0 #000;
  max-width: 78%;
}

#pet-label {
  color: #e9c46a;
  margin-bottom: 4px;
}

#prompt-label {
  color: #fff;
}

#toast-label {
  color: #f4d35e;
  margin-top: 4px;
  min-height: 12px;
}

.hidden {
  display: none !important;
}

#action-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: #3d6b38;
}

#action-bar button {
  font-family: inherit;
  font-size: 6px;
  line-height: 1.5;
  padding: 8px 10px;
  background: #c47838;
  border: 2px solid #3a2010;
  color: #fff8e0;
  cursor: pointer;
  border-radius: 2px;
}

#baby-btn {
  background: #e07a9a;
  border-color: #8a3050;
}

#action-bar button:hover {
  background: #e09048;
}

#pause-btn {
  background: #6a4428;
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 40, 16, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  background: #fff6d8;
  border: 4px solid #c47838;
  box-shadow: 0 0 0 2px #5a3a18, 4px 4px 0 #3a2010;
  padding: 22px;
  max-width: 92%;
  max-height: 90%;
  overflow: auto;
  font-size: 8px;
  line-height: 1.9;
  text-align: center;
  color: #402010;
}

#overlay-content:has(.cal-grid) {
  max-width: 540px;
}

#overlay-content h2 {
  color: #c04028;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.5;
}

#overlay-content h3 {
  color: #c47838;
  font-size: 8px;
  margin: 12px 0 8px;
}

#overlay-content p {
  margin-bottom: 8px;
}

#overlay-content .muted {
  color: #7a5a38;
  font-size: 7px;
}

#overlay-content .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  font-size: 7px;
  padding: 4px 0;
  border-bottom: 1px solid #e0c890;
}

#overlay-content input[type="text"] {
  font-family: inherit;
  font-size: 8px;
  padding: 8px;
  width: 220px;
  max-width: 100%;
  margin: 8px 0 12px;
  border: 2px solid #c47838;
  background: #fffdf4;
  color: #402010;
}

.join-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.spouse-log {
  text-align: left;
  max-height: 168px;
  overflow-y: auto;
  background: #fffdf4;
  border: 2px solid #c47838;
  padding: 8px;
  margin: 8px 0;
}

.spouse-line {
  font-size: 7px;
  line-height: 1.7;
  margin-bottom: 8px;
}

.spouse-line b {
  display: block;
  color: #c47838;
  margin-bottom: 2px;
}

.spouse-line.you b {
  color: #3d6b4f;
}

.spouse-search {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}

.spouse-search input[type="search"],
.spouse-search input[type="text"] {
  font-family: inherit;
  font-size: 8px;
  padding: 10px 14px;
  width: 280px;
  max-width: 100%;
  margin: 0;
  border: 2px solid #c47838;
  border-radius: 18px;
  background: #fffdf4;
  color: #402010;
}

.spouse-search input[type="search"]::placeholder,
.spouse-search input[type="text"]::placeholder {
  color: #a08058;
}

.spouse-search button {
  margin-top: 0;
  border-radius: 18px;
  padding: 10px 14px;
}

#overlay-content .join-row button {
  margin-top: 0;
}

#room-input {
  width: 160px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.choice-list,
.hair-list,
.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.hair-list {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

#overlay-content button {
  font-family: inherit;
  font-size: 7px;
  line-height: 1.6;
  padding: 10px 12px;
  background: #3d9e4a;
  border: 2px solid #204818;
  color: #fff8e0;
  cursor: pointer;
  border-radius: 2px;
}

#overlay-content button:hover {
  background: #52c45e;
}

#overlay-content button.alt {
  background: #c04028;
  border-color: #601810;
}

#overlay-content button.ghost {
  background: #c47838;
  border-color: #5a3a18;
}

#controls-help {
  position: absolute;
  bottom: -36px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 6px;
  color: #3a5a20;
}

.swatch {
  width: 28px;
  height: 28px;
  border: 3px solid #000;
  cursor: pointer;
  padding: 0 !important;
}

.swatch.on {
  outline: 2px solid #f4d35e;
}

.people-list {
  text-align: left;
  margin: 8px 0;
}

.warn {
  color: #e76f51;
}

.good {
  color: #3d9e4a;
}

#controls-help kbd,
#action-bar kbd {
  background: #5a3a18;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid #c47838;
  color: #fff8e0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin: 10px 0 12px;
  min-width: 300px;
}

.cal-head {
  color: #7a5a38;
  font-size: 6px;
  padding: 4px 0 2px;
}

.cal-cell {
  min-height: 34px;
  background: #fffdf4;
  border: 1px solid #e0c890;
  padding: 3px 2px;
  font-size: 6px;
  line-height: 1.35;
  color: #402010;
  text-align: left;
}

.cal-cell.today {
  border: 2px solid #c04028;
  background: #ffe8b0;
}

.cal-cell.special {
  background: #ffe0ea;
  border-color: #e07a9a;
}

.cal-cell.today.special {
  background: #ffd0c0;
}

.cal-num {
  display: block;
  color: #c04028;
  margin-bottom: 2px;
}

.cal-ev {
  display: block;
  color: #8a3050;
  font-size: 5px;
}
