/* filepath: games/one-line/css/style.css */
:root {
  --bg-space: #070913;
  --panel-bg: rgba(18, 22, 38, 0.85);
  --panel-border: rgba(65, 78, 128, 0.4);
  --cyan-main: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.4);
  --gold-main: #ffcf33;
  --text-main: #f0f4fc;
  --text-dim: #8591b6;
  --font-game: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: var(--font-game);
}

.hidden {
  display: none !important;
}

.noscript-tip {
  padding: 16px 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-main);
  background: rgba(255, 42, 112, 0.9);
}

/* 全屏游戏视口：将内容紧凑居中于中轴 */
.game-viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #161b36 0%, var(--bg-space) 85%);
  padding: 16px;
}

/* 紧凑游戏控制台核心框架 */
.game-console {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 680px;
  height: 100%;
  max-height: 840px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  padding: 14px 18px;
  gap: 12px;
}

/* 顶部紧凑 HUD */
.console-hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

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

.game-logo {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--cyan-main), #4facfe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  background: var(--cyan-glow);
  border-color: var(--cyan-main);
}

.lang-text {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--cyan-main);
}

.hud-group-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.hud-k {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hud-v {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.val-highlight {
  color: var(--cyan-main);
}

.hud-progress {
  min-width: 88px;
}

.progress-track {
  width: 100%;
  height: 4px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan-main), #4facfe);
  box-shadow: 0 0 8px var(--cyan-glow);
  transition: width 0.18s ease;
}

.hud-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
}

/* 棋盘主体屏幕 */
.console-screen {
  flex: 1;
  width: 100%;
  position: relative;
  border-radius: 18px;
  background: rgba(10, 13, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  touch-action: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  /* touch-action 不继承：必须落在目标元素上，否则移动端划线会拖动页面 */
  touch-action: none;
}

.status-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 18px;
  border-radius: 20px;
  background: rgba(255, 42, 112, 0.95);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(255, 42, 112, 0.6);
  pointer-events: none;
}

/* 底部操作控制区（紧凑集成） */
.console-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}

.ctrl-pad-btn {
  flex: 1;
  max-width: 140px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-pad-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.ctrl-pad-btn:active {
  transform: scale(0.96);
}

.btn-hint-glow {
  border-color: rgba(255, 207, 51, 0.4);
  color: var(--gold-main);
}

.btn-hint-glow:hover {
  background: rgba(255, 207, 51, 0.15);
  border-color: var(--gold-main);
}

.btn-primary-glow {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
  border-color: var(--cyan-main);
  color: var(--cyan-main);
}

.btn-primary-glow:hover {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.35), rgba(79, 172, 254, 0.35));
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* 模态弹窗 */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 14, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #141829;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card-wide {
  max-width: 520px;
}

.modal-card-accent {
  border-color: var(--cyan-main);
  box-shadow: 0 0 35px var(--cyan-glow);
}

.modal-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.2);
}

.modal-btn-primary, .modal-btn-secondary {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.modal-btn-primary {
  background: linear-gradient(135deg, var(--cyan-main), #4facfe);
  color: #060914;
}

.modal-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

/* 规格切换 */
.size-pill-group {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.size-pill {
  flex: 1;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
}

.size-pill.active {
  background: var(--cyan-main);
  color: #060914;
  border-color: var(--cyan-main);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 10px;
}

.endless-card {
  width: 100%;
  margin-top: 4px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.12), rgba(157, 78, 221, 0.18));
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.endless-card:hover {
  border-color: var(--cyan-main);
  box-shadow: 0 0 14px var(--cyan-glow);
}

.endless-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cyan-main);
}

.endless-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.level-cell {
  height: 68px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
}

.level-cell:hover {
  border-color: var(--cyan-main);
}

.level-cell.active {
  border-color: var(--cyan-main);
  background: rgba(0, 242, 254, 0.12);
}

.level-num {
  font-size: 1.05rem;
  font-weight: 700;
}

.level-stars-mini {
  font-size: 0.7rem;
  color: var(--gold-main);
}

/* 结算卡片 */
.victory-header {
  justify-content: center;
  border: none;
  padding-bottom: 0;
}

.victory-header h2 {
  font-size: 1.4rem;
  color: var(--gold-main);
}

.victory-body {
  align-items: center;
}

.star-rating {
  font-size: 2.4rem;
  color: #272f4e;
  display: flex;
  gap: 8px;
}

.star-icon.full {
  color: var(--gold-main);
  text-shadow: 0 0 14px rgba(255, 207, 51, 0.8);
}

.victory-stats {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
}

.stat-row strong {
  color: var(--cyan-main);
}

.level-cell.locked {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}

.level-cell.locked:hover {
  border-color: var(--panel-border);
}

.level-cell.locked .level-num {
  color: var(--text-dim);
}

/* 无障碍：系统开启"减弱动态效果"时关掉全部过渡与动画 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .ctrl-pad-btn:hover {
    transform: none;
  }

  .ctrl-pad-btn:active {
    transform: none;
  }
}

.victory-footer {
  justify-content: center;
}
