/* ===============================
   基本設定
=============================== */

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", sans-serif;
  transition: background 1s ease, color 1s ease;
  height: 100vh;
}

/* 昼 */
body.day {
  background: #f5efe6;
  color: #333;
}

/* 夕方 */
body.evening {
  background: linear-gradient(to bottom, #ffb347, #ffcc33);
  color: #333;
}

/* 夜 */
body.night {
  background: linear-gradient(to bottom, #0f2027, #203a43, #2c5364);
  color: #eee;
}

/* タイトル */
.room-title {
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin: 1rem 0;
}

/* ===============================
   部屋グリッド構造
=============================== */

.room {
  display: grid;
  grid-template-rows: auto 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 3vw, 2rem);

  width: 100%;
  padding: clamp(1rem, 3vw, 2rem);
  box-sizing: border-box;

  /* 壁＋床を一体化 */
  background:
    /* 床 */
    linear-gradient(to bottom,
      transparent 75%,
      #d2b48c 75%,
      #c49a6c 100%
    ),
    /* 壁模様 */
    linear-gradient(45deg, #f0e6d6 25%, transparent 25%) -20px 0,
    linear-gradient(-45deg, #f0e6d6 25%, transparent 25%) -20px 0,
    linear-gradient(45deg, transparent 75%, #f0e6d6 75%),
    linear-gradient(-45deg, transparent 75%, #f0e6d6 75%),
    #f5efe6;

  background-size:
    100% 100%,
    40px 40px,
    40px 40px,
    40px 40px,
    40px 40px;

  border-radius: 2rem;
  box-shadow: 0 2rem 4rem rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}

/* ===============================
   家具共通
=============================== */

.room a {
  text-decoration: none;
  color: inherit;
  justify-self: center;
  align-self: center;
  transition: transform 0.3s ease;
}

.room a:hover {
  transform: scale(1.05);
}

.room a span {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  font-size: clamp(0.8rem, 2vw, 1rem);
}

/* ===============================
   水槽
=============================== */

.aquarium {
  width: clamp(260px, 40vw, 360px);
  aspect-ratio: 2 / 1;
  background: #a0e9ff;
  border: 6px solid #4da6ff;
  border-radius: 1rem;
  position: relative;
}

.tank-water {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 70%;
  background: linear-gradient(to top, #4da6ff, #a0e9ff);
}

.fish {
  position: absolute;
  top: 40%;
  left: 20%;
  font-size: 2rem;
  animation: swim 4s ease-in-out infinite;
}

@keyframes swim {

  0% {
    transform: translate(0, 0) scaleX(-1);
  }

  25% {
    transform: translate(30px, -5px) scaleX(-1);
  }

  49% {
    transform: translate(90px, 0) scaleX(-1);
  }

  50% {
    transform: translate(90px, 0) scaleX(1);
  }

  75% {
    transform: translate(30px, 5px) scaleX(1);
  }

  99% {
    transform: translate(0, 0) scaleX(1);
  }

  100% {
    transform: translate(0, 0) scaleX(-1);
  }
}

/* ===============================
   本棚
=============================== */

.shelf {
  width: clamp(260px, 40vw, 360px);
  aspect-ratio: 2 / 1;
  background: #c49a6c;
  border-radius: 0.5rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 1rem 0;
}

/* 棚板（上下2段） */
.shelf-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  align-items: flex-end;
  border-bottom: 7px solid #a47148;
}

/* 本 */
.book {
  width: 14px;
  border-radius: 2px;
  z-index: 2;
}

/* 斜め本 */
.book.tilt {
  transform: rotate(-18deg);
  transform-origin: bottom left;
  height: 75px;
  background: #ff922b;
  margin-left: 12px;
  margin-top: 10px;   /* 少し下げる */
  z-index: 3;

}

/* ===============================
   ゲーム機
=============================== */

.console {
  width: clamp(260px, 40vw, 360px);
  aspect-ratio: 2 / 1;
  background: #444;
  border-radius: 1.5rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);

  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  align-items: center;
  padding: 1rem;
}

/* スクリーン */
.screen {
  width: 100%;
  height: 80%;
  background: #2ecc71;
  border-radius: 0.5rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* 文字 */
.screen-text {
  color: #987654;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: bold;
  letter-spacing: 0.1em;
  text-shadow: 0 0 6px #555555;
  font-family: 'Courier New', monospace;
}

/* 十字キー */
.dpad {
  justify-self: start;
  width: 50px;
  height: 50px;
  position: relative;
}

.dpad::before,
.dpad::after {
  content: "";
  position: absolute;
  background: white;
}

.dpad::before {
  width: 100%;
  height: 12px;
  top: 18px;
  left: 0;
}

.dpad::after {
  width: 12px;
  height: 100%;
  left: 18px;
  top: 0;
}

/* ボタン4つ */
.buttons {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(2, 24px);
  gap: 12px;
}

.buttons div {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.buttons div:nth-child(1) { background: red; }
.buttons div:nth-child(2) { background: blue; }
.buttons div:nth-child(3) { background: yellow; }
.buttons div:nth-child(4) { background: green; }

/* ===============================
   机＋封筒
=============================== */

.desk {
  width: clamp(260px, 40vw, 360px);
  aspect-ratio: 2 / 1;
  background: #deb887;
  border-radius: 0.5rem;
  position: relative;
}

.envelope {
  width: 60px;
  height: 40px;
  margin: 50px auto;
  background: white;
  position: relative;
}

.envelope::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  border-top: 20px solid #ddd;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
}

/* ===============================
   スマホ対応
=============================== */

@media (max-width: 600px) {

  .room {
    grid-template-columns: 1fr;
    grid-template-rows: auto repeat(4, auto);
    height: auto;
  }

  .window {
    grid-column: 1;
  }

}
