/**
 * 《奶龙大冒险：鸡腿保卫战》- 极简优雅深色毛玻璃 UI 样式表 (style.css)
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #0b0f17;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

canvas,
img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#app-wrapper {
  width: min(1020px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 优雅克制的深色毛玻璃容器 */
.glass-panel {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
}

/* 顶部状态栏 */
#hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.level-pill {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.hud-metric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #e2e8f0;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.metric-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.metric-val,
.hearts-val {
  font-weight: 600;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.state-tag {
  background: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.state-tag.fire-active {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.state-tag.big-active {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.golden-stars {
  color: #fbbf24;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  min-width: 18px;
  text-align: center;
}

/* 统一、克制的现代按钮体系 */
.ui-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  outline: none;
}

.primary-btn {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 600;
  border-color: #fbbf24;
}

.primary-btn:hover {
  background: #fbbf24;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.14);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}

.ghost-btn {
  background: transparent;
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.08);
}

.ghost-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

.large-btn {
  padding: 11px 24px;
  font-size: 15px;
  width: 100%;
}

/* 主画布舞台 */
#canvas-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 顶部轻量关卡提示与语音气泡 */
.tip-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.voice-toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 6px 18px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 13px;
  z-index: 8;
  pointer-events: none;
}

.wind-banner {
  position: absolute;
  top: 48px;
  right: 16px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 5;
}

.hidden {
  display: none !important;
}

/* 模态弹窗层 */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 13, 22, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  padding: 18px;
}

.modal-card {
  width: min(840px, 95%);
  max-height: 92%;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.small-card {
  width: min(380px, 92%);
  text-align: center;
  align-items: center;
}

.menu-card {
  width: min(620px, 94%);
  text-align: center;
  align-items: center;
}

.menu-eyebrow {
  color: #f59e0b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
}

.game-title {
  font-size: 26px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.game-subtitle,
.modal-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 2px;
}

/* 主菜单 5 大角色实时 3D-SDF 像素展台 */
.hero-showcase-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 12px 22px;
  border-radius: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.showcase-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.showcase-item canvas {
  width: 62px;
  height: 62px;
}

.showcase-label {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
}

/* 昵称栏 */
.nickname-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.nickname-bar label {
  font-size: 13px;
  color: #94a3b8;
}

.nickname-bar input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
  width: 170px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.nickname-bar input:focus {
  border-color: #f59e0b;
}

.nick-hint {
  font-size: 12px;
  color: #94a3b8;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(440px, 100%);
}

.menu-secondary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.menu-btn-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.controls-guide {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: #64748b;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
}

/* 弹窗头部 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #f8fafc;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.star-summary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #cbd5e1;
}

.star-summary b {
  color: #fbbf24;
}

/* 30 关世界地图网格 */
.chapters-scroll {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.chapter-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
}

.chapter-block-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.chapter-block-title {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
}

.chapter-block-desc {
  font-size: 12px;
  color: #64748b;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.level-node-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  cursor: pointer;
  color: #e2e8f0;
  font-family: inherit;
  transition: all 0.15s ease;
}

.level-node-btn.unlocked:hover {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.08);
}

.level-node-btn.cleared {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.level-node-btn.boss-node .lvl-num {
  color: #fca5a5;
}

.level-node-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.lvl-num {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.lvl-name {
  font-size: 11px;
  color: #cbd5e1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  margin: 2px 0;
}

.lvl-stars {
  font-size: 12px;
  color: #fbbf24;
  min-height: 15px;
  letter-spacing: 1px;
}

/* 角色图鉴卡片 */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.codex-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.codex-visuals {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 6px;
}

.codex-canvas {
  width: 72px;
  height: 72px;
}

.codex-ref-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.codex-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
}

.codex-card p {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

/* 排行榜表格 */
.leaderboard-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 600;
  border-color: #fbbf24;
}

.table-wrap {
  overflow-x: auto;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.clean-table th,
.clean-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 12px;
  text-align: left;
}

.clean-table th {
  color: #64748b;
  font-weight: 500;
  font-size: 12px;
}

.clean-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-row {
  text-align: center !important;
  color: #64748b;
  padding: 28px !important;
}

/* 结算弹窗 */
.result-stars-big {
  font-size: 28px;
  color: #fbbf24;
  letter-spacing: 6px;
  min-height: 32px;
}

.result-stats-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 16px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 13px;
}

.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.stat-cell span {
  font-size: 11px;
  color: #64748b;
}

.stat-cell b {
  font-size: 15px;
  color: #f8fafc;
}

/* 底部控制与天气说明栏 */
#touch-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  gap: 10px;
  flex-wrap: wrap;
}

.dpad-group,
.action-group {
  display: flex;
  gap: 8px;
}

.pad-btn {
  min-width: 88px;
}

.status-hint {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 760px) {
  .level-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .menu-secondary-row {
    grid-template-columns: 1fr;
  }
}
