:root {
  --bg: #edf1ef;
  --surface: rgba(255, 254, 251, 0.92);
  --surface-solid: #fffefb;
  --ink: #24312f;
  --ink-soft: #5f6c68;
  --muted: #89938f;
  --accent: #4f7c72;
  --accent-strong: #315f56;
  --accent-soft: #e5f0ec;
  --accent-wash: rgba(176, 209, 198, 0.3);
  --line: rgba(47, 76, 69, 0.14);
  --line-strong: rgba(47, 76, 69, 0.28);
  --shadow: 0 24px 70px rgba(38, 66, 59, 0.13);
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

body[data-room-id="bathroom"] {
  --bg: #edf3f5;
  --accent: #5687a0;
  --accent-strong: #376b85;
  --accent-soft: #e5f1f6;
  --accent-wash: rgba(179, 216, 230, 0.32);
}

body[data-room-id="basement"] {
  --bg: #1f1a26;
  --surface: rgba(42, 34, 51, 0.94);
  --surface-solid: #2b2333;
  --ink: #f4eaf1;
  --ink-soft: #c8b8c4;
  --muted: #9f8f9b;
  --accent: #d795bc;
  --accent-strong: #efb8d6;
  --accent-soft: #443142;
  --accent-wash: rgba(164, 91, 136, 0.28);
  --line: rgba(238, 194, 218, 0.14);
  --line-strong: rgba(238, 194, 218, 0.3);
  --shadow: 0 24px 70px rgba(8, 5, 12, 0.36);
}

body[data-room-id="basement"] .room-header {
  background: rgba(31, 26, 38, 0.84);
}

body.is-private-space-pending main {
  visibility: hidden;
}

body.is-private-space-pending::after {
  position: fixed;
  inset: 68px 0 0;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  content: "正在确认地下室的主人身份……";
  background: var(--bg);
  font-family: var(--serif);
}

body[data-room-id="study"] {
  --bg: #f0ede7;
  --accent: #8a6b4f;
  --accent-strong: #6b4d35;
  --accent-soft: #f2e9dc;
  --accent-wash: rgba(222, 199, 166, 0.32);
}

body[data-room-id="workshop"] {
  --bg: #eceff1;
  --accent: #647582;
  --accent-strong: #435864;
  --accent-soft: #e5ebee;
  --accent-wash: rgba(186, 201, 209, 0.34);
}

body[data-room-id="game-room"] {
  --bg: #eeebf5;
  --accent: #775fc1;
  --accent-strong: #5b42aa;
  --accent-soft: #ede7ff;
  --accent-wash: rgba(199, 184, 239, 0.32);
}

body[data-room-id="gym"] {
  --bg: #eef0eb;
  --accent: #6c8061;
  --accent-strong: #4f6745;
  --accent-soft: #e9f0e4;
  --accent-wash: rgba(192, 210, 181, 0.34);
}

body[data-room-id="kitchen"] {
  --bg: #f4eee7;
  --accent: #a06e51;
  --accent-strong: #7d5037;
  --accent-soft: #f7e9dd;
  --accent-wash: rgba(232, 198, 171, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(255, 247, 226, 0.78), transparent 28%),
    radial-gradient(circle at 90% 14%, var(--accent-wash), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 88%, #fff), var(--bg));
  font-family: var(--sans);
}

button,
a {
  color: inherit;
  font: inherit;
}

.room-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}

.back-link,
.room-switcher > button,
.room-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.back-link {
  width: fit-content;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent-strong);
}

.room-switcher {
  position: relative;
  justify-self: center;
}

.room-switcher > button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 700;
}

.room-switcher > button:hover,
.room-switcher > button:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

.room-switcher-menu {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  width: min(280px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 9px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: 0 18px 50px rgba(34, 53, 49, 0.2);
}

.room-switcher-menu[hidden] {
  display: none;
}

.room-switcher-menu a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border-radius: 11px;
  color: var(--ink-soft);
  font-size: 12px;
  text-decoration: none;
}

.room-switcher-menu a:hover,
.room-switcher-menu a:focus-visible,
.room-switcher-menu a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  outline: none;
}

.room-state {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #67a980;
  box-shadow: 0 0 0 4px rgba(103, 169, 128, 0.12);
}

main {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 54px 0 72px;
}

.room-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 36px;
  align-items: end;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.room-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 600;
  letter-spacing: -0.045em;
}

.room-lead {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
}

.room-atmosphere {
  min-width: 190px;
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.room-atmosphere span,
.room-atmosphere small {
  color: var(--muted);
  font-size: 11px;
}

.room-atmosphere strong {
  font-family: var(--serif);
  font-size: 17px;
}

.room-layout {
  padding: clamp(18px, 4vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 32px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.24)),
    repeating-linear-gradient(90deg, rgba(91, 79, 64, 0.045) 0 1px, transparent 1px 72px),
    color-mix(in srgb, var(--bg) 72%, #f4e9dd);
  box-shadow: var(--shadow);
}

.furniture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.furniture-card {
  min-height: 220px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 11px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  text-align: left;
  background: color-mix(in srgb, var(--surface-solid) 91%, var(--accent-soft));
  box-shadow: 0 12px 30px rgba(45, 64, 59, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.game-table-entry {
    border-color: rgba(122, 77, 129, 0.28);
    background: linear-gradient(145deg, rgba(248, 239, 247, 0.94), rgba(236, 229, 244, 0.92));
    text-decoration: none;
}

.game-table-entry .furniture-icon {
    color: #78496f;
    background: rgba(120, 73, 111, 0.11);
}

.furniture-card:hover,
.furniture-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 38px rgba(45, 64, 59, 0.14);
  outline: none;
}

.furniture-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 23px;
}

.furniture-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 650;
}

.furniture-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.placement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.placement-list span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 10px;
}

.inventory-shortcut {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(45, 64, 59, 0.08);
  cursor: pointer;
}

.inventory-shortcut:hover,
.inventory-shortcut:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  outline: none;
}

.inventory-shortcut > i:first-child {
  grid-row: 1 / span 2;
  color: var(--accent);
  font-size: 25px;
}

.inventory-shortcut span {
  font-family: var(--serif);
  font-size: 14px;
}

.inventory-shortcut small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.shortcut-arrow {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--muted);
}

.room-note {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.48);
}

.room-note i {
  color: var(--accent);
  font-size: 20px;
}

.room-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.75;
}

.object-dialog {
  width: min(calc(100vw - 32px), 590px);
  max-height: min(780px, calc(100vh - 40px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: 0 28px 72px rgba(33, 50, 46, 0.25);
}

.object-dialog::backdrop {
  background: rgba(28, 41, 38, 0.46);
  backdrop-filter: blur(9px);
}

.dialog-inner {
  padding: 26px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.dialog-eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.dialog-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
}

.dialog-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  outline: none;
}

.object-description {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.object-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 11px;
  line-height: 1.7;
}

.live-inventory {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.inventory-heading,
.inventory-item-title,
.inventory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inventory-heading > div {
  display: grid;
  gap: 3px;
}

.inventory-heading span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.inventory-heading strong {
  font-family: var(--serif);
  font-size: 16px;
}

.inventory-heading button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 10px;
  cursor: pointer;
}

.inventory-status {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 13px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  font-size: 11px;
  line-height: 1.6;
}

.inventory-status.is-private {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.inventory-status a {
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.inventory-status.is-loading i {
  animation: inventory-spin 900ms linear infinite;
}

.inventory-list {
  display: grid;
  gap: 14px;
  margin-top: 13px;
}

.inventory-group {
  display: grid;
  gap: 8px;
}

.inventory-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.inventory-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.72);
}

.inventory-item-title strong {
  font-family: var(--serif);
}

.inventory-item-title b {
  color: var(--accent);
  font-size: 11px;
}

.inventory-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 7px;
}

.inventory-meta span {
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 9px;
}

.inventory-item p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.inventory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.inventory-tags em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

@keyframes inventory-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .room-header {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 10px 14px;
  }

  .back-link {
    font-size: 0;
  }

  .back-link i {
    font-size: 20px;
  }

  .room-state span:last-child {
    display: none;
  }

  main {
    width: min(100% - 24px, 1120px);
    padding: 34px 0 54px;
  }

  .room-intro {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .room-atmosphere {
    min-width: 0;
  }

  .furniture-grid {
    grid-template-columns: 1fr;
  }

  .furniture-card {
    min-height: 190px;
  }
}

@media (max-width: 420px) {
  .room-layout {
    padding: 12px;
    border-radius: 24px;
  }

  .furniture-card {
    padding: 18px;
  }

  .dialog-inner {
    padding: 20px;
  }
}
