/*
 * alchemist-base.css
 *
 * あるけみすと ベースデザイン定義
 * - デザイントークン（CSS変数）の一元管理
 * - Bootstrap 5 と競合しない独自コンポーネント
 * - 個別ページ・ゲーム固有スタイルはここに書かない
 *
 * 使用方法:
 *   <link rel="stylesheet" href="{% static 'alchemist-base.css' %}">
 *   ※ bootstrap.min.css の後に読み込むこと
 */

/* ==========================================================================
   1. デザイントークン（CSS変数）
   ========================================================================== */

:root {
  /* --- ブランドカラー --- */
  --al-color-primary:   #a81caf; /* メインカラー（マゼンタ） */
  --al-color-primary-dark: #8d1393;
  --al-color-primary-darker: #740e78;

  /* --- やさしいカラーパレット --- */
  --al-color-lavender:  #c4a3d4;
  --al-color-lavender-dark: #a890c0;
  --al-color-sky:       #97baf1;
  --al-color-sky-dark:  #76a8ee;
  --al-color-mint:      #4db6ac;
  --al-color-mint-dark: #3da09a;
  --al-color-peach:     #ffc98c;
  --al-color-peach-dark: #ffb56d;
  --al-color-rose:      #ffb7c6;
  --al-color-rose-dark: #ffa1b3;
  --al-color-sand:      #dde3b6;
  --al-color-sand-dark: #d2dca1;

  /* --- テキスト --- */
  --al-color-text-primary:   #2D2A26;
  --al-color-text-secondary: #5C5850;
  --al-color-text-muted:     #A8A49C;
  --al-color-text-on-dark:   #ffffff;

  /* --- 背景・サーフェス --- */
  --al-color-surface:        #FDFBF7;
  --al-color-surface-card:   rgba(255, 255, 255, 0.85);
  --al-color-surface-subtle: rgba(240, 240, 240, 0.6);
  --al-color-surface-border: rgba(168, 161, 161, 0.4);

  /* --- ステータスカラー（ランク） --- */
  --al-color-rank-f: #494969;
  --al-color-rank-e: #008000;
  --al-color-rank-d: #8B0000;
  --al-color-rank-c: #0000cd;
  --al-color-rank-b: #DF6C00;
  --al-color-rank-a: #FF0000;
  --al-color-rank-s: #9932cc;

  /* --- 増減カラー（入金・出金など数値の正負） --- */
  --al-color-amount-plus:  #3336f3;
  --al-color-amount-minus: #f3335d;

  /* --- バッジ/アクセント --- */
  --al-color-badge-lavender: #c4a3d4;

  /* --- スペーシング（固定値） --- */
  --al-space-xs:  4px;
  --al-space-s:   8px;
  --al-space-m:  16px;
  --al-space-l:  24px;
  --al-space-xl: 32px;
  --al-space-xxl: 48px;

  /* --- レスポンシブ余白トークン（画面幅に応じて連続縮小） ---
     使用指針:
       --al-pad-page    : ページ外枠コンテナの padding
       --al-pad-card    : カード/ボックス内の padding
       --al-pad-cell    : テーブルセル・入力フィールドの padding
       --al-pad-btn     : 通常ボタンの padding（縦 横）
       --al-pad-btn-sm  : 小ボタンの padding（縦 横）
       --al-gap-section : セクション間の margin
       --al-gap-item    : 項目間の gap */
  --al-pad-page:    clamp(10px, 3vw, 25px);
  --al-pad-card:    clamp(8px, 2vw, 16px);
  --al-pad-cell:    clamp(6px, 1.5vw, 12px);
  --al-pad-btn:     clamp(5px, 1.2vw, 6px) clamp(10px, 2.5vw, 18px);
  --al-pad-btn-sm:  clamp(3px, 0.8vw, 5px) clamp(8px, 2vw, 12px);
  --al-gap-section: clamp(14px, 3vw, 25px);
  --al-gap-item:    clamp(6px, 1.5vw, 12px);

  /* --- ボーダー半径 --- */
  --al-radius-s:    4px;
  --al-radius-m:    8px;
  --al-radius-l:   12px;
  --al-radius-full: 9999px;

  /* --- シャドウ --- */
  --al-shadow-card:     0 2px 8px rgba(45, 42, 38, 0.08);
  --al-shadow-floating: 0 4px 16px rgba(45, 42, 38, 0.12);
  --al-shadow-primary:  0 2px 4px rgba(168, 28, 175, 0.25);

  /* --- タイポグラフィ --- */
  --al-font-size-xs: 12px;
  --al-font-size-s:  14px;
  --al-font-size-m:  16px;
  --al-font-size-l:  18px;
  --al-font-size-xl: 24px;

  /* --- Z-index --- */
  --al-z-sticky: 100;
  --al-z-modal:  1000;
  --al-z-toast:  1100;
}


/* ==========================================================================
   2. ランクカラー・増減カラー（クラス）
   ========================================================================== */

.al-rank-f { color: var(--al-color-rank-f); }
.al-rank-e { color: var(--al-color-rank-e); }
.al-rank-d { color: var(--al-color-rank-d); }
.al-rank-c { color: var(--al-color-rank-c); }
.al-rank-b { color: var(--al-color-rank-b); }
.al-rank-a { color: var(--al-color-rank-a); }
.al-rank-s { color: var(--al-color-rank-s); }

/* 金額などの増減表示。プラス（入金・増加）は青、マイナス（出金・減少）は赤 */
.al-amount-plus  { color: var(--al-color-amount-plus);  font-weight: bold; }
.al-amount-minus { color: var(--al-color-amount-minus); font-weight: bold; }


/* ==========================================================================
   3. ボタン（Bootstrap 非依存）
   ==========================================================================
   使い方: class="btn-al btn-alchemist-mint"
   btn-al  → 基底スタイル（形・サイズ・クロスブラウザ対応）
   btn-alchemist-* → 色の指定
   ========================================================================== */

/* --- 基底クラス（クラシックスタイル） --- */
.btn-al {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  padding: 0.3rem 0.9rem;
  font-size: 0.95rem;
  font-weight: normal;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  color: #000;
  background-color: #e8e8e8;
  border: 1px solid #555;
  border-radius: 0;
  /* ベベル効果（上・左: 明るく / 下・右: 暗く） */
  /* クロスブラウザ対応 */
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  box-sizing: border-box;
}

.btn-al:hover {
  background-color: #d8d8d8;
}

.btn-al:focus-visible {
  outline: 2px dotted #555;
  outline-offset: 2px;
}

/* 押下時：ベベルを反転して沈み込む演出 */
.btn-al:active {
  background-color: #cccccc;
  transform: translateY(1px);
}

.btn-al:disabled,
.btn-al[disabled] {
  cursor: not-allowed;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    #b5b5b5,
    #b5b5b5 4px,
    #a5a5a5 4px,
    #a5a5a5 8px
  ) !important;
  color: #fff !important;
  border: 1px solid #555 !important;
  text-shadow: 0 0 2px #666, 0 0 2px #666, 0 0 2px #666;
  box-shadow: none;
}

/* サイズ修飾子 */
.btn-al-sm { padding: 0.15rem 0.45rem; font-size: 0.85rem; }
/* .btn-al-sm-gray: .btn-al-sm と同サイズだが、青ボタンモードの上書き対象外（常にグレー維持） */
.btn-al-sm-gray { padding: 0.15rem 0.45rem; font-size: 0.85rem; }
.btn-al-lg { padding: 0.5rem 1.5rem; font-size: 1.1rem; }
.btn-al-block { width: 100%; }

/* --- 青ボタンモード（マイカスタム） ---
 * body.blue-button-mode が付いた場合、色指定のない .btn-al-sm を iOS風の青ボタンに上書き
 * モバイル画面 (max-width: 767px) のみ有効
 * 色付きバリアント (.btn-al-danger / .btn-alchemist / .btn-alchemist-*) は除外
 */
@media (max-width: 767px) {
  body.blue-button-mode .btn-al.btn-al-sm:not(.btn-al-danger):not(.btn-alchemist):not([class*="btn-alchemist-"]):not([class*="btn-al-outline-"]) {
    color: #fff;
    background-color: #007aff;
    background-image: none;
    border: none;
    border-radius: 9999px;
    box-shadow: inset 0 0 0 1px #fff;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
  body.blue-button-mode .btn-al.btn-al-sm:not(.btn-al-danger):not(.btn-alchemist):not([class*="btn-alchemist-"]):not([class*="btn-al-outline-"]):hover {
    background-color: #0062cc;
  }
  body.blue-button-mode .btn-al.btn-al-sm:not(.btn-al-danger):not(.btn-alchemist):not([class*="btn-alchemist-"]):not([class*="btn-al-outline-"]):active {
    background-color: #0051a8;
  }
}

/* --- 危険ボタン（削除等）--- */
.btn-al-danger {
  color: #fff;
  background-color: #e74c3c;
  border-color: #c0392b;
}
.btn-al-danger:hover { background-color: #d63527; }
.btn-al-danger:active {
  background-color: #c0392b;
}

/*
 * カラーボタン（.btn-al と組み合わせて使う）
 * .btn-al でベベル形状・サイズ・クロスブラウザ対応済み
 * ここでは色だけを上書きする
 */

/* カラーボタン共通：太字 */
.btn-alchemist,
.btn-alchemist-lavender,
.btn-alchemist-sky,
.btn-alchemist-mint,
.btn-alchemist-orange,
.btn-alchemist-rose,
.btn-alchemist-sand,
.btn-alchemist-gray {
  font-weight: 400;
}

/* --- ブランドカラー（マゼンタ） --- */
.btn-alchemist {
  color: #fff;
  background-color: #a81caf;
  border-color: #7c117f;
}
.btn-alchemist:hover { background-color: #8d1393; }
.btn-alchemist:active {
  background-color: #740e78;
}

/* --- Lavender --- */
.btn-alchemist-lavender {
  color: #fff;
  background: linear-gradient(to bottom, #aa66e8 45%, #8844cc 55%);
  border-color: #6630a0;
}
.btn-alchemist-lavender:hover { background: linear-gradient(to bottom, #9955d8 45%, #7733bb 55%); }
.btn-alchemist-lavender:active { background: #6630a0; }


/* --- Sky --- */
.btn-alchemist-sky {
  color: #fff;
  background: linear-gradient(to bottom, #1c7df6 45%, #1573ec 55%);
  border-color: #0f5dc4;
}
.btn-alchemist-sky:hover { background: linear-gradient(to bottom, #1471e4 45%, #0d68d8 55%); }
.btn-alchemist-sky:active { background: #0f5dc4; }

/* --- Mint --- */
.btn-alchemist-mint {
  color: #fff;
  background: linear-gradient(to bottom, #28c8b4 45%, #0da898 55%);
  border-color: #087870;
}
.btn-alchemist-mint:hover { background: linear-gradient(to bottom, #1cb8a4 45%, #089888 55%); }
.btn-alchemist-mint:active { background: #087870; }

/* --- オレンジ（補助アクション・機能への誘導）---
 * 淡い桃色ではなく、はっきりしたオレンジ。かつて peach と呼んでいたが
 * 名前と実体が合っていなかったため orange へ改名した。 */
.btn-alchemist-orange {
  color: #fff;
  background: linear-gradient(to bottom, #ff9030 45%, #e86800 55%);
  border-color: #b04800;
}
.btn-alchemist-orange:hover { background: linear-gradient(to bottom, #ee8020 45%, #cc5800 55%); }
.btn-alchemist-orange:active { background: #b04800; }

/* --- Rose --- */
.btn-alchemist-rose {
  color: #fff;
  background: linear-gradient(to bottom, #ee4888 45%, #cc2060 55%);
  border-color: #a01048;
}
.btn-alchemist-rose:hover { background: linear-gradient(to bottom, #dc3878 45%, #b81050 55%); }
.btn-alchemist-rose:active { background: #a01048; }

/* --- Gray --- */
.btn-alchemist-gray {
  color: #fff;
  background: linear-gradient(to bottom, #989898 45%, #707070 55%);
  border-color: #484848;
}
.btn-alchemist-gray:hover { background: linear-gradient(to bottom, #888888 45%, #606060 55%); }
.btn-alchemist-gray:active { background: #484848; }

/* --- Sand --- */
.btn-alchemist-sand {
  color: #000;
  background: linear-gradient(to bottom, #ecc400 45%, #e0bc00 55%);
  border-color: #b88800;
}
.btn-alchemist-sand:hover { background: linear-gradient(to bottom, #d8b400 45%, #ccac00 55%); }
.btn-alchemist-sand:active { background: #b88800; }

/*
 * アウトラインボタン（.btn-al と組み合わせて使う）
 * 背景透明、枠と文字色を同色にした軽量ボタン
 */
.btn-al-outline-rose,
.btn-al-outline-mint,
.btn-al-outline-sky {
  background: transparent;
  font-weight: 600;
}
.btn-al-outline-rose { color: #c01858; border-color: #c01858; }
.btn-al-outline-rose:hover { background: rgba(192, 24, 88, 0.08); }
.btn-al-outline-rose:active { background: rgba(192, 24, 88, 0.18); }

.btn-al-outline-mint { color: #088878; border-color: #088878; }
.btn-al-outline-mint:hover { background: rgba(8, 136, 120, 0.08); }
.btn-al-outline-mint:active { background: rgba(8, 136, 120, 0.18); }

.btn-al-outline-sky { color: #1070d0; border-color: #1070d0; }
.btn-al-outline-sky:hover { background: rgba(16, 112, 208, 0.08); }
.btn-al-outline-sky:active { background: rgba(16, 112, 208, 0.18); }

/* --- X（旧Twitter）風ボタン --- */
.btn-x-outline {
  color: #111;
  background-color: transparent;
  border: 1px solid #111;
  font-weight: 600;
  border-radius: 0.375rem;
}
.btn-x-outline:hover {
  color: #fff;
  background-color: #111;
  border-color: #111;
}
.btn-x-outline:focus,
.btn-x-outline.focus {
  color: #111;
  background-color: transparent;
  border-color: #111;
  box-shadow: 0 0 0 0.25rem rgba(17, 17, 17, 0.2);
}
.btn-x-outline svg { margin-right: 0.35em; }

/* --- テーブル内用スリムボタン（btn-al + btn-al-table で使う） --- */
.btn-al-table {
  padding: 0 0.6rem;
  font-size: 0.85rem;
  height: 1.9rem;
  line-height: 1;
}

/* --- goback_template.html スコープ適用（ラッパーで opt-in） --- */
/* al-section と同じ左右パディング（0.2rem）にして、ボタン列の左端が
 * セクション内コンテンツの左端と揃うようにする */
.al-goback {
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}
.al-goback .d-flex { gap: 0.25rem 0.4rem !important; }
.al-goback input[type="submit"],
.al-goback input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.85rem;
  font-weight: normal;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  color: #000;
  background-color: #e8e8e8;
  background-image: linear-gradient(to bottom, #f2f2f2, #dedede);
  border: 1px solid #333;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  box-sizing: border-box;
}
.al-goback input[type="submit"]:hover,
.al-goback input[type="button"]:hover {
  background-color: #d8d8d8;
  background-image: linear-gradient(to bottom, #e8e8e8, #cecece);
}

/* 画面幅に応じて伸縮する入力欄。狭い画面でも入力できる幅を保ち、
   広い画面では伸びすぎないようにする */
.al-field-fluid {
  width: clamp(6rem, 30vw, 18rem);
}

/* --- カスタムラジオボタン --- */
.al-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1em;
  height: 1.1em;
  border: 2px solid #aaa;
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 0.3em;
  flex-shrink: 0;
  background-color: #fff;
  transition: border-color 0.15s;
}
.al-radio:hover {
  border-color: #659ceb;
}
.al-radio:checked {
  border-color: #659ceb;
  background-image: radial-gradient(circle, #659ceb 38%, transparent 42%);
}
.al-radio:focus-visible {
  outline: 2px solid #659ceb;
  outline-offset: 2px;
}

/* --- カスタムチェックボックス --- */
/* mystyle2.css の input[type="checkbox"] が16px固定なので、詳細度を上げて上書きする */
input[type="checkbox"].al-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.7em;
  height: 1.7em;
  border: 2px solid #aaa;
  border-radius: var(--al-radius-s);
  cursor: pointer;
  vertical-align: middle;
  margin-right: 0.3em;
  flex-shrink: 0;
  background-color: #fff;
  transition: border-color 0.15s;
}
input[type="checkbox"].al-checkbox:hover {
  border-color: #659ceb;
}
input[type="checkbox"].al-checkbox:checked {
  border-color: #659ceb;
  background-color: #659ceb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.5 3.5L13 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 84%;
}
input[type="checkbox"].al-checkbox:focus-visible {
  outline: 2px solid #659ceb;
  outline-offset: 2px;
}

/* --- 段階選択（アンケートの尺度） --- */
/* 選択肢を横一列に並べる。列幅は等分なので、狭い画面ではラベルが折り返して縮む。 */
.al-scale {
  display: grid;
  grid-template-columns: repeat(var(--al-scale-columns, 5), 1fr);
  gap: var(--al-space-xs);
}
/* 回答済みの内容を等分のセルで並べる。半端な3列にせず、4列か2列だけを取る */
.al-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--al-space-xs);
}
@media (max-width: 767px) {
  .al-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.al-summary-icon {
  font-size: 1.1rem;
  color: var(--al-color-text-secondary);
}

/* ナビの発言。チャット画面のナビ色に合わせる */
.al-navi-message {
  color: rgba(209, 44, 85, 0.781);
  word-wrap: break-word;
}

/* 順位を示す王冠。金・銀・銅の色と、冠の中に重ねた数字で順位を示す */
.al-rank-crown {
  position: relative;
  display: inline-block;
  line-height: 1;
}
.al-rank-crown .fa-crown {
  font-size: 1.6rem;
}
.al-rank-crown-number {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.15em;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}
.al-rank-crown-1 {
  color: #d4af37;
}
.al-rank-crown-2 {
  color: #9aa0a6;
}
.al-rank-crown-3 {
  color: #b87333;
}

/* 幅いっぱいに広げつつ、広い画面で間延びさせない表 */
.al-table-bounded {
  width: 100%;
  max-width: 40rem;
}

/* 割合を横棒で見せる。行ごとにgridを作ると列幅がそろわないため、
   親を1つのgridにして各行はcontentsで溶かす */
.al-bar-list {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 3px var(--al-space-s);
}
.al-bar-row {
  display: contents;
}
.al-bar-track {
  height: 0.9rem;
  border: 1px solid var(--al-color-surface-border);
  border-radius: var(--al-radius-s);
  background-color: var(--al-color-surface-subtle);
  overflow: hidden;
}
.al-bar-fill {
  display: block;
  height: 100%;
  background-color: var(--al-color-sky-dark);
}
.al-bar-value {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 一覧カードの左に置く画像枠。画像の大きさが違っても本文の開始位置が揃う */
.al-card-thumb {
  display: flex;
  justify-content: center;
  min-width: 96px;
}

/* 国旗。背景が透ける画像もあるので枠で輪郭を出す */
.al-country-flag {
  border: 1px solid var(--al-color-surface-border);
  vertical-align: middle;
}
.al-scale-option,
.al-summary-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--al-space-xs) 2px;
  border: 1px solid var(--al-color-surface-border);
  border-radius: var(--al-radius-m);
  background-color: var(--al-color-surface-card);
  text-align: center;
  line-height: 1.3;
}
label.al-scale-option {
  cursor: pointer;
}
.al-scale-option:hover {
  border-color: #659ceb;
}
.al-scale-option:has(.al-radio:checked) {
  border-color: #659ceb;
  background-color: rgba(101, 156, 235, 0.12);
}
.al-scale-option .al-radio {
  margin-right: 0;
}
.al-scale-value {
  font-weight: bold;
  font-size: clamp(0.9rem, 3.4vw, 1rem);
}
.al-scale-label {
  font-size: clamp(0.8rem, 3vw, 0.85rem);
  color: var(--al-color-text-secondary);
}

/* --- カスタムトグルスイッチ --- */
.al-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 2.4em;
  height: 1.3em;
  border-radius: 9999px;
  background-color: #ccc;
  border: 1px solid #aaa;
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  transition: background-color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.al-switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0.2em;
  transform: translateY(-50%);
  width: 0.9em;
  height: 0.9em;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: left 0.2s;
}
.al-switch:checked {
  background-color: #659ceb;
  border-color: #3a7bd5;
}
.al-switch:checked::after {
  left: calc(100% - 1.1em);
}
.al-switch:focus-visible {
  outline: 2px solid #659ceb;
  outline-offset: 2px;
}
.al-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  cursor: pointer;
  font-size: 0.9rem;
}

/* --- ヒントボタン --- */
.al-hint-btn {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  color: #fff;
  /* 黄系グラデ上で読みやすく、縁取りは一段柔らかめ */
  text-shadow:
    -1px -1px 0 rgba(48, 44, 38, 0.52),
    1px -1px 0 rgba(48, 44, 38, 0.52),
    -1px 1px 0 rgba(48, 44, 38, 0.52),
    1px 1px 0 rgba(48, 44, 38, 0.52),
    0 1px 2px rgba(0, 0, 0, 0.16);
}
.al-hint-btn:hover {
  text-shadow:
    -1px -1px 0 rgba(42, 38, 34, 0.6),
    1px -1px 0 rgba(42, 38, 34, 0.6),
    -1px 1px 0 rgba(42, 38, 34, 0.6),
    1px 1px 0 rgba(42, 38, 34, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

/* --- 汎用infoボタン（押すと説明モーダルを表示） --- */
.al-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  border: 1px solid #1070d0;
  border-radius: 50%;
  background: #fff;
  color: #1070d0;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.al-info-btn::before {
  content: "i";
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.85rem;
}
.al-info-btn:hover {
  background: #1070d0;
  color: #fff;
}

/* --- ヒントモーダル --- */
.al-hint-modal .modal-header {
  background-color: #f5f0ff;
  border-bottom: 1px solid #d9c2e8;
}
.al-hint-modal .modal-title {
  font-size: 1rem;
  font-weight: 700;
}
.al-hint-modal .al-hint-section {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: rgba(245, 240, 252, 0.85);
  border: 1px solid rgba(168, 28, 175, 0.14);
  border-radius: var(--al-radius-m);
}
.al-hint-modal .al-hint-section-title {
  font-weight: 700;
  font-size: 0.95rem;
  border-left: 3px solid var(--al-color-primary);
  padding-left: 0.45em;
  margin-bottom: 0.45rem;
  color: var(--al-color-text-primary);
}
.al-hint-modal .al-hint-section > p {
  line-height: 1.6;
  margin-bottom: 0;
}
.al-hint-modal .al-hint-section > p + p {
  margin-top: 0.35rem;
}
.al-hint-modal ul {
  padding-left: 1.2em;
  margin: 0;
  font-size: 0.9rem;
}
.al-hint-modal li { margin-bottom: 0.25rem; }

/* --- 汎用infoモーダル（青系配色） --- */
.al-info-modal .modal-header {
  background-color: #eaf3fd;
  border-bottom: 1px solid #b9d7f5;
}
.al-info-modal .modal-title {
  color: #0f5aa8;
}
.al-info-modal .al-hint-section {
  background: rgba(234, 243, 253, 0.85);
  border: 1px solid rgba(16, 112, 208, 0.18);
}
.al-info-modal .al-hint-section-title {
  border-left-color: #1070d0;
}

/* --- テキストボタン --- */
.btn-al-text {
  background-color: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0 0.2em;
}


/* ==========================================================================
   4. アラート（Bootstrap 非依存）
   ========================================================================== */

.al-alert {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--al-radius-m);
  border: 1px solid transparent;
  margin-bottom: var(--al-space-m);
  font-size: 0.95rem;
  line-height: 1.5;
}

.al-alert-success {
  background-color: #d1f0d8;
  border-color: #a3dba8;
  color: #1a5c28;
}
.al-alert-warning {
  background-color: #fff3cd;
  border-color: #ffe08a;
  color: #7a5c00;
}
.al-alert-danger {
  background-color: #fde8e8;
  border-color: #f5aaaa;
  color: #8b1a1a;
}
.al-alert-info {
  background-color: #ddeeff;
  border-color: #aaccf0;
  color: #1a3a5c;
}


/* ==========================================================================
   6. バッジ（Bootstrap 非依存）
   ========================================================================== */

.al-badge {
  display: inline-block;
  padding: 0.3em 0.7em;
  font-size: 0.8em;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  border-radius: 9999px;
  border: 1px solid transparent;
  vertical-align: middle;
}

/* カウント・中立（sand系） */
.al-badge-neutral {
  background: linear-gradient(to bottom, #a0c000 45%, #7a9800 55%);
  border-color: #587000;
  color: #fff;
}
/* 情報・フィルター（sky系） */
.al-badge-info {
  background: linear-gradient(to bottom, #44a0f8 45%, #1a80e0 55%);
  border-color: #1060b8;
  color: #fff;
}
/* ラベンダー */
.al-badge-lavender {
  background: linear-gradient(to bottom, #aa66e8 45%, #8844cc 55%);
  border-color: #6630a0;
  color: #fff;
}
/* お気に入り（peach系） */
.al-badge-favorite {
  background: linear-gradient(to bottom, #ff8820 45%, #e06000 55%);
  border-color: #b04800;
  color: #fff;
}
/* 装備中（mint系） */
.al-badge-equipped {
  background: linear-gradient(to bottom, #28c8b4 45%, #10a090 55%);
  border-color: #087870;
  color: #fff;
}
/* グレー */
.al-badge-gray {
  background: linear-gradient(to bottom, #808080 45%, #606060 55%);
  border-color: #404040;
  color: #fff;
}

/* 大きめバッジ */
.al-badge-lg {
  padding: 0.4em 0.9em;
  font-size: 0.95em;
  line-height: 1;
}

/* 旧 Bootstrap badge との共存（既存ページ影響なし） */

.badge.bg-alchemist-lavender,
.bg-alchemist-lavender { background-color: var(--al-color-badge-lavender); color: #333; }
.text-alchemist-lavender { color: var(--al-color-badge-lavender); }

.bg-alchemist { background-color: var(--al-color-primary); color: #fff; }


/* ==========================================================================
   7. カード（.al-card）
   ========================================================================== */

.al-card {
  background-color: var(--al-color-surface-card);
  border-radius: 0.375rem;
  box-shadow: none;
  border: 1px solid var(--al-color-surface-border);
  padding: var(--al-space-s) var(--al-space-m);
  margin-bottom: var(--al-space-s);
}

.al-card-header {
  margin-bottom: var(--al-space-s);
  padding-bottom: var(--al-space-xs);
  border-bottom: 1px solid var(--al-color-surface-border);
  font-weight: 700;
}

/* 旧来の行背景と馴染ませる色付きカード */
.al-card-colored {
  background-color: var(--al-color-surface-subtle);
  border: 0;
}

/* FAQカード風の帯見出し（.al-card の先頭で使用） */
.al-card-header-bar {
  margin: calc(-1 * var(--al-space-s)) calc(-1 * var(--al-space-m)) var(--al-space-s);
  padding: var(--al-space-s) var(--al-space-m);
  background-color: var(--al-color-surface-subtle);
  border-bottom: 1px solid var(--al-color-surface-border);
  border-radius: calc(0.375rem - 1px) calc(0.375rem - 1px) 0 0;
  font-weight: 700;
}

/* 列数の多い一覧テーブル。文字サイズ・余白・列の最低幅を画面幅に応じて
   連続調整し、狭い画面でも列を落とさずに1文字ずつの折り返しを防ぐ */
.al-table-fluid {
  font-size: clamp(0.75rem, 2.9vw, 0.9rem);
}
.al-table-fluid th,
.al-table-fluid td {
  min-width: clamp(2.2rem, 9vw, 6rem);
  padding-left: clamp(0.1rem, 0.8vw, 0.5rem);
  padding-right: clamp(0.1rem, 0.8vw, 0.5rem);
  white-space: nowrap;
}

/* 長い文字列を含む列だけ折り返しを許し、他列を圧迫させない */
.al-table-fluid .al-cell-wrap {
  white-space: normal;
}

/* カード内でテーブルなどを端まで広げる（.al-card の横パディングを打ち消す） */
.al-card-flush {
  margin-left: calc(-1 * var(--al-space-m));
  margin-right: calc(-1 * var(--al-space-m));
}

/* 帯見出しの色バリエーション（.al-card-header-bar に追加して使う） */
.al-card-header-bar-sky {
  background-color: var(--al-color-sky);
  border-bottom-color: var(--al-color-sky-dark);
}

/* 背景を落としたカードの上でも帯とわかるグレー */
.al-card-header-bar-gray {
  background-color: #d9d5cf;
  border-bottom-color: #bdb8b0;
}

/* 帯の食い込み量は .al-card の padding 前提なので、padding の広い .al-card-plain では合わせ直す */
.al-card-plain > .al-card-header-bar {
  margin-top: calc(-1 * var(--al-space-m));
  border-radius: 0;
}

/* シンプルカード（クリーム背景・角丸なし） */
.al-card-plain {
  background-color: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #999;
  padding: var(--al-space-m);
  margin-bottom: var(--al-space-m);
}

/* カード背景を一段落とし、枠を控えめにする（.al-card / .al-card-plain に追加して使う）。
   背景画像を透かさないので、中に白い部品を並べても輪郭が保てる */
.al-card-dim {
  background-color: #f2efea;
  border: 1px solid #c9c4bc;
}

/* ==========================================================================
   8. ユーティリティ
   ========================================================================== */

/* インタラクション */
.al-hover-scale {
  transition: transform 0.2s;
}
.al-hover-scale:hover {
  transform: scale(1.05);
}

/* レイアウト最大幅 */
.al-max-width {
  max-width: 1200px;
}
.al-max-width-center {
  max-width: 1200px;
  margin: 0 auto;
}

/* テキスト */
.al-text-primary   { color: var(--al-color-text-primary); }
.al-text-secondary { color: var(--al-color-text-secondary); }
.al-text-muted     { color: var(--al-color-text-muted); }

/* モーダル固定（スクロール内でも上部に表示） */
.al-modal-fixed {
  position: fixed !important;
  top: 0 !important;
}


/* ==========================================================================
   9. 情報表示パターン
   ========================================================================== */

/* --- セクション背景ラッパー --- */
.al-section {
  background-color: rgba(240, 240, 240, 0.4);
  border-radius: 6px;
  padding: 0.75rem 0.2rem;
  margin-bottom: 0.75rem;
}
/* テーブルなど横幅を活かしたい場合は flush を使う（横パディングなし） */
.al-section-flush {
  background-color: rgba(240, 240, 240, 0.55);
  border-radius: 6px;
  padding: 0.75rem 0 0;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.al-section-flush .al-section-title {
  margin-left: 0.5rem;
}

/* --- セクション見出し --- */
.al-section-title {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--al-color-text-primary);
  border-left: 4px solid var(--al-color-primary);
  background: rgba(168, 28, 175, 0.06);
  padding: 0.25em 0.6em;
  margin: 0 0 0.5rem;
  border-radius: 0 3px 3px 0;
}
.al-section-title[data-section-id] {
  cursor: pointer;
  user-select: none;
}
.al-section-title[data-section-id]:hover {
  opacity: 0.8;
}

/* --- セクション説明文（title と body の間に置く） --- */
/* 使い方: <p class="al-section-desc">説明テキスト</p> */
.al-section-desc {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--al-color-text-secondary);
  margin: 0 0 0.4rem 0.6em;
}

/* --- 統計行（数値をインラインで並べる） --- */
.al-stat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.4rem 0;
}
.al-stat-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--al-color-text-secondary);
  white-space: nowrap;
}
.al-stat-item {
  font-size: 0.9rem;
  color: var(--al-color-text-primary);
  white-space: nowrap;
}

/* 見出し＋大きな数値のブロック（.al-stat-row の中に並べる） */
.al-stat-block {
  text-align: center;
  min-width: clamp(4rem, 17vw, 7rem);
}
.al-stat-block-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--al-color-text-secondary);
  white-space: nowrap;
}
.al-stat-block-value {
  display: block;
  font-size: clamp(1.1rem, 4.6vw, 1.6rem);
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.al-stat-item strong {
  font-size: 1rem;
}

/* --- 折りたたみセクション（<details>） --- */
.al-details {
  border: 1px solid var(--al-color-surface-border);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--al-color-surface-card);
}
.al-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  margin: -0.2rem -0.25rem;
  border-radius: 4px;
  user-select: none;
  transition: background-color 0.2s;
}
.al-details summary:hover {
  background-color: rgba(0, 0, 0, 0.04);
}
.al-details summary::-webkit-details-marker { display: none; }
.al-details summary::before {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.2s;
  display: inline-block;
}
.al-details[open] summary::before {
  transform: rotate(90deg);
}
.al-details .al-details-body {
  padding-top: 0.5rem;
}

/* clamp方式レスポンシブpadding (cx = clamp-x) */
.cx-1 { padding-left: clamp(2px, 1vw, 4px); padding-right: clamp(2px, 1vw, 4px); }
.cx-2 { padding-left: clamp(3px, 1.5vw, 8px); padding-right: clamp(3px, 1.5vw, 8px); }
.cx-3 { padding-left: clamp(4px, 2vw, 16px); padding-right: clamp(4px, 2vw, 16px); }
.cx-4 { padding-left: clamp(6px, 3vw, 24px); padding-right: clamp(6px, 3vw, 24px); }

/* --- 大会の試合表アイコン（個人戦・チーム戦・イベント戦で共通） --- */
.team-icon-wrap {
  display: inline-flex;
  align-items: flex-end;
  position: relative;
  width: 32px;
  height: 32px;
}
.team-icon-wrap .team-icon-bg {
  position: absolute;
  bottom: 0;
  left: 4px;
  width: 24px;
  height: 24px;
  background: rgba(128, 128, 128, 0.3);
  border: 2px solid #fff;
  outline: 1px solid #666;
  z-index: 0;
}
.team-icon-wrap > img {
  position: relative;
  z-index: 1;
}
