:root {
  --color-primer: #172554;
  --color-primer-rgb: 23, 37, 84;
  --color-normal-rgb: 0, 170, 125;
  --color-normal: rgb(var(--color-normal-rgb));
  --color-normal-1: color-mix(in oklch, var(--color-normal) 20%, var(--theme-bg));
  --color-normal-2: color-mix(in oklch, var(--color-normal) 40%, var(--theme-bg));
  --color-normal-3: color-mix(in oklch, var(--color-normal) 60%, var(--theme-bg));
  --color-normal-4: color-mix(in oklch, var(--color-normal) 80%, var(--theme-bg));
  --color-prepare-rgb: 255, 89, 0;
  --color-prepare: rgb(var(--color-prepare-rgb));
  --color-prepare-1: color-mix(in oklch, var(--color-prepare) 20%, var(--theme-bg));
  --color-prepare-2: color-mix(in oklch, var(--color-prepare) 40%, var(--theme-bg));
  --color-prepare-3: color-mix(in oklch, var(--color-prepare) 60%, var(--theme-bg));
  --color-prepare-4: color-mix(in oklch, var(--color-prepare) 80%, var(--theme-bg));
  --color-response-rgb: 242, 44, 44;
  --color-response: rgb(var(--color-response-rgb));
  --color-response-1: color-mix(in oklch, var(--color-response) 20%, var(--theme-bg));
  --color-response-2: color-mix(in oklch, var(--color-response) 40%, var(--theme-bg));
  --color-response-3: color-mix(in oklch, var(--color-response) 60%, var(--theme-bg));
  --color-response-4: color-mix(in oklch, var(--color-response) 80%, var(--theme-bg));
}

:root {
  --bs-body-font-family: Roboto, "Noto Sans TC", system-ui,-apple-system,"Segoe UI","Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
  --bs-secondary: #a1a1a1;
  --bs-secondary-rgb: 160.69, 160.69, 160.69;
  --app-theme-normal-color: #00aa7d;
  --app-theme-normal-color-rgb: 0, 170, 125;
  --app-theme-prepare-color: #ff5900;
  --app-theme-prepare-color-rgb: 255, 89, 0;
  --app-theme-response-color: #DF2B2B;
  --app-theme-response-color-rgb: 223, 43, 43;
  --app-theme-muted-color: var(--bs-secondary);
  --app-theme-muted-color-rgb: var(--bs-secondary-rgb);
  --app-theme-color: var(--bs-primary);
  --app-theme-color-rgb: var(--bs-primary-rgb);
  --app-blur: 16px;
  --app-border: oklch(87.2% 0.01 258.338);
  --bs-border-color: var(--app-border);
  --bs-border-color-translucent: var(--app-border);
  --bs-border-radius: var(--bs-border-radius-xl);
  --bs-btn-border-radius: var(--bs-border-radius-pill);
  --bs-dropdown-item-border-radius: var(--bs-border-radius-xl);
  --bs-box-shadow-sm: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
  --app-chart-grid-color: rgb(33 37 41 / 0.1);
  --app-chart-fill-opacity: 0.15;
  --app-chart-bar-opacity: 0.72;
  --app-chart-tooltip-bg: var(--bs-body-bg);
  --app-chart-tooltip-color: var(--bs-body-color);
  --app-chart-tooltip-border-color: var(--bs-border-color);
  --app-chart-arc-border-color: var(--bs-body-bg);
  --line-brand-bg: #06C755;
  --line-brand-border: color-mix(in srgb, var(--line-brand-bg) 90%, #000);
  --noise-opacity: 0;
}

[data-bs-theme="primer"] {
  body {
    background-color: var(--color-primer);
  }
  footer {
    --bs-border-color: color-mix(in srgb, rgb(var(--color-primer-rgb)), white  20%);
    color: white;
  }
  .nav {
    --bs-nav-link-hover-color: white;
  }
}

/*
 * 將三種情境色統一映射到目前啟用的主題色。
 * theme class 應放在 Bootstrap 元件的共同父層（例如 body 或頁面容器）。
 */
.theme-normal,
*[data-theme="normal"] {
  --app-theme-color: var(--color-normal);
  --app-theme-color-rgb: var(--color-normal-rgb);
  --app-theme-contrast-color: #fff;
  --app-theme-muted-color: var(--color-normal-4); 
}

.theme-prepare,
*[data-theme="prepare"]  {
  --app-theme-color: var(--color-prepare);
  --app-theme-color-rgb: var(--color-prepare-rgb);
  --app-theme-contrast-color: #fff; 
  --app-theme-active-color: var(--bs-body-color);
  --app-theme-muted-color: var(--color-prepare-4);
}


.theme-response,
*[data-theme="response"]  {
  --app-theme-color: var(--color-response);
  --app-theme-color-rgb: var(--color-response-rgb);
  --app-theme-contrast-color: #fff;
  --app-theme-muted-color: var(--color-response-4);
}

[data-bs-theme="dark"]
:where(.theme-normal, *[data-theme="normal"]) {
  --app-theme-muted-color: #8AD498; 
  --app-theme-muted-color-rgb: 138, 212, 152;  
}


.theme-prepare,
*[data-theme="prepare"]  {
  --app-theme-color: var(--app-theme-prepare-color);
  --app-theme-color-rgb: var(--app-theme-prepare-color-rgb);
  --app-theme-contrast-color: #fff; 
  --app-theme-active-color: var(--bs-body-color); 
}

/* Bootstrap 5.3 root-level theme variables and color utilities. */
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) {
  --app-theme-hover-color: color-mix(in srgb, var(--app-theme-color) 85%, #000);
  --app-theme-hover-border-color: color-mix(in srgb, var(--app-theme-color) 80%, #000);
  --app-theme-active-color: color-mix(in srgb, var(--app-theme-color) 80%, #000);
  --app-theme-active-border-color: color-mix(in srgb, var(--app-theme-color) 75%, #000);
  --app-theme-text-emphasis: color-mix(in srgb, var(--app-theme-color) 40%, #000);
  --app-theme-bg-subtle: color-mix(in srgb, var(--app-theme-color) 20%, #fff);
  --app-theme-border-subtle: color-mix(in srgb, var(--app-theme-color) 40%, #fff);

  --bs-primary: var(--app-theme-color);
  --bs-primary-rgb: var(--app-theme-color-rgb);
  --bs-primary-text-emphasis: var(--app-theme-text-emphasis);
  --bs-primary-bg-subtle: var(--app-theme-bg-subtle);
  --bs-primary-border-subtle: var(--app-theme-border-subtle);
  --bs-link-color: var(--app-theme-color);
  --bs-link-color-rgb: var(--bs-body-color-rgb);
  --bs-link-opacity: 0.75;
  --bs-link-hover-color: var(--app-theme-hover-color);
  --bs-link-hover-color-rgb: var(--app-theme-color-rgb);
  --bs-focus-ring-color: rgba(var(--app-theme-color-rgb), 0.25);
}

/* Buttons */
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .btn-primary {
  --bs-btn-color: var(--app-theme-contrast-color);
  --bs-btn-bg: var(--app-theme-color);
  --bs-btn-border-color: var(--app-theme-color);
  --bs-btn-hover-color: var(--app-theme-contrast-color);
  --bs-btn-hover-bg: var(--app-theme-hover-color);
  --bs-btn-hover-border-color: var(--app-theme-hover-border-color);
  --bs-btn-focus-shadow-rgb: var(--app-theme-color-rgb);
  --bs-btn-active-color: var(--app-theme-contrast-color);
  --bs-btn-active-bg: var(--app-theme-active-color);
  --bs-btn-active-border-color: var(--app-theme-active-border-color);
  --bs-btn-disabled-color: var(--app-theme-contrast-color);
  --bs-btn-disabled-bg: var(--app-theme-color);
  --bs-btn-disabled-border-color: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .btn-outline-primary {
  --bs-btn-color: var(--app-theme-color);
  --bs-btn-border-color: var(--app-theme-color);
  --bs-btn-hover-color: var(--app-theme-contrast-color);
  --bs-btn-hover-bg: var(--app-theme-color);
  --bs-btn-hover-border-color: var(--app-theme-color);
  --bs-btn-focus-shadow-rgb: var(--app-theme-color-rgb);
  --bs-btn-active-color: var(--app-theme-contrast-color);
  --bs-btn-active-bg: var(--app-theme-color);
  --bs-btn-active-border-color: var(--app-theme-color);
  --bs-btn-disabled-color: var(--app-theme-color);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--app-theme-color);
}

/* Alerts, list groups and tables generated from Bootstrap's primary variant. */
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .alert-primary {
  --bs-alert-color: var(--app-theme-text-emphasis);
  --bs-alert-bg: var(--app-theme-bg-subtle);
  --bs-alert-border-color: var(--app-theme-border-subtle);
  --bs-alert-link-color: var(--app-theme-text-emphasis);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .list-group-item-primary {
  --bs-list-group-color: var(--app-theme-text-emphasis);
  --bs-list-group-bg: var(--app-theme-bg-subtle);
  --bs-list-group-border-color: var(--app-theme-border-subtle);
  --bs-list-group-action-hover-color: var(--app-theme-text-emphasis);
  --bs-list-group-action-hover-bg: var(--app-theme-border-subtle);
  --bs-list-group-action-active-color: var(--app-theme-contrast-color);
  --bs-list-group-action-active-bg: var(--app-theme-color);
  --bs-list-group-active-color: var(--app-theme-contrast-color);
  --bs-list-group-active-bg: var(--app-theme-color);
  --bs-list-group-active-border-color: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .table-primary {
  --bs-table-color: var(--app-theme-text-emphasis);
  --bs-table-bg: var(--app-theme-bg-subtle);
  --bs-table-border-color: var(--app-theme-border-subtle);
  --bs-table-striped-bg: color-mix(in srgb, var(--app-theme-bg-subtle) 95%, #000);
  --bs-table-striped-color: var(--app-theme-text-emphasis);
  --bs-table-active-bg: color-mix(in srgb, var(--app-theme-bg-subtle) 90%, #000);
  --bs-table-active-color: var(--app-theme-text-emphasis);
  --bs-table-hover-bg: color-mix(in srgb, var(--app-theme-bg-subtle) 92.5%, #000);
  --bs-table-hover-color: var(--app-theme-text-emphasis);
}

/* Components whose active color is compiled from Sass rather than --bs-primary. */
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .pagination {
  --bs-pagination-focus-color: var(--app-theme-hover-color);
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(var(--app-theme-color-rgb), 0.25);
  --bs-pagination-active-color: var(--app-theme-contrast-color);
  --bs-pagination-active-bg: var(--app-theme-color);
  --bs-pagination-active-border-color: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .nav-pills {
  --bs-nav-pills-link-active-color: var(--app-theme-contrast-color);
  --bs-nav-pills-link-active-bg: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .navbar {
  --bs-navbar-hover-color: var(--app-theme-hover-color);
  --bs-navbar-disabled-color: rgba(var(--app-theme-color-rgb), 0.3);
  --bs-navbar-active-color: #FFF;
  --bs-navbar-brand-hover-color: var(--app-theme-hover-color);
  --bs-navbar-toggler-border-color: rgba(var(--app-theme-color-rgb), 0.25);
}


:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .dropdown-menu {
  --bs-dropdown-link-active-color: var(--app-theme-contrast-color);
  --bs-dropdown-link-active-bg: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .accordion {
  --bs-accordion-btn-focus-border-color: var(--app-theme-color);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--app-theme-color-rgb), 0.25);
  --bs-accordion-active-color: var(--app-theme-text-emphasis);
  --bs-accordion-active-bg: var(--app-theme-bg-subtle);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .progress {
  --bs-progress-bar-color: var(--app-theme-contrast-color);
  --bs-progress-bar-bg: var(--app-theme-color);
}

/* Form controls do not expose all primary states as local component variables. */
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-control:focus,
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-select:focus {
  border-color: var(--app-theme-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--app-theme-color-rgb), 0.25);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-check-input:focus,
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-range:focus::-webkit-slider-thumb,
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-range:focus::-moz-range-thumb {
  border-color: var(--app-theme-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--app-theme-color-rgb), 0.25);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-check-input:checked,
:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--app-theme-color);
  border-color: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-range::-webkit-slider-thumb {
  background-color: var(--app-theme-color);
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .form-range::-moz-range-thumb {
  background-color: var(--app-theme-color);
}

body {
  background-color: RGB(var(--bs-body-bg-rgb));
}

.btn-secnario-toggle {
  --bs-btn-color:　var(--bs-body-color);
}
.btn-secnario-toggle[data-state="on"] {
  --bs-btn-color: initial;
}

.card {
  --bs-card-cap-padding-y: 0.75rem;
  --bs-card-cap-bg: RGBA(var(--bs-body-bg-rgb), 0.075);
}

[data-bs-theme="dark"] {
  .card {
    --bs-card-bg: RGBA(var(--bs-body-color-rgb), 0.05);
  }  
}

:where(.theme-normal, .theme-prepare, .theme-response, *[data-theme="normal"], *[data-theme="prepare"], *[data-theme="response"]) .card {
  --bs-card-title-color: var(--app-theme-color);
}

.table {
  --bs-table-bg: transparent;
}

[data-bs-theme="light"]
.logo {
  filter: invert(80%);
}


.text-theme-muted {
  color: var(--app-theme-muted-color)
}

.bg-primer {
  background-color: var(--color-primer);
}