* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #86c9ef;
  color: #ffffff;
  font-family: "Zen Kaku Gothic New", sans-serif;
  overflow-x: hidden;
}

/* スクロール量を確保するためのダミー高さ */
body {
  height: 620vh;
}

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  perspective: 520px;
  background: #86c9ef;
}

.scene::before {
  /* 画面全体に薄いドット感をのせて、レトロRPGらしい粒度を出す */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.22;
  pointer-events: none;
  image-rendering: pixelated;
}

.world {
  --castle-scale: 1;
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: linear-gradient(180deg, #78c2ef 0%, #aee1f4 42%, #dff6cf 59%, #429533 60%, #2f752c 100%);
  image-rendering: pixelated;
}

.field-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.world.three-ready {
  background: #87c9ef;
}

.world.three-ready .sky,
.world.three-ready .clouds,
.world.three-ready .hills,
.world.three-ready .castle,
.world.three-ready .ground,
.world.three-ready .path {
  display: none;
}

.world::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 0%, transparent 46%, rgba(7, 25, 28, 0.22) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 30%, rgba(0, 0, 0, 0.18) 100%);
}

.party-sprites {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 0 rgba(20, 50, 28, 0.18));
  pointer-events: none;
}

.party-action {
  position: absolute;
  left: 50%;
  bottom: 74px;
  z-index: 5;
  width: max-content;
  max-width: min(330px, 78vw);
  padding: 9px 13px;
  transform: translateX(-50%);
  font-family: "DotGothic16", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #ffffff;
  background: rgba(0, 0, 18, 0.94);
  border: 2px solid #ffffff;
  border-radius: 4px;
  box-shadow:
    0 0 0 2px rgba(0, 0, 18, 0.94),
    0 0 0 4px #ffffff;
  opacity: 0.95;
  white-space: normal;
}

.party-sprites.command-cheers .party-action {
  bottom: 106px;
}

.party-action::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(0, 0, 18, 0.94);
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

.party-sprites.command-cheers .sprite {
  animation-duration: 0.44s;
}

.party-sprites.command-cheers::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 58px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  background: #ffe36e;
  box-shadow:
    -22px -6px 0 #ffffff,
    22px -6px 0 #ffffff,
    -10px -19px 0 #ffe36e,
    10px -19px 0 #ffe36e,
    0 -31px 0 #ffffff;
  image-rendering: pixelated;
}

.party-sprites.command-book .sprite-mage::after {
  box-shadow:
    -8px 9px 0 var(--hair),
    8px 9px 0 var(--hair),
    0 38px 0 rgba(0, 0, 0, 0.2),
    15px 27px 0 #ffe36e;
}

.party-sprites.command-reserve .sprite-warrior {
  transform: translateY(-2px);
}

.beer-mug {
  position: absolute;
  right: -9px;
  top: 20px;
  width: 13px;
  height: 16px;
  z-index: 2;
  background: #f2b844;
  border: 2px solid #ffffff;
  box-shadow:
    inset 0 -4px 0 #d98728,
    0 2px 0 rgba(0, 0, 0, 0.2);
  opacity: 0.95;
  transform: rotate(4deg);
  transform-origin: 50% 100%;
  image-rendering: pixelated;
}

.beer-mug::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -6px;
  width: 12px;
  height: 5px;
  background: #fff6d8;
  box-shadow: 5px 0 0 #fff6d8;
}

.beer-mug::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 3px;
  width: 7px;
  height: 8px;
  border: 2px solid #ffffff;
  border-left: 0;
}

.party-sprites.command-cheers .beer-mug {
  opacity: 1;
  transform: translateY(-20px) rotate(-18deg);
}

.party-sprites.command-cheers .sprite-mage .beer-mug {
  transform: translateY(-24px) rotate(12deg);
}

.party-sprites.command-cheers .sprite-merchant .beer-mug {
  transform: translateY(-19px) rotate(18deg);
}

.sprite {
  position: relative;
  display: block;
  width: 28px;
  height: 42px;
  transform-origin: 50% 100%;
  animation: party-step 0.72s steps(2, end) infinite;
  image-rendering: pixelated;
}

.sprite::before,
.sprite::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.sprite::before {
  top: 0;
  width: 18px;
  height: 16px;
  background: #ffd6a3;
  box-shadow:
    0 16px 0 var(--body),
    -7px 21px 0 var(--body-dark),
    7px 21px 0 var(--body-dark),
    -5px 34px 0 #2c315f,
    5px 34px 0 #2c315f;
}

.sprite::after {
  top: -6px;
  width: 22px;
  height: 10px;
  background: var(--hair);
  box-shadow:
    -8px 9px 0 var(--hair),
    8px 9px 0 var(--hair),
    0 38px 0 rgba(0, 0, 0, 0.2);
}

.sprite-warrior {
  --body: #2e6fd8;
  --body-dark: #1f4d9d;
  --hair: #65422e;
}

.sprite-mage {
  --body: #9a4bd3;
  --body-dark: #67309d;
  --hair: #f1d75b;
  height: 38px;
}

.sprite-merchant {
  --body: #d65d38;
  --body-dark: #963d25;
  --hair: #2b2a36;
  height: 36px;
}

@keyframes party-step {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.quest-window,
.command-window {
  position: fixed;
  z-index: 20;
  font-family: "DotGothic16", sans-serif;
  color: #ffffff;
  background: rgba(0, 0, 40, 0.9);
  border: 3px solid #ffffff;
  border-radius: 6px;
  box-shadow:
    0 0 0 3px rgba(0, 0, 40, 0.9),
    0 0 0 5px #ffffff,
    0 12px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.quest-window {
  right: 18px;
  bottom: 24px;
  width: min(270px, 42vw);
  padding: 14px 16px 12px;
}

.quest-title {
  margin-bottom: 10px;
  color: #ffe36e;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.quest-bar {
  height: 10px;
  padding: 2px;
  background: #15152f;
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.quest-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffe36e, #73dd60);
  transition: width 0.12s linear;
}

.quest-place {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.command-window {
  left: 18px;
  bottom: 24px;
  width: 150px;
  padding: 12px 14px;
}

.command-window p {
  margin-bottom: 8px;
  color: #ffe36e;
  font-size: 12px;
}

.command-window ul {
  display: grid;
  gap: 5px;
  list-style: none;
  font-size: 14px;
}

.command-window li::before {
  content: " ";
  display: inline-block;
  width: 1em;
}

.command-window li.is-active::before {
  content: "▶";
  color: #ffe36e;
}

.sky,
.clouds,
.hills,
.castle,
.ground,
.path {
  position: absolute;
  pointer-events: none;
}

.sky {
  inset: 0 0 38%;
  background:
    radial-gradient(circle at 14% 14%, #fff5a8 0 28px, #f4ce62 29px 40px, transparent 41px),
    linear-gradient(180deg, #77c4f2 0%, #b8e7f6 72%, #def6d4 100%);
}

.clouds {
  inset: 0;
  opacity: 0.96;
  animation: drift-clouds 32s linear infinite;
}

.clouds::before,
.clouds::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 54px;
  background:
    linear-gradient(#ffffff, #ffffff) 0 20px / 48px 18px no-repeat,
    linear-gradient(#ffffff, #ffffff) 36px 8px / 62px 30px no-repeat,
    linear-gradient(#ffffff, #ffffff) 92px 16px / 70px 22px no-repeat,
    linear-gradient(#d8f4ff, #d8f4ff) 10px 38px / 130px 8px no-repeat;
  filter: drop-shadow(0 4px 0 rgba(83, 151, 190, 0.18));
}

.clouds::before {
  top: 13%;
  left: 10%;
}

.clouds::after {
  top: 22%;
  right: 8%;
  transform: scale(0.78);
}

.hills {
  left: -8%;
  right: -8%;
  bottom: 38%;
  height: 18%;
  background:
    radial-gradient(ellipse at 20% 100%, #5ebc57 0 42%, transparent 43%),
    radial-gradient(ellipse at 55% 100%, #6fc363 0 46%, transparent 47%),
    radial-gradient(ellipse at 84% 100%, #519f49 0 40%, transparent 41%);
}

.hills::after {
  content: "";
  position: absolute;
  inset: 36% 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
}

.ground {
  left: -5%;
  right: -5%;
  bottom: 0;
  height: 43%;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08) 2px, transparent 2px) 0 0 / 54px 54px,
    linear-gradient(180deg, #4daa3b 0%, #31792e 100%);
  border-top: 8px solid #2f7d2c;
}

.ground::before,
.ground::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background-image: linear-gradient(90deg, transparent 0 18px, rgba(255,255,255,0.14) 18px 24px, transparent 24px 54px);
  background-size: 54px 16px;
}

.ground::before {
  top: 20%;
}

.ground::after {
  top: 58%;
  transform: translateX(22px);
}

.path {
  left: 50%;
  bottom: -5%;
  width: min(84vw, 680px);
  height: 49%;
  transform: translateX(-50%);
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, rgba(112, 70, 30, 0.28) 0 3px, transparent 3px 19px) 50% 0 / 38px 38px,
    linear-gradient(180deg, #d7b26d 0%, #ba7b3d 100%);
  box-shadow: inset 0 0 0 5px rgba(99, 60, 25, 0.16);
}

.castle {
  left: 50%;
  bottom: 50%;
  width: clamp(118px, 18vw, 210px);
  height: clamp(82px, 13vw, 148px);
  transform: translateX(-50%) translateY(var(--castle-rise, 0px)) scale(var(--castle-scale));
  transform-origin: 50% 100%;
  transition: filter 0.2s ease;
  filter: drop-shadow(0 10px 0 rgba(47, 83, 64, 0.22));
}

.castle-keep,
.castle-tower,
.castle-gate {
  position: absolute;
  bottom: 0;
  background: #d8d3bf;
  border: 4px solid #5f6680;
  box-shadow: inset -8px -8px 0 rgba(92, 95, 112, 0.18);
}

.castle-keep {
  left: 28%;
  width: 44%;
  height: 68%;
}

.castle-keep::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: -30%;
  height: 31%;
  background: #b94d3f;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.castle-tower {
  width: 30%;
  height: 88%;
}

.castle-tower.left {
  left: 0;
}

.castle-tower.right {
  right: 0;
}

.castle-tower::before {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  top: -26%;
  height: 28%;
  background: #b94d3f;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.castle-tower::after,
.castle-keep::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 32%;
  width: 18%;
  height: 18%;
  transform: translateX(-50%);
  background: #344463;
  box-shadow: 0 26px 0 #344463;
}

.castle-gate {
  left: 41%;
  bottom: 0;
  width: 18%;
  height: 28%;
  background: #5d382a;
  border-color: #4a2b22;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  z-index: 2;
}

@keyframes drift-clouds {
  0% { transform: translateX(0); }
  100% { transform: translateX(28px); }
}

.layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

/* ドラクエ風の「コマンドウィンドウ」：紺色地＋白い二重枠＋角丸なし */
.panel {
  max-width: 620px;
  width: min(90vw, 620px);
  padding: 34px 30px;
  text-align: center;
  background: #050511;
  border: 3px solid #ffffff;
  border-radius: 6px;
  box-shadow:
    0 0 0 3px #050511,
    0 0 0 6px #ffffff,
    0 10px 40px rgba(0, 0, 40, 0.6);
}

.panel:not(.panel-welcome) {
  transform: translateY(-76px);
}

.panel-index {
  font-family: "DotGothic16", sans-serif;
  letter-spacing: 0.18em;
  color: #ffe36e;
  font-size: 14px;
  margin-bottom: 16px;
}

.panel h1, .panel h2 {
  font-family: "DotGothic16", sans-serif;
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

.panel h2 {
  font-size: clamp(19px, 3vw, 26px);
  color: #ffffff;
}

.panel-text {
  font-family: "DotGothic16", sans-serif;
  font-size: 15px;
  line-height: 2.1;
  color: #ffffff;
  letter-spacing: 0.03em;
}

/* WELCOME パネル */
.panel.panel-welcome {
  width: min(92vw, 720px);
  padding: 0 18px;
  background: transparent;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  transform: translateY(-8px);
  backdrop-filter: none;
}

.eyebrow {
  font-family: "DotGothic16", sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #ffe36e;
  margin-bottom: 18px;
}

.logo {
  font-family: "DotGothic16", sans-serif;
  font-size: clamp(50px, 9vw, 86px);
  font-weight: 400;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow:
    4px 4px 0 #2d4b74,
    0 5px 18px rgba(2, 18, 30, 0.45);
}

.logo-sub {
  display: block;
  font-size: clamp(15px, 2.4vw, 19px);
  letter-spacing: 0.2em;
  color: #ffe36e;
  margin-top: 12px;
}

.lead {
  font-family: "DotGothic16", sans-serif;
  margin-top: 26px;
  font-size: 17px;
  color: #ffffff;
  text-shadow: 0 3px 10px rgba(2, 18, 30, 0.65);
}

.lead-sub {
  display: inline-block;
  font-family: "DotGothic16", sans-serif;
  margin-top: 22px;
  padding: 12px 22px;
  font-size: 14px;
  color: #ffe36e;
  background: rgba(0, 0, 24, 0.88);
  border: 3px solid #ffffff;
  border-radius: 8px;
  box-shadow:
    0 0 0 3px rgba(0, 0, 24, 0.88),
    0 0 0 6px #ffffff,
    0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ステータス表示（ぼうけんのしょ風） */
.status-list, .menu-list {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: "DotGothic16", sans-serif;
}

.status-list li, .menu-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  padding-bottom: 12px;
  border-bottom: 2px dotted rgba(255, 255, 255, 0.3);
}

.status-key, .menu-name {
  color: #ffffff;
}

.status-val, .menu-price {
  color: #ffe36e;
  white-space: nowrap;
  margin-left: 16px;
}

/* 最終パネル */
.panel-final .panel-text {
  margin-bottom: 28px;
}

.cta-button {
  display: inline-block;
  font-family: "DotGothic16", sans-serif;
  padding: 15px 40px;
  background: #06c755;
  color: #ffffff;
  font-size: 16px;
  text-decoration: none;
  border: 3px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 0 #04963f;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cta-button:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #04963f;
}

.footer-note {
  margin-top: 24px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

.studio-credit {
  display: inline-block;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.7rem;
  line-height: 1.4;
  text-decoration: none;
  opacity: 0.62;
}

/* 深度メーター（HP/MP風の左上表示） */
.depth-meter {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: "DotGothic16", sans-serif;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  letter-spacing: 0.1em;
  background: #000063;
  border: 2px solid #ffffff;
  border-radius: 6px;
  padding: 6px 12px;
}

.depth-value {
  font-size: 18px;
  color: #ffe36e;
  min-width: 2.2em;
  text-align: right;
}

/* スクロールヒント */
.scroll-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  text-align: center;
  font-family: "DotGothic16", sans-serif;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0.1em;
  transition: opacity 0.5s ease;
  animation: blink 1.2s steps(2, start) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (max-width: 600px) {
  body {
    height: 650vh;
  }

  .sky {
    bottom: 41%;
  }

  .clouds::before {
    left: -4%;
    top: 10%;
    transform: scale(0.72);
  }

  .clouds::after {
    right: -14%;
    top: 21%;
    transform: scale(0.58);
  }

  .hills {
    bottom: 40%;
    height: 16%;
  }

  .ground {
    height: 42%;
  }

  .castle {
    bottom: 48%;
    width: 118px;
    height: 82px;
  }

  .path {
    width: 112vw;
    height: 48%;
  }

  .panel {
    width: min(86vw, 620px);
    padding: 24px 18px;
    box-shadow:
      0 0 0 3px #050511,
      0 0 0 5px #ffffff,
      0 10px 32px rgba(0, 0, 40, 0.5);
  }

  .panel:not(.panel-welcome) {
    transform: translateY(-98px);
  }

  .panel.panel-final {
    width: min(84vw, 620px);
    padding: 18px 16px 16px;
    transform: translateY(-122px);
  }

  .panel-final .panel-index {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .panel-final h2 {
    margin-bottom: 12px;
    font-size: 20px;
    line-height: 1.35;
  }

  .panel-final .panel-text {
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.65;
  }

  .panel-final .cta-button {
    padding: 11px 26px;
    font-size: 14px;
  }

  .panel-final .footer-note {
    margin-top: 13px;
    font-size: 10px;
    line-height: 1.4;
  }

  .panel-final .studio-credit {
    margin-top: 6px;
    font-size: 0.65rem;
  }

  .party-sprites {
    bottom: 98px;
    transform: translateX(-50%) scale(0.94);
  }

  .party-action {
    bottom: 82px;
    max-width: 288px;
    padding: 8px 11px;
    font-size: 11px;
  }

  .party-sprites.command-cheers .party-action {
    bottom: 116px;
    max-width: 290px;
  }

  .quest-window {
    right: 8px;
    bottom: 12px;
    width: 138px;
    padding: 8px 9px 7px;
  }

  .quest-title {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .quest-place {
    font-size: 10px;
  }

  .command-window {
    display: block;
    left: 8px;
    bottom: 12px;
    width: 118px;
    padding: 8px 9px;
  }

  .command-window p {
    margin-bottom: 5px;
    font-size: 10px;
  }

  .command-window ul {
    gap: 2px;
    font-size: 11px;
  }

  .panel-welcome {
    transform: translateY(-18px);
  }

  .logo {
    font-size: clamp(38px, 12vw, 48px);
  }

  .lead-sub {
    max-width: 280px;
    padding: 10px 16px;
    font-size: 13px;
  }

  .panel-text {
    font-size: 14px;
    line-height: 1.95;
  }

  .status-list li, .menu-list li {
    gap: 12px;
    font-size: 14px;
  }

  .depth-meter {
    top: 12px;
    left: 12px;
    font-size: 11px;
    padding: 5px 9px;
  }

  .scroll-hint {
    width: 100%;
    bottom: 16px;
    font-size: 12px;
  }
}

@media (min-width: 481px) and (max-width: 600px) {
  .quest-window {
    width: 210px;
    right: 14px;
  }

  .command-window {
    display: block;
    left: 14px;
    bottom: 18px;
    width: 132px;
    padding: 10px 12px;
  }

  .command-window ul {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .party-sprites {
    left: 50%;
  }
}

/* 奥から流れてくる光の粒（JSで生成・ドット風の四角） */
.dust {
  z-index: 2;
  background: #fff5a8;
  border-radius: 0 !important;
  box-shadow: 0 0 5px rgba(255, 241, 147, 0.55);
  image-rendering: pixelated;
}
