* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: linear-gradient(to bottom, #FFFFFF, #E3EDF7);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.container {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 1200px;
  padding: 10px;
  z-index: 1;
}

.left, .right {
  display: flex;
  justify-content: center;
  align-items: center;
}

.left {
  flex-shrink: 0;
  padding: 10px;
}

.left img {
  height: auto;
  width: auto;
  max-height: 70vh;
  max-width: 30vw;
  width: auto;
}

.right {
  flex-grow: 1;
  min-width: 0;
  padding: 10px;
}

.right iframe {
  width: 100%;
  height: 90vh;
  max-height: 700px;
  border: none;
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
}

@media (orientation: portrait) {
  body {
    align-items: flex-start;
  }
  .container {
    flex-wrap: wrap;
    overflow-x: hidden;
  }
  .left {
    flex-shrink: 1;
    flex-basis: auto;
    padding: 5px;
  }
  .left img {
    height: 20vh;
    width: 45vw;
    object-fit: cover;
    object-position: 50% 10%;
  }
  .right {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 100%;
    padding: 5px;
  }
  .right iframe {
    height: 75vh;
    width: 100%;
  }
}

/* ローダー背景と中央配置 */
.loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #001f4d;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loader-wrapper.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  position: relative;
  border: 4px solid #fff;
  animation: loader 2s infinite ease;
}

.loader-inner {
  vertical-align: top;
  display: inline-block;
  width: 100%;
  background-color: #fff;
  animation: loader-inner 2s infinite ease-in;
}

@keyframes loader {
  0% { transform: rotate(0deg);}
  25% { transform: rotate(180deg);}
  50% { transform: rotate(180deg);}
  75% { transform: rotate(360deg);}
  100% { transform: rotate(360deg);}
}
@keyframes loader-inner {
  0% { height: 0%;}
  25% { height: 0%;}
  50% { height: 100%;}
  75% { height: 100%;}
  100% { height: 0%;}
}

/* 画像フェード */
#characterImg {
  transition: opacity 0.4s;
  opacity: 1;
}
#characterImg.fade {
  opacity: 0;
}
