/* ============================================================
   pages/game/boat-harbor-level-1.html 样式（P0-4-T17 <style> 块外联）
   - 页面 style="..." 与 on* 仍在本页（P0-4-T18 整改）
   ============================================================ */

/* Design Token：项目级 Glassmorphism 规范（与 topbar.8d4aa38f.css 一致） */
:root {
  --glass-bg-light:           rgba(255, 255, 255, 0.55);
  --glass-border-light:        rgba(15, 23, 42, 0.06);
  --glass-highlight-light:     rgba(255, 255, 255, 0.6);
  --glass-shadow-light:        rgba(15, 23, 42, 0.06);
  --glass-bg-dark:             rgba(10, 14, 39, 0.72);
  --glass-border-dark:         rgba(255, 255, 255, 0.06);
  --glass-highlight-dark:      rgba(255, 255, 255, 0.08);
  --glass-shadow-dark:         rgba(0, 0, 0, 0.32);
  --glass-blur:                blur(20px) saturate(180%);
}

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #e0f2fe;
    background: #06121f;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
  }

  /* ==== 海洋背景 ==== */
  .ocean {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
      radial-gradient(ellipse 100% 60% at 50% 0%, rgba(14,165,233,0.18) 0%, transparent 55%),
      radial-gradient(ellipse 80% 50% at 80% 100%, rgba(56,189,248,0.10) 0%, transparent 60%),
      radial-gradient(ellipse 60% 40% at 0% 90%, rgba(14,165,233,0.08) 0%, transparent 60%),
      linear-gradient(180deg, #0a2540 0%, #06121f 60%, #03091a 100%);
    pointer-events: none;
  }
  @keyframes rise {
    0%   { transform: translateY(0)     scale(0.8); opacity: 0; }
    10%  { opacity: 0.8; }
    90%  { opacity: 0.6; }
    100% { transform: translateY(-110vh) scale(1.1); opacity: 0; }
  }
  .bubble {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(186,230,253,0.45), rgba(125,211,252,0.05) 70%);
    pointer-events: none;
    z-index: 0;
    animation: rise linear infinite;
  }

  /* ==== 游戏工具条（原自定义顶栏下移；共享顶栏 fixed 悬浮于上方 z-90） ==== */
  .game-toolbar {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 18px 28px;
    /* Glassmorphism（统一引用 design token · 深色玻璃） */
    background: var(--glass-bg-dark);
    border-bottom: 1px solid var(--glass-border-dark);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow:
      inset 0 1px 0 var(--glass-highlight-dark),
      0 8px 32px var(--glass-shadow-dark);
  }
  .btn-exit {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid #facc15;
    border-radius: 6px;
    color: #facc15;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    font-family: inherit;
  }
  .btn-exit:hover { background: #facc15; color: #0c1929; }
  .topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.12em;
    text-shadow: 0 0 18px rgba(56,189,248,0.4);
  }
  .timer {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 22px;
    font-weight: 800;
    color: #fef08a;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 14px rgba(254,240,138,0.4);
    transition: color 0.3s, text-shadow 0.3s;
  }
  .timer .clock { font-size: 18px; }
  .timer.urgent { color: #f87171; text-shadow: 0 0 18px rgba(248,113,113,0.7); animation: pulse-red 0.6s infinite alternate; }
  @keyframes pulse-red {
    to { transform: scale(1.08); text-shadow: 0 0 28px rgba(248,113,113,0.95); }
  }

  /* ==== 状态栏 ==== */
  .stats-bar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 14px 24px;
    background: rgba(6,18,31,0.6);
    border-bottom: 1px solid rgba(14,165,233,0.10);
  }
  .stat {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #bae6fd;
  }
  .stat-icon { width: 22px; height: 22px; flex-shrink: 0; }
  .stat-val { font-size: 17px; font-weight: 800; color: #f0f9ff; min-width: 22px; text-align: left; }
  .stat-target .slash { color: #475569; margin: 0 4px; }

  /* ==== 主游戏区 ==== */
  .game-area {
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 24px 16px;
  }

  /* ==== 棋盘 ==== */
  .board-wrap {
    position: relative;
    padding: 0;
  }
  .board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 110px);
    grid-template-rows: repeat(3, 110px);
    gap: 6px;
    padding: 10px;
    background: rgba(10,37,64,0.55);
    border: 1.5px solid rgba(14,165,233,0.25);
    border-radius: 18px;
    box-shadow:
      0 0 50px rgba(14,165,233,0.12),
      inset 0 0 30px rgba(14,165,233,0.04);
    user-select: none;
    -webkit-user-select: none;
  }
  .cell {
    position: relative;
    background: rgba(14,60,110,0.55);
    border: 1px solid rgba(14,165,233,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
  }
  .cell:hover:not(.has-reef):not(.has-supply) { background: rgba(14,90,160,0.6); border-color: rgba(14,165,233,0.3); }
  .cell.has-reef { cursor: not-allowed; }
  .cell.has-supply { cursor: pointer; }
  .cell.has-boat { cursor: default; }
  /* 可达落点高亮 */
  .cell.reachable::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(34,197,94,0.45);
    box-shadow: 0 0 12px rgba(34,197,94,0.6);
    pointer-events: none;
  }
  .cell.target-supply.reachable::after {
    width: 80px;
    height: 80px;
    background: rgba(34,197,94,0.15);
    border: 3px solid rgba(34,197,94,0.7);
    box-shadow: 0 0 18px rgba(34,197,94,0.5);
  }
  .cell.shake { animation: shake 0.35s; }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
  }

  /* 船 */
  .boat {
    position: relative;
    width: 72px;
    height: 72px;
    animation: bob 2.5s ease-in-out infinite;
  }
  @keyframes bob {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }
  .boat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #facc15, #f59e0b);
    color: #1c1917;
    font-size: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(250,204,21,0.7);
    border: 2px solid #1c1917;
    z-index: 2;
  }

  /* 暗礁 */
  .reef {
    width: 64px;
    height: 64px;
    opacity: 0.85;
    filter: drop-shadow(0 0 8px rgba(239,68,68,0.4));
  }

  /* 物资 */
  .supply {
    width: 72px;
    height: 72px;
    animation: pulse-glow 1.6s ease-in-out infinite;
  }
  @keyframes pulse-glow {
    0%,100% { filter: drop-shadow(0 0 8px rgba(34,197,94,0.5)); }
    50%     { filter: drop-shadow(0 0 16px rgba(34,197,94,0.9)); }
  }

  /* ==== 提示 ==== */
  .hint-box {
    background: rgba(6,18,31,0.9);
    border: 1px solid rgba(14,165,233,0.25);
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 14.5px;
    line-height: 1.6;
    color: #bae6fd;
    text-align: center;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    transition: color 0.2s, border-color 0.2s;
  }
  .hint-box.warn { color: #fcd34d; border-color: rgba(245,158,11,0.4); }

  /* ==== 操作区 ==== */
  .controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px 20px;
    background: rgba(6,18,31,0.6);
    border-top: 1px solid rgba(14,165,233,0.08);
    flex-wrap: wrap;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: rgba(14,165,233,0.1);
    color: #7dd3fc;
    border: 1px solid rgba(14,165,233,0.3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s;
  }
  .btn:hover:not(:disabled) { background: rgba(14,165,233,0.2); color: #f0f9ff; }
  .btn:active:not(:disabled) { transform: translateY(1px); }
  .btn:disabled { opacity: 0.35; cursor: not-allowed; }
  .btn.primary { background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; border-color: #0369a1; }
  .btn.primary:hover { filter: brightness(1.1); }
  .btn .icon { font-size: 14px; }

  /* ==== 弹窗 ==== */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .modal-overlay.show { opacity: 1; }
  .modal-overlay.show .modal { pointer-events: auto; }
  .modal {
    background: linear-gradient(180deg, #0f2744 0%, #0a1c33 100%);
    border: 1px solid rgba(14,165,233,0.3);
    border-radius: 18px;
    padding: 32px 36px 24px;
    text-align: center;
    max-width: 380px;
    width: 88%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 30px rgba(14,165,233,0.15);
    transform: scale(0.9);
    transition: transform 0.3s;
    pointer-events: none;
  }
  .modal-overlay.show .modal { transform: scale(1); }
  .modal-icon { font-size: 56px; margin-bottom: 8px; line-height: 1; }
  .modal-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; color: #fef3c7; }
  .modal-desc { font-size: 14px; color: #7dd3fc; margin-bottom: 22px; line-height: 1.6; }
  .modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
  .btn-modal {
    padding: 10px 22px;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, filter 0.15s, background 0.18s;
  }
  .btn-modal:hover { transform: translateY(-2px); filter: brightness(1.08); }
  .btn-modal:active { transform: translateY(0); }
  .btn-primary { background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; box-shadow: 0 4px 14px rgba(14,165,233,0.4); }
  .btn-secondary { background: rgba(14,165,233,0.12); color: #7dd3fc; border: 1px solid rgba(14,165,233,0.3); }
  .btn-secondary:hover { background: rgba(14,165,233,0.2); }

  /* 响应式 */
  @media (max-width: 600px) {
    .board { grid-template-columns: repeat(3, 92px); grid-template-rows: repeat(3, 92px); }
    .boat, .supply { width: 60px; height: 60px; }
    .reef { width: 54px; height: 54px; }
    .boat-badge { width: 24px; height: 24px; font-size: 14px; }
  }
