:root {
  --bg-top: #090c14;
  --bg-bottom: #171e2e;
  --ivory: #ece4d5;
  --ivory-dim: rgba(236, 228, 213, 0.56);
  --amber: #e8b04b;
}

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

html, body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  font-family: "Optima", "Candara", "Yu Mincho", "Hiragino Mincho ProN", "Georgia", serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--ivory);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* 3D ワールドキャンバス（少し柔らかい空気感フィルター付き） */
#world-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  filter: contrast(0.95) saturate(1.06) brightness(1.02);
  transition: opacity 1.5s ease;
}

body.soaring #world-canvas {
  opacity: 1;
  pointer-events: auto;
  cursor: grab;
}

body.soaring #world-canvas:active {
  cursor: grabbing;
}

/* 幻想的な霞（ミスト）と柔らかい周辺減光ベール */
.atmosphere-veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 248, 232, 0.05) 0%, rgba(16, 24, 42, 0.14) 62%, rgba(6, 9, 18, 0.48) 100%),
    linear-gradient(180deg, rgba(8, 12, 22, 0.38) 0%, transparent 18%, transparent 82%, rgba(8, 12, 22, 0.35) 100%);
  backdrop-filter: blur(0.45px);
  -webkit-backdrop-filter: blur(0.45px);
  transition: opacity 1.5s ease;
}

body.soaring .atmosphere-veil {
  opacity: 1;
}

/* イントロ＆上部固定ロゴレイヤー */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  padding: calc(1.1rem + env(safe-area-inset-top, 0px)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  pointer-events: none;
}

.top-spacer {
  flex: 1 1 0%;
  transition: flex-grow 4.0s cubic-bezier(0.35, 0.0, 0.25, 1);
}

.bottom-spacer {
  flex: 1 1 0%;
  transition: flex-grow 4.0s cubic-bezier(0.35, 0.0, 0.25, 1);
}

body.soaring .top-spacer {
  flex-grow: 0.0001;
}

body.soaring .bottom-spacer {
  flex-grow: 1.9999;
}

.emblem-wrap {
  width: min(310px, 78vw);
  height: min(210px, 32dvh);
  margin-bottom: 0.5rem;
  overflow: visible;
  transition:
    height 4.0s cubic-bezier(0.35, 0.0, 0.25, 1),
    margin-bottom 4.0s cubic-bezier(0.35, 0.0, 0.25, 1),
    opacity 1.8s ease,
    transform 3.6s cubic-bezier(0.35, 0.0, 0.25, 1);
}

body.soaring .emblem-wrap {
  height: 0;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(-28px) scale(0.82);
}

.emblem-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.halo-circle {
  transform-origin: 160px 112px;
  animation: slowPulse 5.5s ease-in-out infinite alternate;
}

.owl-emblem-group {
  transform-origin: 160px 112px;
  animation: emblemFloat 4.2s ease-in-out infinite alternate;
}

.wing-path.left {
  transform-origin: 146px 112px;
  animation: wingSwayLeft 4.2s ease-in-out infinite alternate;
}

.wing-path.right {
  transform-origin: 174px 112px;
  animation: wingSwayRight 4.2s ease-in-out infinite alternate;
}

.eye-dot {
  animation: eyeGlow 6s ease-in-out infinite;
}

@keyframes slowPulse {
  from { transform: scale(0.94); opacity: 0.65; }
  to   { transform: scale(1.06); opacity: 1; }
}

@keyframes emblemFloat {
  from { transform: translateY(3px); }
  to   { transform: translateY(-5px); }
}

@keyframes wingSwayLeft {
  from { transform: rotate(-2deg); }
  to   { transform: rotate(3.5deg); }
}

@keyframes wingSwayRight {
  from { transform: rotate(2deg); }
  to   { transform: rotate(-3.5deg); }
}

@keyframes eyeGlow {
  0%, 46%, 50%, 100% { opacity: 1; }
  48%                { opacity: 0.1; }
}

/* ロゴヘッダー（TAKE FLIGHT でスーッと上部に上がり固定される） */
.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
  transition:
    transform 4.0s cubic-bezier(0.35, 0.0, 0.25, 1),
    opacity 4.0s ease;
}

body.soaring .brand-header {
  transform: scale(0.72);
  opacity: 0.88;
}

.brand-title {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--ivory);
  margin-left: 0.22em;
  text-shadow: 0 2px 18px rgba(6, 9, 18, 0.55);
}

.brand-title span {
  color: var(--amber);
  opacity: 0.9;
}

.brand-caption {
  margin-top: 0.55rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(0.62rem, 1.4vw, 0.72rem);
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--ivory-dim);
  margin-left: 0.34em;
  text-shadow: 0 1px 12px rgba(6, 9, 18, 0.65);
}

/* スタートボタンラッパー */
.start-btn-wrap {
  height: 52px;
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition:
    height 4.0s cubic-bezier(0.35, 0.0, 0.25, 1),
    margin-top 4.0s cubic-bezier(0.35, 0.0, 0.25, 1),
    opacity 1.2s ease,
    transform 2.0s ease;
}

body.soaring .start-btn-wrap {
  height: 0;
  margin-top: 0;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.start-btn {
  padding: 0.85rem 2.2rem;
  background: transparent;
  border: 1px solid rgba(236, 228, 213, 0.28);
  color: var(--ivory);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, color 0.4s ease, transform 0.4s ease, background 0.4s ease;
}

.start-btn:hover {
  border-color: rgba(232, 176, 75, 0.75);
  background: rgba(236, 228, 213, 0.05);
  color: #ffffff;
  transform: translateY(-2px);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* 飛行中の極小アイコンコントロール（右上に控えめに配置） */
.minimal-controls {
  position: fixed;
  top: calc(1.1rem + env(safe-area-inset-top, 0px));
  right: calc(1.1rem + env(safe-area-inset-right, 0px));
  z-index: 20;
  display: flex;
  gap: 0.65rem;
}

.minimal-controls[hidden] {
  display: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 24, 0.22);
  border: 1px solid rgba(236, 228, 213, 0.2);
  border-radius: 50%;
  color: rgba(236, 228, 213, 0.65);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: opacity 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.icon-btn:hover {
  background: rgba(15, 20, 34, 0.55);
  color: #ffffff;
  border-color: rgba(236, 228, 213, 0.55);
  transform: scale(1.06);
}

.icon-btn.muted #sound-waves {
  display: none;
}
