/* Shared visual language with the Edara Work Guide demo; standalone study UI. */
:root {
  color-scheme: light;
  --bg-app: #f2f5f7;
  --bg-panel: #fff;
  --border: #e1e7ec;
  --border-light: #edf1f5;
  --text-main: #101820;
  --text-muted: #455361;
  --text-light: #607080;
  --primary: #1f66d1;
  --primary-hover: #174f9f;
  --primary-light: #e9f2ff;
  --teal: #087f70;
  --teal-light: #e1f7f2;
  --success-bg: #e7f7ee;
  --success-border: #b5ddc4;
  --success-text: #177245;
  --shadow-sm: 0 1px 2px rgba(23,33,43,.05), 0 1px 5px rgba(23,33,43,.035);
  --sans: "Segoe UI Variable Text", Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --brand-font: Bahnschrift, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #c5ced8 transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; min-width: 0; }
body { display: flex; flex-direction: column; background: var(--bg-app); color: var(--text-main); font: 14px/1.45 var(--sans); overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, input, select { transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(31,102,209,.22); outline-offset: 2px;
}
button:disabled { cursor: default; opacity: .5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-header {
  flex-shrink: 0;
  height: 66px; padding: 7px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: white; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { width: 40.8px; height: 30px; flex: 0 0 40.8px; position: relative; overflow: hidden; }
.brand-logo img { position: absolute; width: 60px; max-width: none; height: auto; left: -12px; top: -10.8px; display: block; }
.brand h1 { font-family: var(--brand-font); font-size: 20px; font-weight: 600; line-height: 1.2; }
.brand-copy > span { display: block; color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.manual-context { display: flex; gap: 10px; align-items: center; }
.manual-context > span { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.manual-context > div { min-width: 245px; padding: 10px 12px; border: 1px solid #cbd5df; border-radius: 8px; background: white; box-shadow: var(--shadow-sm); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.site-switch { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; min-height: 40px; border: 1px solid #b9cec9; border-radius: 8px; color: #32695f; background: #f4f8f7; text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; }
.site-switch:hover { border-color: var(--teal); background: var(--teal-light); }
.site-switch:focus-visible { outline: 3px solid rgba(31,102,209,.22); outline-offset: 2px; }
.training-app { height: auto; flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0,1fr); }
.demo-notice { flex-shrink: 0; padding: 9px 20px; border-top: 1px solid var(--border); background: #f7f9fb; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.demo-notice p { max-width: 1800px; margin: 0 auto; }
.study-sidebar { background: #f7f9fb; border-right: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.sidebar-section { padding: 20px 18px; border-bottom: 1px solid var(--border); }
.section-label { font-size: 11px; font-weight: 750; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.manual-title { font-family: var(--brand-font); font-size: 22px; font-weight: 500; line-height: 1.35; margin-bottom: 12px; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.stat-item { padding: 9px 7px; border: 1px solid var(--border); border-radius: 8px; background: white; min-width: 0; box-shadow: var(--shadow-sm); }
.stat-number { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; margin-bottom: 5px; }
.stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; white-space: nowrap; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #cbd5df; border-radius: 8px; background: white; color: var(--text-light); box-shadow: var(--shadow-sm); }
.search-box:focus-within { border-color: var(--primary); }
.search-input { background: transparent; border: 0; width: 100%; min-width: 0; padding: 11px 0; color: var(--text-main); font-size: 13px; outline: none; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { border: 0; padding: 2px 4px; font-size: 20px; color: var(--text-muted); background: none; }
.filter-group { display: grid; gap: 8px; margin-bottom: 18px; }
.filter-label { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.difficulty-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { padding: 6px 9px; border: 1px solid var(--border); background: white; color: var(--text-muted); border-radius: 6px; font-size: 12px; }
.pill:hover { border-color: #aab9ca; }
.pill.active { color: var(--teal); background: var(--teal-light); border-color: #9ed3c8; font-weight: 600; }
.category-select { width: 100%; min-width: 0; padding: 9px 8px; border: 1px solid #cbd5df; border-radius: 8px; background: white; color: var(--text-main); font-size: 13px; }
.toggle-unmastered { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
input[type=checkbox] { accent-color: var(--teal); }
.progress-stats-text { font-size: 12px; color: var(--text-muted); }
.progress-bar-track { height: 6px; background: #e3e9ef; border-radius: 5px; margin: 12px 0; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0; background: var(--teal); transition: width 180ms ease; }
.progress-note { font-size: 11px; color: var(--text-light); margin-bottom: 8px; }
.btn-text-reset { color: var(--text-muted); background: transparent; border: 0; padding: 4px 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.main-container { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.content-tabs { flex: 0 0 54px; min-height: 54px; display: flex; justify-content: space-between; gap: 15px; align-items: stretch; padding: 0 24px; background: #f7f9fb; border-bottom: 1px solid var(--border); }
.page-tab { display: flex; align-items: center; border-bottom: 3px solid #427d72; color: #32695f; font-size: 13px; white-space: nowrap; }
.view-mode-toggle { display: flex; align-items: center; gap: 2px; }
.mode-btn { border: 0; border-radius: 6px; background: transparent; padding: 7px 10px; color: var(--text-muted); font-size: 12px; }
.mode-btn.active { background: white; color: var(--teal); box-shadow: var(--shadow-sm); font-weight: 600; }
.content-scroll { min-height: 0; overflow-y: auto; padding: 24px; }
.workspace-heading { margin-bottom: 23px; }
.workspace-heading h2 { font-size: 27px; font-weight: 700; line-height: 1.25; margin-bottom: 8px; }
.workspace-heading p { color: var(--text-muted); font-size: 13px; max-width: 650px; }
.deck-view { display: flex; flex-direction: column; gap: 16px; max-width: 1050px; margin: 0 auto; }
.flashcard-stage { width: 100%; perspective: 1600px; }
.flashcard-3d { display: grid; width: 100%; transform-style: preserve-3d; transition: transform 400ms ease; cursor: pointer; }
.flashcard-3d.flipped { transform: rotateY(180deg); }
.card-face { grid-area: 1/1; display: flex; flex-direction: column; min-height: 350px; border: 1px solid var(--border); border-radius: 10px; background: white; padding: 22px; box-shadow: var(--shadow-sm); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card-front { border-top: 3px solid #65988e; }
.card-back { transform: rotateY(180deg); border-top: 3px solid #1f66d1; }
.card-top-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.proc-badge { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.procedure-reference { display: grid; gap: 3px; margin: 10px 0; font-size: 12px; line-height: 1.45; }
.procedure-reference span { color: var(--text-light); font-size: 11px; }
.procedure-reference a { color: var(--primary); font-weight: 600; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; }
.procedure-reference a:hover { color: var(--primary-hover); }
.procedure-reference a:focus-visible { outline: 3px solid rgba(31,102,209,.22); outline-offset: 3px; border-radius: 2px; }

/* Complete procedure references for training topics outside the three-procedure demo. */
body.procedure-page { overflow: auto; height: auto; min-height: 100dvh; }
.procedure-page .procedure-content { flex: 1 0 auto; width: 100%; }
.procedure-content { max-width: 1000px; margin: 0 auto; padding: 24px 20px 40px; }
.procedure-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 16px; }
.procedure-heading h2 { font-size: 26px; line-height: 1.25; }
.procedure-heading .procedure-category { color: var(--teal); font-size: 13px; white-space: nowrap; }
.procedure-panel { margin: 14px 0; border: 1px solid var(--border); border-radius: 8px; background: white; box-shadow: var(--shadow-sm); }
.procedure-panel h3 { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.procedure-panel ul, .procedure-panel ol { margin: 0; padding: 14px 18px 14px 36px; font-size: 16px; line-height: 1.6; }
.procedure-panel li + li { margin-top: 8px; }
.procedure-panel.procedure-safety { border-left: 4px solid #aa4234; }
.diff-badge { border: 1px solid var(--border); border-radius: 5px; padding: 3px 7px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.diff-basic { color: #177245; background: #e7f7ee; border-color: #cee9d9; }
.diff-intermediate { color: #996515; background: #fff4d8; border-color: #ecdfbb; }
.diff-advanced { color: #b33a32; background: #fff0ee; border-color: #edd3cf; }
.card-number-tag { font-size: 11px; color: var(--text-light); margin-left: auto; }
.card-main-content { flex: 1; padding: 22px 0; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.card-question-title { font-size: 23px; line-height: 1.45; font-weight: 650; max-width: 850px; }
.card-category-hint { font-size: 12px; color: var(--text-light); }
.card-answer-title { color: var(--text-muted); text-transform: uppercase; font-size: 11px; font-weight: 700; }
.card-answer-text { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.pro-tip-box { background: #f4f8f7; border: 1px solid #e0e9e6; border-left: 3px solid #65988e; padding: 12px 14px; border-radius: 6px; }
.pro-tip-header { color: #32695f; font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.pro-tip-text { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.key-details-list { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-chip { background: #f7f9fb; border: 1px solid var(--border); border-radius: 5px; color: var(--text-muted); font-size: 11px; padding: 4px 7px; }
.card-bottom-footer { border-top: 1px solid var(--border-light); padding-top: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; color: var(--text-light); font-size: 11px; }
.mastered-indicator { color: var(--success-text); font-weight: 600; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 5px; border: 1px solid #cbd5df; border-radius: 8px; padding: 8px 12px; min-height: 36px; background: white; color: var(--text-main); font-size: 12px; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.deck-controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.deck-nav-group, .deck-actions-group { display: flex; gap: 7px; align-items: center; }
.deck-status-counter { color: var(--text-muted); font-size: 12px; min-width: 54px; text-align: center; }
.keyboard-shortcuts-hint { display: flex; justify-content: center; flex-wrap: wrap; gap: 13px; color: var(--text-light); font-size: 11px; padding: 2px 0 12px; }
.keyboard-shortcuts-hint > span { display: inline-flex; align-items: center; gap: 4px; }
kbd { border: 1px solid var(--border); border-radius: 4px; background: #f7f9fb; padding: 1px 5px; font: 10px var(--sans); }
.grid-view { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(280px,100%),1fr)); gap: 16px; }
.grid-card-item { perspective: 1400px; min-width: 0; }
.grid-card-inner { display: grid; transform-style: preserve-3d; transition: transform 400ms ease; cursor: pointer; height: 100%; }
.grid-card-inner.flipped { transform: rotateY(180deg); }
.grid-card-face { grid-area: 1/1; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 18px; min-height: 320px; border: 1px solid var(--border); border-top: 3px solid #65988e; border-radius: 10px; background: white; box-shadow: var(--shadow-sm); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.grid-card-back { transform: rotateY(180deg); border-top-color: var(--primary); }
.grid-question-title { font-size: 16px; line-height: 1.5; margin: 17px 0 12px; font-weight: 650; }
.grid-answer-text { font-size: 13px; line-height: 1.65; margin-bottom: 12px; }
.empty-state { background: white; padding: 45px 25px; text-align: center; border: 1px solid var(--border); border-radius: 10px; grid-column: 1/-1; }
.empty-state h3 { font-size: 19px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 18px; }
@media (max-width: 1050px) {
  .training-app { grid-template-columns: 250px minmax(0,1fr); }
  .sidebar-section { padding: 18px 14px; }
  .content-scroll { padding: 20px; }
  .card-question-title { font-size: 21px; }
  .stat-label { font-size: 8px; }
}
@media (max-width: 760px) {
  html, body { height: auto; }
  body { display: block; overflow: auto; min-height: 100dvh; }
  .app-header { height: auto; min-height: 66px; flex-wrap: wrap; padding: 12px 16px; }
  .brand h1 { font-size: 18px; }
  .manual-context { display: none; }
  .training-app { height: auto; grid-template-columns: 1fr; }
  .study-sidebar { overflow: visible; border-right: 0; display: grid; grid-template-columns: 1fr 1fr; }
  .sidebar-section { padding: 16px; min-width: 0; }
  .study-filters { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .study-filters .section-label, .toggle-unmastered { grid-column: 1/-1; }
  .study-filters .filter-group { margin: 0; }
  .progress-card { grid-column: 1/-1; }
  .main-container { overflow: visible; }
  .content-scroll { overflow: visible; padding: 18px 16px; }
  .content-tabs { padding: 0 16px; min-height: 54px; }
  .workspace-heading h2 { font-size: 24px; }
  .card-face { padding: 18px; min-height: 360px; }
  .card-question-title { font-size: 20px; }
  .deck-nav-group, .deck-actions-group { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .study-sidebar { grid-template-columns: 1fr; }
  .study-filters { display: block; }
  .study-filters .filter-group { margin-bottom: 15px; }
  .mode-btn { padding: 7px; font-size: 11px; }
  .card-face { padding: 15px; }
  .deck-actions-group { width: 100%; }
  .deck-actions-group .btn { flex: 1; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
