:root {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: #f3f5f7;
  background: #0b0d10;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% 15%, rgba(115, 170, 255, 0.12), transparent 28rem),
    linear-gradient(180deg, #10141a, #080a0d);
}
button, input, select { font: inherit; }
button {
  border: 1px solid #69727d;
  border-radius: 10px;
  background: #1b222b;
  color: inherit;
  padding: 0.8rem 1rem;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #27313d; }
button:disabled { opacity: 0.38; cursor: not-allowed; }
input {
  width: 12rem;
  border: 1px solid #59636e;
  border-radius: 8px;
  background: #0d1117;
  color: inherit;
  padding: 0.7rem;
}
.shell {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 5rem;
}
.hero { margin-bottom: 1.5rem; }
.hero h1 { margin: 0.25rem 0 0.7rem; font-size: clamp(2rem, 5vw, 4rem); }
.hero p { max-width: 48rem; color: #aab3bd; }
.eyebrow, .label {
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: #8fa0b3;
}
.panel {
  border: 1px solid #303842;
  border-radius: 16px;
  background: rgba(17, 22, 28, 0.9);
  padding: 1.15rem;
  margin-bottom: 1rem;
}
.controls {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.controls label { display: grid; gap: 0.35rem; }
.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hud > div {
  border: 1px solid #303842;
  border-radius: 12px;
  padding: 0.85rem;
  background: #11161c;
  display: grid;
  gap: 0.25rem;
}
.choices { display: grid; gap: 0.8rem; }
.choice {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.35rem;
}
.choice span { color: #aeb7c1; font-size: 0.9rem; }
.choice--safe { border-left: 5px solid #6cbf84; }
.choice--normal { border-left: 5px solid #d7b96f; }
.choice--danger { border-left: 5px solid #e06d6d; }
.result { border-style: dashed; }
.checkpoint { border-color: #a78bfa; }
.warning { color: #f0bf6f; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
ul { padding-left: 1.2rem; }
li { margin: 0.35rem 0; color: #c5cbd2; }
.muted { color: #8995a3; }
.end { border-color: #5e7ea5; }
@media (max-width: 700px) {
  .hud, .inventory-grid { grid-template-columns: 1fr; }
  .shell { padding-top: 1.5rem; }
}


.equipment-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  flex-wrap: wrap;
}
.equipment-heading h2 {
  margin: 0.25rem 0 0;
}
.build-tag-box {
  display: grid;
  gap: 0.3rem;
  min-width: min(100%, 20rem);
  text-align: right;
}
.equipment-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.equipment-slot {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  overflow: hidden;
  padding: 0.75rem;
  border: 1px solid #303842;
  border-radius: 12px;
  background: #0e1318;
}
.equipment-slot select {
  width: 100%;
  border: 1px solid #59636e;
  border-radius: 8px;
  background: #0d1117;
  color: inherit;
  padding: 0.65rem;
}
.equipment-slot select:disabled {
  opacity: 0.55;
}
.equipment-inventory-panel {
  margin-top: 1rem;
  border-top: 1px solid #303842;
  padding-top: 0.9rem;
}
.equipment-inventory-panel summary {
  cursor: pointer;
  color: #b7c0ca;
}
.equipment-owned--equipped {
  color: #9fc6ff;
}
@media (max-width: 700px) {
  .equipment-slots { grid-template-columns: 1fr; }
  .build-tag-box { text-align: left; }
}


.room-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  flex-wrap: wrap;
}
.room-heading h2 {
  margin: 0.25rem 0 0;
}
.furniture-picker {
  display: grid;
  gap: 0.4rem;
  margin: 1rem 0;
}
.furniture-picker select {
  width: 100%;
  border: 1px solid #59636e;
  border-radius: 8px;
  background: #0d1117;
  color: inherit;
  padding: 0.7rem;
}
.room-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 34rem);
  aspect-ratio: 1;
  margin: 1rem auto;
  padding: 4px;
  border: 1px solid #3a4652;
  border-radius: 12px;
  background: #080b0f;
}
.room-cell {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 6px;
  border: 1px dashed #303b46;
  background: #10161d;
  z-index: 1;
}
.room-cell:hover:not(:disabled) {
  background: #17212b;
}
.furniture-block {
  min-width: 0;
  min-height: 0;
  padding: 0.35rem;
  border-radius: 8px;
  border: 1px solid #7ca4d6;
  background: #1a2a3a;
  white-space: pre-line;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  z-index: 2;
}
.furniture-block:hover:not(:disabled) {
  background: #243a50;
}
.room-grid button:disabled {
  cursor: default;
}
.furniture-block:disabled {
  opacity: 1;
}
.room-cell:disabled {
  opacity: 0.55;
}
@media (max-width: 700px) {
  .room-grid {
    width: 100%;
    gap: 3px;
  }
  .room-cell {
    border-radius: 4px;
  }
  .furniture-block {
    padding: 0.2rem;
    font-size: 0.72rem;
  }
}


/* Mobile intrinsic-width guard for long equipment / furniture labels. */
.panel,
.equipment-heading > *,
.room-heading > *,
.equipment-slot,
.furniture-picker {
  min-width: 0;
}

.equipment-slot select,
.furniture-picker select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow: hidden;
}

.build-tag-box strong,
.equipment-owned,
.equipment-inventory-panel li {
  overflow-wrap: anywhere;
}

.item-detail-line {
  display: block;
  line-height: 1.45;
}

.item-detail-line + .item-detail-line {
  margin-top: 0.12rem;
}

.equipment-owned {
  padding: 0.45rem 0;
}


/* Shared equipment / furniture item picker. */
.item-picker-trigger {
  width: 100%;
  min-width: 0;
  text-align: left;
  display: grid;
  gap: 0.12rem;
  background: #0d1117;
}
.item-picker-trigger .item-detail-line {
  overflow-wrap: anywhere;
}
.item-picker-trigger-hint {
  color: #8995a3;
  font-size: 0.82rem;
}
.item-picker-dialog {
  width: min(42rem, calc(100% - 1.5rem));
  max-height: min(80vh, 46rem);
  padding: 0;
  border: 1px solid #46515d;
  border-radius: 18px;
  background: #10151b;
  color: inherit;
}
.item-picker-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}
.item-picker-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(80vh, 46rem);
}
.item-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #303842;
}
.item-picker-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}
.item-picker-close {
  padding: 0.35rem 0.65rem;
  font-size: 1.25rem;
  line-height: 1;
}
.item-picker-options {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
}
.item-picker-option {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.12rem;
  padding: 0.85rem;
  background: #0d1117;
}
.item-picker-option--selected {
  border-color: #7ca4d6;
  background: #172434;
}
.item-picker-option-header {
  color: #f3f5f7;
  font-weight: 700;
}
@media (max-width: 700px) {
  .item-picker-dialog {
    width: calc(100% - 1rem);
    max-height: 82vh;
    margin: auto;
  }
  .item-picker-sheet { max-height: 82vh; }
}
