:root {
  color-scheme: light;
  --room-bg: #21180f;
  --room-ink: #3f2a18;
  --room-paper: #fff5df;
  --room-paper-soft: #f7e8c8;
  --room-muted: #7c6243;
  --room-wood: #9a6333;
  --room-wood-dark: #6f421f;
  --room-sun: #e8b96c;
  --room-leaf: #5f7748;
  --room-shadow: 0 24px 80px rgba(44, 25, 10, 0.24);
  --room-radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--room-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--room-ink);
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 224, 158, 0.24), transparent 30%),
    linear-gradient(135deg, #3a2818, #16110c 68%);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", "Hiragino Sans", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.3;
  background:
    repeating-linear-gradient(90deg, rgba(255, 240, 210, 0.08) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, rgba(255, 247, 229, 0.12), transparent 38%);
}

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

button {
  border: 0;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.room-chrome {
  position: fixed;
  top: 16px;
  right: 18px;
  left: 18px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.room-wordmark,
.room-title,
.room-actions {
  pointer-events: auto;
}

.room-wordmark {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(255, 234, 194, 0.42);
  border-radius: var(--room-radius);
  color: #fff2d4;
  text-decoration: none;
  background: rgba(43, 30, 18, 0.58);
  box-shadow: 0 12px 30px rgba(24, 13, 7, 0.18);
  backdrop-filter: blur(14px);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.room-title {
  justify-self: center;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  padding: 8px 14px;
  border: 1px solid rgba(255, 236, 205, 0.34);
  border-radius: var(--room-radius);
  color: #fff3d9;
  background: rgba(42, 28, 16, 0.48);
  box-shadow: 0 12px 30px rgba(24, 13, 7, 0.14);
  backdrop-filter: blur(14px);
}

.room-title strong {
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.room-title span {
  color: rgba(255, 242, 216, 0.74);
  font-size: 13px;
}

.room-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.room-language,
.room-menu-button,
.full-room-button,
.full-room-toolbar button,
.modal-close,
.modal-secondary,
.room-menu-head button {
  border: 1px solid rgba(255, 236, 205, 0.36);
  border-radius: var(--room-radius);
  color: #fff1d3;
  background: rgba(43, 30, 18, 0.62);
  box-shadow: 0 12px 30px rgba(24, 13, 7, 0.18);
  backdrop-filter: blur(14px);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.room-language {
  height: 40px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.room-menu-button {
  position: relative;
  width: 42px;
  height: 40px;
}

.room-menu-button span:not(.sr-only) {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.room-menu-button span:first-child {
  top: 14px;
}

.room-menu-button span:nth-child(2) {
  top: 22px;
}

.room-language:hover,
.room-menu-button:hover,
.full-room-button:hover,
.full-room-toolbar button:hover,
.modal-secondary:hover,
.room-menu-head button:hover {
  border-color: rgba(255, 226, 170, 0.8);
  background: rgba(108, 67, 31, 0.72);
  transform: translateY(-1px);
}

.room-menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  justify-content: flex-end;
  padding: 72px 18px 18px;
  background: rgba(27, 19, 12, 0.32);
  backdrop-filter: blur(5px);
}

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

.room-menu-panel {
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100vh - 90px);
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(111, 73, 39, 0.24);
  border-radius: var(--room-radius);
  background: rgba(255, 246, 225, 0.96);
  box-shadow: var(--room-shadow);
}

.room-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid rgba(111, 73, 39, 0.14);
}

.room-menu-head p {
  margin: 0;
  color: var(--room-wood-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.room-menu-head button {
  height: 32px;
  padding: 0 10px;
  color: var(--room-wood-dark);
  background: rgba(154, 99, 51, 0.08);
  box-shadow: none;
}

.room-menu-panel a,
.room-menu-panel > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 0 10px;
  border-radius: var(--room-radius);
  color: var(--room-ink);
  text-align: left;
  text-decoration: none;
  background: transparent;
}

.room-menu-panel a::after,
.room-menu-panel > button::after {
  color: rgba(111, 66, 31, 0.48);
  content: ">";
}

.room-menu-panel a:hover,
.room-menu-panel > button:hover {
  background: rgba(154, 99, 51, 0.1);
}

.room-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  overflow: hidden;
}

.room-viewport {
  position: relative;
  height: 100%;
  padding: 0;
}

.room-viewport h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.room-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
}

.room-canvas {
  position: relative;
  width: min(100vw, calc(100dvh * 1.7804));
  aspect-ratio: 4800 / 2696;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 24px 90px rgba(21, 11, 4, 0.34);
  background: #d9b680;
}

.room-background,
.room-layer {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.room-background {
  position: relative;
  object-fit: contain;
}

.room-layer {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 14px 14px rgba(54, 33, 14, 0.18));
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center;
  transition: opacity 160ms ease, transform 220ms ease, filter 220ms ease;
}

.room-canvas[data-active="anime"] .room-layer[data-layer="anime"],
.room-canvas[data-active="games"] .room-layer[data-layer="games"],
.room-canvas[data-active="keyboard"] .room-layer[data-layer="keyboard"],
.room-canvas[data-active="keyboard"] .room-layer[data-layer="wall-keyboard"],
.room-canvas[data-active="music"] .room-layer[data-layer="music"],
.room-canvas[data-active="reading"] .room-layer[data-layer="reading"],
.room-canvas[data-active="photography"] .room-layer[data-layer="photography"],
.room-canvas[data-active="blog"] .room-layer[data-layer="blog"] {
  opacity: 1;
  filter: drop-shadow(0 18px 18px rgba(54, 33, 14, 0.28)) drop-shadow(0 0 12px rgba(255, 222, 154, 0.2));
  transform: translate3d(0, -0.65%, 0) scale(1.006);
}

.room-layer--wall-keyboard {
  inset: auto;
  left: 36.7%;
  top: 16.8%;
  width: 13.5%;
  height: auto;
  aspect-ratio: 226 / 76;
}

.room-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 8;
  width: var(--w);
  height: var(--h);
  padding: 0;
  border-radius: var(--room-radius);
  background: transparent;
  cursor: pointer;
  outline: 0;
}

.room-hotspot::before {
  position: absolute;
  inset: -2px;
  z-index: 0;
  border: 1px solid rgba(255, 236, 188, 0);
  border-radius: inherit;
  content: "";
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.room-hotspot::after {
  position: absolute;
  left: calc(100% - 8px);
  top: 18%;
  z-index: 1;
  width: clamp(12px, 1.05vw, 16px);
  height: clamp(12px, 1.05vw, 16px);
  background: linear-gradient(180deg, #fffef0 0%, #f3c363 58%, #c8792c 100%);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  filter: drop-shadow(0 1px 1px rgba(48, 28, 12, 0.42)) drop-shadow(0 0 6px rgba(255, 238, 177, 0.68));
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(12deg) scale(0.88);
  transition: opacity 260ms ease, transform 260ms ease, filter 260ms ease;
  animation: none;
}

.room-shell.is-guide-visible .room-hotspot::after {
  opacity: 0.82;
  animation: roomGuideTwinkle 2200ms ease-in-out infinite;
}

.room-hotspot[data-room-target="games"]::after {
  left: 96%;
  top: 45%;
}

.room-hotspot[data-room-target="keyboard"]::after {
  left: 91%;
  top: 18%;
}

.room-hotspot[data-room-marker="wall-keyboard"]::after {
  left: 104%;
  top: 50%;
}

.room-hotspot[data-room-target="music"]::after {
  left: 29%;
  top: 52%;
}

.room-hotspot[data-room-target="photography"]::after {
  left: 78%;
  top: 47%;
}

.room-hotspot[data-room-target="reading"]::after {
  left: calc(100% - 10px);
  top: 48%;
}

.room-hotspot:nth-of-type(2)::after {
  animation-delay: 160ms;
}

.room-hotspot:nth-of-type(3)::after {
  animation-delay: 320ms;
}

.room-hotspot:nth-of-type(4)::after {
  animation-delay: 480ms;
}

.room-hotspot:nth-of-type(5)::after {
  animation-delay: 640ms;
}

.room-hotspot:nth-of-type(6)::after {
  animation-delay: 800ms;
}

.room-hotspot:nth-of-type(7)::after {
  animation-delay: 960ms;
}

.room-hotspot span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 2;
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 240, 210, 0.46);
  border-radius: var(--room-radius);
  color: #fff3db;
  white-space: nowrap;
  background: rgba(45, 30, 18, 0.76);
  box-shadow: 0 10px 24px rgba(24, 13, 7, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: clamp(10px, 1.15vw, 14px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.room-hotspot:hover::before,
.room-hotspot:focus-visible::before,
.room-hotspot.is-active::before {
  border-color: rgba(255, 232, 174, 0.82);
  background: rgba(255, 225, 161, 0.05);
  box-shadow: 0 0 0 9999px rgba(31, 19, 10, 0.05), 0 0 20px rgba(255, 223, 154, 0.2);
}

.room-shell.is-guide-visible .room-hotspot:hover::after,
.room-shell.is-guide-visible .room-hotspot:focus-visible::after,
.room-shell.is-guide-visible .room-hotspot.is-active::after {
  opacity: 1;
  filter: drop-shadow(0 1px 1px rgba(48, 28, 12, 0.48)) drop-shadow(0 0 8px rgba(255, 238, 177, 0.82));
  transform: translate(-50%, -50%) rotate(12deg) scale(1.16);
}

.room-hotspot:hover span,
.room-hotspot:focus-visible span,
.room-hotspot.is-active span {
  opacity: 1;
  transform: translate(-50%, 0);
}

.room-hint {
  position: fixed;
  right: 50%;
  bottom: 22px;
  z-index: 20;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255, 239, 203, 0.34);
  border-radius: var(--room-radius);
  color: rgba(255, 244, 221, 0.82);
  background: rgba(43, 30, 18, 0.44);
  backdrop-filter: blur(14px);
  transform: translateX(50%);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.room-hint::before {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, #fff9da 0%, #e7a84e 82%);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  content: "";
  filter: drop-shadow(0 0 5px rgba(255, 232, 160, 0.46));
  opacity: 0;
  transform: scale(0.76);
  transition: opacity 260ms ease, transform 260ms ease;
}

.room-shell.is-guide-visible .room-hint::before {
  opacity: 1;
  transform: scale(1);
}

@keyframes roomGuideTwinkle {
  0%,
  100% {
    opacity: 0.58;
    transform: translate(-50%, -50%) rotate(12deg) scale(0.78);
  }

  50% {
    opacity: 0.98;
    transform: translate(-50%, -50%) rotate(12deg) scale(1);
  }
}

.full-room-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 22;
  min-height: 40px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.room-modal,
.full-room-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 16, 10, 0.46);
  backdrop-filter: blur(8px);
}

.room-modal[hidden],
.full-room-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 26px;
  overflow: auto;
  border: 1px solid rgba(116, 76, 39, 0.18);
  border-radius: var(--room-radius);
  color: var(--room-ink);
  background:
    linear-gradient(135deg, rgba(255, 248, 232, 0.96), rgba(247, 232, 200, 0.96)),
    var(--room-paper);
  box-shadow: var(--room-shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  color: var(--room-wood-dark);
  background: rgba(154, 99, 51, 0.08);
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}

.modal-kicker {
  margin: 0 0 10px;
  color: var(--room-leaf);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.modal-card h2 {
  max-width: calc(100% - 38px);
  margin: 0;
  color: var(--room-ink);
  font-family: Georgia, "Noto Serif SC", "Hiragino Mincho ProN", serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 500;
  line-height: 1.12;
}

.modal-card p:not(.modal-kicker) {
  margin: 16px 0 0;
  color: var(--room-muted);
  font-size: 15px;
  line-height: 1.8;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.modal-primary,
.modal-secondary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: var(--room-radius);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.modal-primary {
  border: 1px solid rgba(111, 66, 31, 0.68);
  color: #fff6df;
  background: var(--room-wood);
}

.modal-primary:hover {
  background: var(--room-wood-dark);
}

.modal-secondary {
  color: var(--room-wood-dark);
  background: rgba(154, 99, 51, 0.08);
  box-shadow: none;
}

.modal-primary[aria-disabled="true"] {
  pointer-events: none;
  color: var(--room-muted);
  border-color: rgba(111, 66, 31, 0.16);
  background: rgba(154, 99, 51, 0.08);
}

.full-room-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 28px));
  height: min(760px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 239, 203, 0.28);
  border-radius: var(--room-radius);
  background: #21160d;
  box-shadow: var(--room-shadow);
}

.full-room-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 10px 0 15px;
  color: #fff3d8;
  background: rgba(34, 23, 14, 0.94);
}

.full-room-toolbar span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.full-room-toolbar div {
  display: flex;
  gap: 6px;
}

.full-room-toolbar button {
  width: 34px;
  height: 32px;
  box-shadow: none;
}

.full-room-scroll {
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  background: #130d08;
}

.full-room-scroll img {
  display: block;
  width: calc(100% * var(--zoom, 1));
  max-width: none;
  min-width: 100%;
  height: auto;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .room-chrome {
    top: 10px;
    right: 10px;
    left: 10px;
    grid-template-columns: auto auto;
  }

  .room-title {
    display: none;
  }

  .room-actions {
    grid-column: 2;
  }

  .room-wordmark {
    height: 36px;
    padding: 0 12px;
    font-size: 18px;
  }

  .room-language,
  .room-menu-button {
    height: 36px;
  }

  .room-menu-button {
    width: 38px;
  }

  .room-scroll {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .room-scroll::-webkit-scrollbar {
    display: none;
  }

  .room-shell.is-mobile-intro .room-scroll {
    overflow: hidden;
    scroll-snap-type: none;
  }

  .room-canvas {
    width: max(980px, calc((100svh - 22px) * 1.7804));
    height: calc(100svh - 22px);
    margin: 11px 0;
    scroll-snap-align: center;
    transform-origin: center;
  }

  .room-shell.is-mobile-intro .room-canvas {
    transform: scale(var(--room-intro-scale, 0.25));
  }

  .room-shell.is-mobile-zooming .room-canvas {
    transition: transform 1150ms cubic-bezier(0.22, 0.9, 0.28, 1);
  }

  .room-shell.is-mobile-intro .room-hotspot {
    pointer-events: none;
  }

  .room-hint,
  .full-room-button {
    transition: opacity 280ms ease, transform 280ms ease;
  }

  .room-shell.is-mobile-intro .room-hint,
  .room-shell.is-mobile-intro .full-room-button {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
  }

  .room-hotspot span {
    bottom: auto;
    top: calc(100% + 8px);
    min-height: 28px;
    font-size: 11px;
  }

  .room-hint {
    right: auto;
    bottom: 14px;
    left: 12px;
    max-width: calc(100vw - 148px);
    min-height: 34px;
    padding: 0 10px;
    transform: none;
    font-size: 11px;
  }

  .full-room-button {
    right: 10px;
    bottom: 12px;
    min-height: 36px;
    padding: 0 10px;
    font-size: 11px;
  }

  .modal-card {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  .room-menu {
    justify-content: stretch;
    padding: 56px 10px 10px;
  }

  .room-menu-panel {
    width: 100%;
  }

  .room-canvas {
    width: max(900px, calc((100svh - 18px) * 1.7804));
    height: calc(100svh - 18px);
    margin: 9px 0;
  }

  .room-modal,
  .full-room-modal {
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    padding: 20px;
  }

  .modal-card h2 {
    font-size: 30px;
  }

  .modal-card p:not(.modal-kicker) {
    font-size: 14px;
  }

  .modal-actions {
    display: grid;
  }

  .full-room-panel {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 20px);
  }

  .full-room-scroll {
    max-height: calc(100vh - 88px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
