/* 課綱複習遊戲｜設計權杖 v1
 * 以 [data-theme="g5"]（小五）與 [data-theme="g9"]（國三）切換。
 * 請把 data-theme 加在 <html> 上。請只使用 g5 與 g9 作為主題鍵名。
 * 色彩對比皆通過 WCAG AA（內文 ≥ 4.5:1，UI 元件 ≥ 3:1）。
 * 答錯請用陶土色／琥珀提示色，不要用刺眼紅。
 */

:root {
  /* -------- 間距（兩版共用 4px 基數） -------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* -------- 字級（內文最小 16px） -------- */
  --font-size-xs: 12px;   /* 僅輔助標籤，不用於關鍵訊息 */
  --font-size-sm: 14px;   /* 次要標籤 */
  --font-size-md: 16px;   /* 內文／選項 */
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 32px;
  --font-size-4xl: 40px;

  --line-height-tight: 1.25;
  --line-height-title: 1.35;
  --line-height-body: 1.65;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* -------- 觸控與安全區 -------- */
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* -------- 動效 -------- */
  --duration-fast: 150ms;
  --duration-md: 220ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.4, 0.64, 1);

  --icon-stroke: 2px;
  --icon-size: 24px;

  color-scheme: light;
}

/* =========================================================
 * g5｜星芽原野（小五英文 · 翰林 · 自然／社會情境 · Mac）
 * 可愛、活潑、明亮。圓角較大、陰影帶暖橘。
 * ========================================================= */
[data-theme="g5"] {
  --color-bg: #fff6e8;
  --color-bg-accent: #ffe9c7;
  --color-surface: #ffffff;
  --color-surface-alt: #ffe8c8;
  --color-text: #2b1c12;
  --color-text-muted: #5a4333;
  --color-text-on-primary: #ffffff;
  --color-text-on-secondary: #ffffff;

  --color-primary: #c2410c;
  --color-primary-hover: #9a3412;
  --color-primary-soft: #ffedd5;

  --color-secondary: #0e7480;
  --color-secondary-hover: #0a5c66;
  --color-secondary-soft: #cff5f6;

  --color-accent: #3f7a2c;
  --color-accent-soft: #e3f4d7;

  --color-hint: #6d28d9;
  --color-hint-soft: #ede9fe;

  --color-success: #047857;
  --color-success-soft: #d1fae5;
  --color-success-text: #065f46;

  /* 答錯：陶土色，不使用刺眼紅 */
  --color-error: #8e4a2e;
  --color-error-soft: #f6e6d8;
  --color-error-text: #6e351f;

  /* 第一次答錯／再試一次：琥珀，語氣更像「再想想」 */
  --color-warning: #b45309;
  --color-warning-soft: #fef3c7;
  --color-warning-text: #8a4b08;

  --color-star: #b45309;
  --color-star-fill: #f0b429;
  --color-heart: #be123c;
  --color-heart-soft: #ffe4e6;

  --color-border: #e2b57a;
  --color-border-subtle: #f0d2a8;
  --color-border-strong: #c48a3a;

  --color-disabled-bg: #f0e7da;
  --color-disabled-text: #5c4a3a;

  --color-overlay: rgba(43, 28, 18, 0.45);
  --color-shadow: rgba(194, 65, 12, 0.14);
  --color-shadow-strong: rgba(194, 65, 12, 0.22);

  --shadow-sm: 0 1px 2px rgba(194, 65, 12, 0.08);
  --shadow-md: 0 4px 12px rgba(194, 65, 12, 0.12);
  --shadow-lg: 0 10px 28px rgba(194, 65, 12, 0.16);
  --shadow-focus: 0 0 0 3px rgba(194, 65, 12, 0.28);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  --duration-fun: 400ms;
  --ease-fun: var(--ease-bounce);
}

/* =========================================================
 * g9｜課途旅記（國三理化 · 翰林 · 國三上第一次段考 · iPhone）
 * 簡潔、有質感、沉穩但不無聊。圓角收斂、墨青＋古金。
 * ========================================================= */
[data-theme="g9"] {
  --color-bg: #e8e6de;
  --color-bg-accent: #ddd8cc;
  --color-surface: #f7f6f2;
  --color-surface-alt: #efece4;
  --color-text: #1a1f26;
  --color-text-muted: #4a5560;
  --color-text-on-primary: #ffffff;
  --color-text-on-secondary: #ffffff;

  --color-primary: #1b4d5c;
  --color-primary-hover: #133b46;
  --color-primary-soft: #d5e6ea;

  --color-secondary: #3e4a5c;
  --color-secondary-hover: #2f3846;
  --color-secondary-soft: #e2e5ea;

  --color-accent: #8a6a1f;
  --color-accent-soft: #f4e4b0;
  --color-accent-metal: #c4a35a; /* 裝飾用金屬金，勿單獨當小字顏色 */

  --color-hint: #5b4b8a;
  --color-hint-soft: #ece8f5;

  --color-success: #0f766e;
  --color-success-soft: #d1f0ec;
  --color-success-text: #115e59;

  --color-error: #7a4a38;
  --color-error-soft: #efe4d8;
  --color-error-text: #5c3226;

  --color-warning: #92650f;
  --color-warning-soft: #f6e7c1;
  --color-warning-text: #6b5420;

  --color-star: #8a6a1f;
  --color-star-fill: #c4a35a;
  --color-heart: #be123c;
  --color-heart-soft: #fde8e8;

  --color-border: #b8b09e;
  --color-border-subtle: #d2cdc0;
  --color-border-strong: #8a8370;

  --color-disabled-bg: #e4e0d6;
  --color-disabled-text: #534e44;

  --color-overlay: rgba(26, 31, 38, 0.5);
  --color-shadow: rgba(27, 77, 92, 0.12);
  --color-shadow-strong: rgba(27, 77, 92, 0.2);

  --shadow-sm: 0 1px 2px rgba(27, 77, 92, 0.06);
  --shadow-md: 0 2px 8px rgba(27, 77, 92, 0.1);
  --shadow-lg: 0 8px 24px rgba(27, 77, 92, 0.14);
  --shadow-focus: 0 0 0 3px rgba(27, 77, 92, 0.3);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --duration-fun: 220ms;
  --ease-fun: var(--ease-out);

  /* 戰鬥 HUD（國三理化冒險） */
  --color-hp: #0f766e;
  --color-hp-soft: #d1f0ec;
  --color-hp-foe: #8a6a1f;
  --color-hp-foe-soft: #f4e4b0;
  --color-hp-low: #7a4a38;
  --color-combo: #8a6a1f;
  --color-combo-soft: #f4e4b0;
  --color-exp: #1b4d5c;
  --color-exp-fill: #c4a35a;

  /* CP1 科目色票。未來新增科目請依 --subject-<id>-* 擴充，例如
     math 數學、geo 地理、civ 公民：
     --subject-<id>        主色（白字對比 ≥ 4.5:1）
     --subject-<id>-hover  略深懸停
     --subject-<id>-soft   淺底
     --subject-<id>-border 邊框（對淺底／羊皮紙 ≥ 3:1）
     --subject-<id>-text   深字（用在淺底上，≥ 4.5:1）
     --subject-<id>-on     白字（用在主色上，≥ 4.5:1） */
  --subject-phys: #1B4D5C;
  --subject-phys-hover: #133B46;
  --subject-phys-soft: #D5E6EA;
  --subject-phys-border: #1B4D5C;
  --subject-phys-text: #133B46;
  --subject-phys-on: #FFFFFF;

  --subject-chi: #2D5A4C;
  --subject-chi-hover: #1E3F36;
  --subject-chi-soft: #DCEBE6;
  --subject-chi-border: #2D5A4C;
  --subject-chi-text: #1E3F36;
  --subject-chi-on: #FFFFFF;

  --subject-eng: #2F456E;
  --subject-eng-hover: #243556;
  --subject-eng-soft: #DEE4F0;
  --subject-eng-border: #2F456E;
  --subject-eng-text: #243556;
  --subject-eng-on: #FFFFFF;

  --subject-his: #7A5230;
  --subject-his-hover: #5C3C22;
  --subject-his-soft: #F0E4D6;
  --subject-his-border: #7A5230;
  --subject-his-text: #5C3C22;
  --subject-his-on: #FFFFFF;

  /* 冒險地圖路徑 */
  --map-path-open: #C4A35A;
  --map-path-open-under: #1B4D5C;
  --map-path-locked: #8A8370;
}
