/* ========================================
   炒粉大师 3D — 精品 UI 样式
   ======================================== */

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

:root {
  --primary: #FF6B35;
  --primary-light: #FF9F1C;
  --accent: #FFD700;
  --bg-dark: #2C1A11;
  --text: #FFF5E6;
  --text-dim: rgba(255, 245, 230, 0.6);
  --glass-bg: rgba(0, 0, 0, 0.4);
  --glass-border: rgba(255, 255, 255, 0.12);
  --font-cn: 'Noto Sans SC', sans-serif;
  --font-en: 'Outfit', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: var(--font-cn);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 850px;
  overflow: hidden;
  background: #1c130e;
  box-shadow: 0 0 60px rgba(255, 107, 53, 0.1);
}

@media (min-width: 481px) {
  #game-wrapper {
    border-radius: 16px;
    height: 90vh;
  }
}

/* ---- 3D 渲染容器 ---- */
#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: none;
}

/* ---- 玻璃面板公共类 ---- */
.glass-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(40,20,10,0.6), rgba(20,10,5,0.4));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 2px 20px rgba(255, 107, 53, 0.1);
}

.glass-panel::after {
  content: '';
  position: absolute;
  top: -100%; left: -100%; width: 300%; height: 300%;
  background: linear-gradient(to bottom right, rgba(255,255,255,0) 45%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 55%);
  transform: rotate(30deg);
  animation: glass-shine 5s cubic-bezier(0.19, 1, 0.22, 1) infinite;
  pointer-events: none;
}

/* ---- HUD ---- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.score-text {
  background: linear-gradient(180deg, #FFF, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)) drop-shadow(0 4px 6px rgba(0,0,0,0.8));
}

/* 返回首页按钮 */
.back-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 16px;
  padding: 4px 10px 4px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  font-family: var(--font-cn);
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.back-btn:active {
  transform: scale(0.92);
}

.back-btn svg {
  flex-shrink: 0;
}

.timer-text {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3), 0 2px 5px rgba(0,0,0,0.8);
}

/* --- 提示与连击 --- */
#feedback-container {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.feedback-text {
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  opacity: 0;
  transform: translateY(20px) scale(0.5);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.feedback-text.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.feedback-text.perfect { color: #32CD32; text-shadow: 0 0 10px rgba(50,205,50,0.5); }
.feedback-text.good { color: #FFD700; }
.feedback-text.bad { color: #FF4500; }
.feedback-text.miss { color: #777; }

.combo-text {
  font-size: 16px;
  color: #FF6B35;
  font-weight: bold;
  margin-top: 4px;
}

.combo-text.pop {
  animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ---- 订单卡片 ---- */
#order-info {
  position: absolute;
  top: 15px; /* 放在顶部中间 */
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(40,20,10,0.82), rgba(15,8,2,0.72));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 200, 120, 0.18);
  border-top: 1px solid rgba(255, 220, 150, 0.3);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(255, 107, 53, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  min-width: 180px;
}

.order-header {
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 6px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #FFFBE6, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 3px rgba(255, 215, 0, 0.35));
}

.order-ingredients-list {
  display: flex;
  gap: 6px;
  font-size: 20px;
  margin-bottom: 8px;
}

.ingredient-icon {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.progress-bar {
  width: 150px;
  height: 22px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 11px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 200, 120, 0.12);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--primary),
    var(--primary) 10px,
    var(--accent) 10px,
    var(--accent) 20px
  );
  background-size: 28px 28px;
  box-shadow: 0 0 15px rgba(255, 107, 53, 0.8), inset 0 2px 5px rgba(255, 255, 255, 0.4);
  transition: width 0.1s linear;
  animation: stripe-scroll 1s linear infinite;
}

.progress-bar-fill.pulsing {
  animation: stripe-scroll 1s linear infinite, pulsing-bar 0.5s infinite alternate;
}

.progress-pct {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0px  2px 4px rgba(0,0,0,0.9);
  z-index: 2;
}

/* ---- 操作杆 (lever.js) ---- */
#lever-control {
  position: absolute;
  right: 16px;
  bottom: 0px;
  width: 60px;
  height: 350px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.lever-track {
  position: relative;
  width: 38px;
  height: 300px;
  background: rgba(10, 5, 0, 0.7);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9), inset 0 0 10px rgba(255,107,53,0.1);
  cursor: pointer;
  touch-action: none;
}

.lever-glow {
  position: absolute;
  bottom: 0; left: 0; right: 0; top: 0;
  border-radius: 20px;
  background: linear-gradient(to top, rgba(255,107,53,0.1), transparent);
  pointer-events: none;
}

.lever-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, #ff6b35, #ff9f1c);
  border-radius: 18px;
  opacity: 0.8;
  pointer-events: none;
  transition: height 0.05s linear;
}

.lever-knob {
  position: absolute;
  left: -10px;
  bottom: -24px;
  width: 56px;
  height: 48px;
  background: linear-gradient(180deg, #444, #222);
  border-radius: 10px;
  border: 1px solid #666;
  border-bottom: 3px solid #111;
  box-shadow: 0 4px 10px rgba(0,0,0,0.8), inset 0 2px 2px rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: bottom 0.05s linear;
}

.lever-knob.active {
  background: linear-gradient(180deg, #666, #444);
  box-shadow: 0 0 20px rgba(255, 159, 28, 0.8), inset 0 2px 2px rgba(255,255,255,0.4);
  border-color: #999;
}

.lever-knob-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lever-knob-grip {
  width: 30px;
  height: 3px;
  background: #111;
  border-radius: 2px;
  border-bottom: 1px solid #444;
}

.lever-label {
  font-size: 14px;
  font-weight: bold;
  color: #aaa;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: float 2s infinite ease-in-out;
}

.lever-markers {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 0;
  pointer-events: none;
}

.lever-marker {
  width: 12px;
  height: 2px;
  background: rgba(255,255,255,0.2);
}

/* ---- 调料游戏 ---- */
.overlay-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: rgba(0,0,0,0.5);
}

.seasoning-title {
  font-size: 28px;
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  margin-bottom: 20px;
}

.seasoning-game-container {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

#seasoning-canvas {
  width: 100%;
  height: 100%;
}

.seasoning-instruction-text {
  margin-top: 20px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 1px;
  animation: pulsing-bar 1s infinite alternate;
}

/* ---- 模态框 ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(65,34,22,0.95), rgba(30,16,10,0.95));
}

.menu-content, .result-content, .how-to-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}

.how-to-panel {
  max-width: 90%;
  text-align: left;
  background: rgba(0,0,0,0.6); /* Added slight backing so it's readable if background is brighter */
  border-radius: 12px;
  padding: 20px;
}

.how-to-panel h2 {
  color: var(--accent);
  text-align: center;
}

.how-to-panel ul {
  list-style: none;
  margin: 20px 0;
  font-size: 15px;
  line-height: 1.6;
}

.how-to-panel li { margin-bottom: 12px; }

.dish-modal {
  background: rgba(0,0,0,0.85);
}

.dish-showcase-title {
  color: var(--accent);
  font-size: 32px;
  margin-bottom: 20px;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  animation: pop 0.4s ease-out;
}

.dish-image {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 4px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 20px rgba(255, 159, 28, 0.2);
  margin: 10px 0;
  animation: dish-reveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden; /* 确保 img 被圆形裁切 */
}

/* 菜品展示图 img 标签样式 */
.dish-image-inner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 50%;
  pointer-events: none;
}

.dish-title {
  font-size: 24px;
  font-weight: bold;
  margin-top: 10px;
}

.dish-stars {
  color: var(--accent);
  font-size: 28px;
  letter-spacing: 5px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  margin-top: 5px;
  animation: pop 0.6s 0.2s both;
}

.title-text {
  font-size: 46px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 10px rgba(255, 107, 53, 0.3));
}

.title-emoji { font-size: 52px; }

.primary-btn, .secondary-btn {
  padding: 15px 38px;
  border-radius: 50px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s;
  border: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.secondary-btn {
  background: rgba(255,255,255,0.1);
  color: #ddd;
  border: 1px solid rgba(255,255,255,0.2);
}

.primary-btn:active, .secondary-btn:active { transform: scale(0.95); }

/* SBTI 星海神殿链接按钮 — 推广醒目动画 */
.sbti-link {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 30px;
  background: linear-gradient(135deg, rgba(88, 50, 200, 0.35), rgba(30, 80, 220, 0.3), rgba(120, 40, 180, 0.3));
  border: 1.5px solid rgba(140, 120, 255, 0.45);
  color: #d4c8ff;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  /* 呼吸发光 + 浮动组合动画 */
  animation: sbti-glow 2s ease-in-out infinite, sbti-float 3s ease-in-out infinite;
  transition: all 0.3s ease;
}

/* 流光扫过效果 */
.sbti-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    rgba(200, 180, 255, 0.25),
    transparent
  );
  animation: sbti-shimmer 2.5s ease-in-out infinite;
  pointer-events: none;
}

.sbti-link:hover {
  background: linear-gradient(135deg, rgba(100, 60, 220, 0.5), rgba(40, 100, 240, 0.45));
  border-color: rgba(160, 140, 255, 0.7);
  color: #fff;
  box-shadow: 0 0 25px rgba(100, 80, 220, 0.5), 0 0 60px rgba(100, 80, 220, 0.2);
  transform: translateY(-2px) scale(1.04);
  animation: none;
}

.sbti-link:active {
  transform: translateY(0) scale(0.97);
}

/* 呼吸发光 */
@keyframes sbti-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(120, 80, 255, 0.2), 0 0 20px rgba(120, 80, 255, 0.05);
  }
  50% {
    box-shadow: 0 0 15px rgba(120, 80, 255, 0.45), 0 0 40px rgba(120, 80, 255, 0.15);
  }
}

/* 微浮动 */
@keyframes sbti-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 流光扫过 */
@keyframes sbti-shimmer {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* 按钮加载中状态 */
.primary-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  background: linear-gradient(135deg, #666, #888);
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.primary-btn.loading::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 200%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: loading-shimmer 1.5s infinite;
}

.primary-btn:disabled {
  pointer-events: none;
}

@keyframes loading-shimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ---- 辅助 ---- */
.hidden { display: none !important; }

/* ---- 动画 ---- */
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  80% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulsing-bar {
  from { box-shadow: 0 0 5px rgba(255,107,53,0.5); filter: brightness(1); }
  to { box-shadow: 0 0 20px rgba(255,215,0,0.8); filter: brightness(1.3); }
}

@keyframes dish-reveal {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes glass-shine {
  0% { transform: translateY(-100%) rotate(30deg); }
  100% { transform: translateY(100%) rotate(30deg); }
}

@keyframes stripe-scroll {
  0% { background-position: 0 0; }
  100% { background-position: 28px 0; }
}
