:root {
  color-scheme: light;
  --ink: #2a2118;
  --cream: #f3e6d0;
  --paper: #f7efe2;
  --line: #8a6248;
  --wood: #6b3e2e;
  --carpet: #c4b49a;
  --teal: #1f8a8a;
  --hint: #3a2a22;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #231910;
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

#hint, #stats {
  margin: 8px 8px 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--hint);
  color: var(--cream);
  font-size: 15px;
  line-height: 1.4;
}

#hint {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stats {
  margin: 8px;
}

#nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
}

#nav-views, #nav-floors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#nav button, .item button, .plot button, .confirm button {
  font: inherit;
  color: var(--cream);
  background: transparent;
  border: 1px solid var(--line);
  padding: 6px 12px;
  cursor: pointer;
}

#nav button.on, .item button, .plot button, .confirm button {
  background: var(--teal);
  border-color: #146c6c;
  color: #f4fff8;
}

#nav button:focus-visible,
.station:focus-visible,
.item button:focus-visible,
.plot button:focus-visible,
.confirm button:focus-visible {
  outline: 2px solid #f3e6d0;
  outline-offset: 2px;
}

#stage {
  flex: 1;
  min-height: 0;
  margin: 0 8px;
  display: flex;
}

.view {
  flex: 1;
  min-height: 420px;
  min-width: 0;
}

.view[hidden] { display: none !important; }

#office {
  display: flex;
  border: 1px solid var(--line);
  background: var(--carpet);
}

#break {
  width: 280px;
  flex: none;
  padding: 12px;
  background: var(--wood);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#break h2, #room h2, #shop h2, #garden h2, #basement h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

#break h2 { color: var(--cream); }

.station {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 8px;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #e7d7bc;
  font: inherit;
  cursor: pointer;
}

.station:hover { background: #fff8ee; }

.bar {
  --hue: 0;
  position: relative;
  display: block;
  height: 16px;
  background: hsl(var(--hue), 62%, 32%);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: hsl(var(--hue), 70%, 46%);
}

.bar-label {
  position: relative;
  z-index: 1;
  display: block;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.station-name { font-weight: 650; }

.station-detail {
  color: #5c4c3a;
  font-size: 13px;
}

#room {
  flex: 1;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--carpet);
  background-image:
    linear-gradient(rgba(90, 70, 48, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 70, 48, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
}

.room-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.plants {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.plant {
  width: 18px;
  height: 18px;
  background: #2f7d45;
  color: transparent;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.desks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.desk {
  position: relative;
  min-height: 96px;
  padding: 8px;
  background: #efe2cc;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.desk.empty {
  background: transparent;
  color: #6d5a45;
  border-style: dashed;
  justify-content: center;
}

.meter {
  position: relative;
  height: 28px;
  margin-bottom: 8px;
  background: #243038;
  border: 3px solid var(--teal);
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #3ec6c6;
}

.pay-pop {
  position: absolute;
  left: 12px;
  top: 6px;
  z-index: 2;
  color: #1e8f45;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 0 2px #f7efe2, 0 0 2px #f7efe2;
  animation: pay-rise 1.15s ease-out forwards;
}

.pay-mark {
  color: #23a84f;
}

@keyframes pay-rise {
  from { transform: translateY(0); opacity: 0.95; }
  to { transform: translateY(-28px); opacity: 0; }
}

.who { font-weight: 650; }

.badges { display: flex; gap: 4px; }

.badge {
  padding: 1px 6px;
  font-size: 11px;
  background: #d9cbb3;
  color: #6a5b4a;
}

.badge.on {
  background: var(--teal);
  color: #f4fff8;
}

#shop, #garden, #basement {
  display: block;
  overflow: auto;
  padding: 16px;
  background: var(--cream);
  border: 1px solid var(--line);
}

.shop-floor { margin-bottom: 18px; }

.shop-floor h2 { margin-bottom: 4px; }

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.75rem;
  grid-template-areas:
    "name buy"
    "detail buy";
  gap: 2px 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e0d0b8;
}

.item .name {
  grid-area: name;
  font-weight: 650;
}

.item .detail {
  grid-area: detail;
  color: #5c4c3a;
  font-size: 14px;
}

.item button {
  grid-area: buy;
  justify-self: stretch;
  align-self: center;
  width: 8.75rem;
  height: 2.4rem;
  padding: 0 8px;
  white-space: nowrap;
  text-align: center;
}

.item button.short { opacity: 0.55; }

.empty-floor {
  margin: 8px 0 0;
  color: #5c4c3a;
}

.confirm {
  margin-bottom: 16px;
  padding: 12px;
  border: 2px solid var(--teal);
  background: var(--paper);
}

.confirm p { margin: 0 0 10px; }

.confirm button + button { margin-left: 8px; }

.plots, .machines {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding: 0;
}

.plot {
  padding: 12px;
  background: #efe2cc;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grow {
  height: 10px;
  background: #d7c4a3;
}

.grow span {
  display: block;
  height: 100%;
  width: 0;
  background: #c47a2c;
}

.machines {
  display: block;
  list-style: none;
}

.machines li {
  padding: 8px 0;
  border-bottom: 1px solid #e0d0b8;
}

.vat-bar { margin-top: 12px; max-width: 360px; }

@media (max-width: 800px) {
  #office { flex-direction: column; }
  #break { width: auto; }
  .desks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #hint { white-space: normal; }
}
