/* ==============================
   アルキメデス螺旋 - スタイル
   修正: 単体HTML版から移植する際、グローバルセレクタ（*, html, body）を
   .ars-app にスコープし直し、他ページ・他プラグインへの影響を排除。
   Cocoonテーマ対策として、レイアウトに直結するプロパティに !important を付与。
   ============================== */

  /* ==============================
     修正: UI全面刷新（共通の基本骨格に統一）
     - ホバーで出現する設定パネル + ピン留め方式を廃止
       （タブレット・電子黒板にはホバーが無く操作できないため）
     - 固定ヘッダー + 全画面キャンバス + 右下ツールバー + 設定モーダルに集約
     - 紺 #1e3a5f / 金 #d4af37 のブランド配色に統一
     描画ロジック（螺旋計算・セグメント描画・実時間アニメーション）は変更なし
     ============================== */
  /* 修正: 全称セレクタは .ars-app 内だけに限定（サイト全体を壊さないため） */
.ars-app, .ars-app * { box-sizing: border-box; margin: 0; padding: 0; }

  /* 修正: html/bodyへの適用をやめ、.ars-app自体を全画面固定オーバーレイにする */
  .ars-app {
    position: fixed !important;
    inset: 0 !important;
    height: 100%;
    overflow: hidden;
    font-family: "BIZ UDGothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
    background: #0b1020;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    z-index: 999999; /* Cocoonのヘッダー等より前面に */
  }

  /* ---------- 固定ヘッダー ---------- */
  .ars-header {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(10, 18, 38, 0.72);
    border-bottom: 1px solid rgba(212, 175, 55, 0.35);
    z-index: 10;
  }

  .ars-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .ars-status { display: flex; gap: 8px; align-items: center; }

  .ars-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 13px;
    white-space: nowrap;
  }
  .ars-chip b { font-size: 15px; font-variant-numeric: tabular-nums; }
  .ars-chip-progress b { color: #f4cf5f; }

  /* ---------- キャンバス ---------- */
  .ars-stage {
    position: absolute !important;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse 1200px 600px at 50% 30%, #10203a 0%, #0b1428 55%, #0b1020 100%);
  }
  .ars-stage canvas { display: block; width: 100%; height: 100%; }

  /* ---------- 右下ツールバー ---------- */
  .ars-toolbar {
    position: fixed !important;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
  }
  .ars-tool {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #1e3a5f;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
  }
  .ars-tool:active { transform: scale(0.92); }
  .ars-tool-main { background: #d4af37; color: #16324f; }
  /* 修正: 方向・速度トグル用の文字ラベルボタン */
  .ars-tool-text { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
  .ars-tool-kanji { font-size: 22px; font-weight: 700; }

  /* ---------- 設定パネル ----------
     修正: 中央に大きく表示するモーダルに変更（プレビュー導入により
     左寄せの小さいパネルより見やすさを優先） */
  .ars-modal {
    position: fixed !important;
    inset: 0;
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    background: rgba(10, 18, 38, 0.78);
  }
  .ars-modal.ars-show { display: flex !important; }

  .ars-modal-card {
    background: #fff;
    color: #1e3a5f;
    border-radius: 22px;
    padding: 30px 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  }
  .ars-modal-title {
    font-size: 21px;
    font-weight: 700;
    border-left: 6px solid #d4af37;
    padding-left: 12px;
    margin-bottom: 8px;
  }
  .ars-modal-hint {
    font-size: 13px;
    color: #5b7186;
    line-height: 1.7;
    margin-bottom: 18px;
  }

  .ars-field-group {
    background: #f5f7fa;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
  }
  .ars-field-group-title {
    font-size: 12px;
    font-weight: 700;
    color: #5b7186;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
  }

  /* 修正: 中央大型モーダルに合わせてプレビューも拡大 */
  .ars-preview-wrap { text-align: center; }
  .ars-preview-canvas {
    width: 100%;
    max-width: 460px;
    height: 300px;
    background: #000;
    border-radius: 12px;
    border: 1px solid #dbe2ea;
    margin-top: 4px;
  }

  .ars-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
  }
  .ars-field:first-of-type { margin-top: 0; }
  .ars-field label { font-size: 14px; font-weight: 700; }

  /* 修正: 形状パラメータ(M・N・P)を横並びにして縦スクロールを減らす */
  .ars-field-row {
    display: flex;
    gap: 12px;
  }
  .ars-field-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }
  .ars-field-col label {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
  }
  .ars-field-col input[type="number"] {
    width: 100%;
    padding: 10px 6px;
    font-size: 17px;
    text-align: center;
    border: 2px solid #c6d3e0;
    border-radius: 10px;
    color: #1e3a5f;
  }

  .ars-field input[type="number"],
  .ars-field select {
    width: 130px;
    padding: 9px 10px;
    font-size: 16px;
    text-align: center;
    border: 2px solid #c6d3e0;
    border-radius: 10px;
    color: #1e3a5f;
    background: #fff;
  }
  .ars-field select { text-align: left; cursor: pointer; }
  .ars-field input[type="color"] {
    width: 56px;
    height: 40px;
    padding: 3px;
    border: 2px solid #c6d3e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
  }

  /* 速度ピルボタン */
  .ars-pills {
    display: flex;
    gap: 8px;
  }
  .ars-pill {
    flex: 1;
    padding: 10px 6px;
    border: 2px solid #c6d3e0;
    border-radius: 999px;
    background: #fff;
    color: #1e3a5f;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }
  .ars-pill.ars-selected {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
  }

  .ars-start-btn {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #e3c04c, #d4af37);
    color: #16324f;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.12em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    margin-top: 4px;
  }
  .ars-start-btn:active { transform: scale(0.98); }

  .hidden { display: none !important; }

  /* ---------- レスポンシブ ---------- */
  @media (max-width: 700px) {
    .ars-title { font-size: 14px; }
    .ars-chip { padding: 4px 10px; font-size: 11px; }
    .ars-chip b { font-size: 13px; }
    .ars-tool { width: 48px; height: 48px; font-size: 20px; }
    .ars-field input[type="number"], .ars-field select { width: 110px; }
  }


.hidden { display: none !important; }
