/* 巣までひと枝 — styles */
:root {
  --sky-top: #7ec8e8;
  --sky-mid: #b8e0f0;
  --sky-bot: #e8f6e8;
  --leaf: #3d8b5f;
  --bark: #8b5a2b;
  --accent: #e87a3a;
  --soft: #fff8f0;
  --ink: #2c3e2d;
  --panel: rgba(255, 248, 240, 0.92);
  --shadow: 0 8px 28px rgba(44, 62, 45, 0.18);
  --radius: 18px;
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI",
    "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #5eb3d4 0%, #9fd4e8 40%, #d4eec8 100%);
  user-select: none;
  touch-action: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  flex: 1;
  cursor: grab;
}

#game-canvas:active {
  cursor: grabbing;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
  gap: 8px;
}

.hud-card {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.35;
  min-width: 88px;
}

.hud-card strong {
  display: block;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.hud-card .label {
  opacity: 0.7;
  font-size: 11px;
}

#wind-meter {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 5;
  width: min(220px, 56vw);
  padding: 8px 12px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

#wind-meter .label {
  display: inline-block;
  margin-right: 6px;
  opacity: 0.7;
  font-size: 11px;
}

#wind-direction {
  display: inline-block;
  min-width: 1.2em;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

#wind-bar {
  height: 8px;
  border-radius: 99px;
  background: #e5ddd2;
  overflow: hidden;
  margin-top: 6px;
  position: relative;
}

#wind-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  background: linear-gradient(90deg, #4aa3d9, #e87a3a);
  border-radius: 99px;
  transition: width 0.08s linear, transform 0.08s linear;
  transform: translateX(0);
}

/* Screens / overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
  background: rgba(40, 70, 60, 0.28);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* The title must be fully visible on the first frame after the opening ends. */
#screen-title {
  transition: none;
}

#screen-title .panel {
  animation: none;
}

/* Opening PV */
.opening-overlay {
  z-index: 20;
  padding: 0;
  background: #0b1a14;
  backdrop-filter: none;
  flex-direction: column;
}

.opening-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Vertical 9:16 PV — cover fills the phone-shaped app viewport */
  object-fit: cover;
  object-position: center;
  background: #0b1a14;
  z-index: 0;
}

.opening-play-gate {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.opening-play-gate[hidden] {
  display: none !important;
}

.opening-play-btn {
  min-width: 220px;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.opening-play-note {
  margin: 0;
  color: rgba(255, 248, 240, 0.75);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.opening-controls {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 3;
}

button.btn-skip {
  appearance: none;
  border: 1.5px solid rgba(255, 248, 240, 0.45);
  background: rgba(12, 28, 22, 0.55);
  color: #fff8f0;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s;
  letter-spacing: 0.04em;
}

button.btn-skip:hover {
  background: rgba(30, 70, 50, 0.75);
  border-color: rgba(255, 248, 240, 0.75);
}

button.btn-skip:active {
  transform: translateY(1px);
}

.panel {
  width: min(100%, 360px);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
  text-align: center;
  animation: pop-in 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}

@keyframes pop-in {
  from {
    transform: scale(0.92) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.panel h1 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  letter-spacing: 0.04em;
  color: #2a5c3f;
}

.panel .subtitle {
  margin: 0 0 18px;
  font-size: 0.95rem;
  opacity: 0.75;
  line-height: 1.5;
}

.panel p {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  opacity: 0.88;
}

.emoji-hero {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-art {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d8f0fa 0%, #a8d8ea 70%, #8ec8de 100%);
  box-shadow: 0 6px 18px rgba(44, 62, 45, 0.16);
  display: block;
}

.howto {
  text-align: left;
  background: rgba(61, 139, 95, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 0.85rem;
  line-height: 1.55;
}

.howto li {
  margin: 4px 0;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

button.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

button.btn-primary {
  background: linear-gradient(180deg, #5cb87a, #3d8b5f);
  color: white;
}

button.btn-primary:hover {
  background: linear-gradient(180deg, #6bc88a, #46986a);
}

button.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 2px solid rgba(61, 139, 95, 0.25);
  box-shadow: none;
}

.nest-badge {
  display: inline-block;
  margin: 8px 0 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f5d76e, #e87a3a);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 3px 10px rgba(232, 122, 58, 0.35);
}

/* Desktop width */
@media (min-width: 520px) {
  body {
    padding: 12px 0;
  }
  #app {
    height: calc(100% - 24px);
    border-radius: 20px;
    overflow: hidden;
  }
}
