:root {
  --bg-dark: #0f101a;
  --bg-accent: #1d1836;
  --ebi-orange: #ff5733;
  --ebi-coral: #ff8d6b;
  --ebi-red: #d9261c;
  --ebi-gold: #ffd166;
  --text-main: #fffaf5;
  --text-muted: #b8b2c8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: radial-gradient(circle at 50% 35%, var(--bg-accent) 0%, var(--bg-dark) 80%);
  color: var(--text-main);
  user-select: none;
  -webkit-user-select: none;
}

/* 3D モード時のディスコライティング演出 */
body.party-mode {
  animation: discoBg 6s infinite alternate ease-in-out;
}

@keyframes discoBg {
  0%   { background: radial-gradient(circle at 30% 30%, #2a1235 0%, #090a12 85%); }
  50%  { background: radial-gradient(circle at 70% 40%, #102a3b 0%, #090a12 85%); }
  100% { background: radial-gradient(circle at 50% 60%, #3b1c10 0%, #090a12 85%); }
}

/* 3D キャンバス */
#canvas3d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

body.party-mode #canvas3d {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

/* メインコンテナ */
.container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 1.5rem;
  text-align: center;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.title {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.title span {
  color: var(--ebi-orange);
  font-weight: 600;
}

.subtitle {
  margin-top: 0.5rem;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  color: var(--text-muted);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* 2D 海老イラストステージ */
.shrimp-stage {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 1.2rem 0;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.party-mode .shrimp-stage {
  opacity: 0;
  transform: scale(0.2) rotate(25deg);
  height: 30px;
  margin: 0.2rem 0;
}

.shrimp-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 12px 24px rgba(255, 71, 51, 0.25));
}

/* 2D 海老のダンスアニメーション */
.shrimp-actor {
  transform-origin: 120px 145px;
  animation: ebiDance 0.65s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.shrimp-shadow {
  transform-origin: 120px 215px;
  animation: shadowPulse 0.65s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.tail {
  transform-origin: 112px 180px;
  animation: tailSnap 0.325s infinite alternate ease-in-out;
}

.antenna.a1 {
  transform-origin: 95px 55px;
  animation: antennaWave 0.65s infinite alternate ease-in-out;
}

.antenna.a2 {
  transform-origin: 88px 65px;
  animation: antennaWave 0.65s infinite alternate-reverse ease-in-out;
}

.leg {
  transform-origin: 115px 125px;
  animation: legWiggle 0.2s infinite alternate ease-in-out;
}
.leg.l2, .leg.l4 {
  animation-direction: alternate-reverse;
}

@keyframes ebiDance {
  0% {
    transform: translateY(8px) rotate(-9deg) scale(1.04, 0.94);
  }
  50% {
    transform: translateY(-20px) rotate(4deg) scale(0.96, 1.06);
  }
  100% {
    transform: translateY(-6px) rotate(12deg) scale(1.02, 0.98);
  }
}

@keyframes shadowPulse {
  0%   { transform: scale(1.1, 1); opacity: 0.3; }
  50%  { transform: scale(0.7, 0.7); opacity: 0.12; }
  100% { transform: scale(0.9, 0.85); opacity: 0.22; }
}

@keyframes tailSnap {
  0%   { transform: rotate(-14deg); }
  100% { transform: rotate(16deg); }
}

@keyframes antennaWave {
  0%   { transform: rotate(-12deg); }
  100% { transform: rotate(14deg); }
}

@keyframes legWiggle {
  0%   { transform: rotate(-8deg); }
  100% { transform: rotate(10deg); }
}

/* 音符アニメーション */
.music-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.note {
  position: absolute;
  font-size: 1.6rem;
  color: var(--ebi-gold);
  opacity: 0;
  animation: floatNote 1.8s infinite ease-out;
}

.note.n1 { left: 15%; top: 30%; animation-delay: 0s; }
.note.n2 { right: 12%; top: 25%; animation-delay: 0.6s; color: var(--ebi-coral); }
.note.n3 { left: 28%; top: 10%; animation-delay: 1.2s; }

@keyframes floatNote {
  0%   { transform: translateY(15px) scale(0.6) rotate(-15deg); opacity: 0; }
  30%  { opacity: 0.95; }
  100% { transform: translateY(-35px) scale(1.15) rotate(15deg); opacity: 0; }
}

/* ボタン・コントロール類 */
.controls {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.btn-dance {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 2.6rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #ff7a59 0%, #ff3b1f 55%, #d91c1c 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 10px 28px rgba(255, 68, 34, 0.45),
    0 0 0 4px rgba(255, 122, 89, 0.2),
    inset 0 2px 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.btn-dance:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 14px 34px rgba(255, 68, 34, 0.65),
    0 0 0 6px rgba(255, 122, 89, 0.3),
    inset 0 2px 2px rgba(255, 255, 255, 0.5);
}

.btn-dance:active {
  transform: translateY(1px) scale(0.97);
}

.btn-icon {
  font-size: 1.5rem;
  display: inline-block;
  animation: iconBounce 0.8s infinite alternate ease-in-out;
}

@keyframes iconBounce {
  from { transform: translateY(2px) rotate(-10deg); }
  to   { transform: translateY(-4px) rotate(15deg); }
}

.party-subcontrols {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.party-subcontrols[hidden] {
  display: none;
}

.btn-sub {
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-sub:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}

.btn-sub:active {
  transform: translateY(0);
}

/* 3Dモード時はUIを画面下部にすっきり寄せる */
body.party-mode .container {
  justify-content: space-between;
  padding: 2rem 1.5rem 4.2rem;
}

/* 画面下部のFPS・海老数ステータスバー */
.stats-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 1.25rem;
  background: rgba(15, 16, 26, 0.72);
  border: 1px solid rgba(255, 141, 107, 0.35);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  z-index: 10;
  font-variant-numeric: tabular-nums;
}

.stats-bar[hidden] {
  display: none;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ebi-coral);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ebi-gold);
  min-width: 2ch;
  text-align: right;
}

.stat-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.2);
}

