/* 선생님 공간 /teacher — TeacherSpaceSpec §11. Phone first; two columns from 900px.
   Only existing :root tokens (main.css) are consumed. No horizontal overflow at 375px. */
.kg-ts-page { min-height: 100dvh; background: var(--bg-sunken); color: var(--text-primary); font-family: var(--font-body);
  font-size: var(--text-style-body-large-font-size); line-height: var(--text-style-body-line-height);
  overflow-x: hidden; padding-bottom: calc(var(--space-1000) + env(safe-area-inset-bottom)); }
.kg-ts-page *, .kg-ts-page *::before, .kg-ts-page *::after { box-sizing: border-box; }

.kg-ts-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-150); padding: var(--space-200) var(--space-250) var(--space-150); background: var(--bg-raised);
  border-bottom: var(--border-width-default) solid var(--border-divider); }
.kg-ts-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 0; border-radius: var(--radius-full); background: var(--fill-soft); color: var(--icon-default);
  font-size: var(--text-style-heading-small-font-size); cursor: pointer; }
.kg-ts-icon-button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.kg-ts-tabs { position: sticky; top: 69px; z-index: 19; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-100);
  padding: var(--space-150) var(--space-250); background: var(--bg-raised); box-shadow: var(--shadow-xs); }
.kg-ts-tab { min-height: 44px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary);
  font: inherit; font-weight: var(--text-style-weight-medium); font-size: var(--text-style-label-large-font-size); cursor: pointer; }
.kg-ts-tab--active { background: var(--color-accent-soft); color: var(--text-accent); font-weight: var(--text-style-weight-bold); }

.kg-ts-body { width: 100%; max-width: 1200px; margin: 0 auto; padding: var(--space-250); }
.kg-ts-list-pane { display: flex; flex-direction: column; gap: var(--space-200); min-width: 0; }
.kg-ts-detail-pane { display: none; min-width: 0; }
.kg-ts-detail-pane--open { display: block; }
.kg-ts-body--detail .kg-ts-list-pane { display: none; }

.kg-ts-section-title { margin: var(--space-100) 0 0; font-family: var(--font-display); font-size: var(--text-style-title-small-font-size);
  font-weight: var(--text-style-weight-bold); color: var(--text-primary); }

.kg-ts-card { display: flex; align-items: center; gap: var(--space-200); width: 100%; padding: var(--space-250);
  border: var(--border-width-default) solid var(--border-default); border-radius: var(--radius-xl); background: var(--bg-raised);
  box-shadow: var(--shadow-card); color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--motion-fast) var(--motion-easing), box-shadow var(--motion-fast) var(--motion-easing); }
.kg-ts-card:hover { border-color: var(--color-accent-border); }
.kg-ts-card--selected { border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.kg-ts-card-main { display: flex; flex-direction: column; gap: var(--space-050); min-width: 0; flex: 1 1 auto; }
.kg-ts-card-title { font-weight: var(--text-style-weight-bold); font-size: var(--text-style-body-large-font-size);
  overflow-wrap: anywhere; }
.kg-ts-card-meta { color: var(--text-muted); font-size: var(--text-style-body-small-font-size); }
.kg-ts-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: var(--radius-full); background: var(--color-text-subtle); }
.kg-ts-dot--working { background: var(--color-warning); }
.kg-ts-dot--review { background: var(--color-accent); }
.kg-ts-dot--done { background: var(--color-success); }
.kg-ts-dot--failed { background: var(--color-danger); }

.kg-ts-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-150); padding: var(--space-800) var(--space-300);
  border: var(--border-width-default) dashed var(--border-default); border-radius: var(--radius-2xl); background: var(--bg-raised);
  color: var(--text-secondary); text-align: center; }
.kg-ts-empty-icon { font-size: var(--text-style-display-small-font-size); color: var(--icon-accent); line-height: 1; }

.kg-ts-progress { display: block; width: 100%; height: 10px; border-radius: var(--radius-full); background: var(--fill-soft); overflow: hidden; }
.kg-ts-progress-fill { display: block; height: 100%; border-radius: var(--radius-full); background: var(--color-accent);
  transition: width var(--motion-medium) var(--motion-easing); }
.kg-ts-progress-text { color: var(--text-secondary); font-size: var(--text-style-body-medium-font-size); }

.kg-ts-field { display: flex; flex-direction: column; gap: var(--space-100); }
.kg-ts-label { font-weight: var(--text-style-weight-medium); font-size: var(--text-style-label-large-font-size); color: var(--text-secondary); }
.kg-ts-input { width: 100%; min-height: 52px; padding: 0 var(--space-200); border: var(--border-width-default) solid var(--border-default);
  border-radius: var(--radius-lg); background: var(--bg-raised); color: var(--text-primary); font: inherit; font-size: 17px; }
.kg-ts-input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.kg-ts-search { border-radius: var(--radius-full); padding-left: var(--space-300); }

.kg-ts-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-050); padding: var(--space-050);
  border-radius: var(--radius-full); background: var(--fill-soft); }
.kg-ts-segment-item { min-height: 44px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary);
  font: inherit; font-size: var(--text-style-label-large-font-size); cursor: pointer; }
.kg-ts-segment-item--on { background: var(--bg-raised); color: var(--text-primary); font-weight: var(--text-style-weight-bold); box-shadow: var(--shadow-sm); }

.kg-ts-file-pick { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-100);
  min-height: 140px; padding: var(--space-300); border: 2px dashed var(--color-accent-border); border-radius: var(--radius-2xl);
  background: var(--color-accent-bg); color: var(--text-accent); text-align: center; cursor: pointer; }
.kg-ts-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.kg-ts-file-row { display: flex; justify-content: space-between; gap: var(--space-150); padding: var(--space-150) var(--space-200);
  border-radius: var(--radius-lg); background: var(--bg-raised); font-size: var(--text-style-body-medium-font-size); overflow-wrap: anywhere; }

.kg-ts-button { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; padding: 0 var(--space-300);
  border-radius: var(--radius-full); font: inherit; font-size: var(--text-style-label-large-font-size); font-weight: var(--text-style-weight-bold);
  cursor: pointer; border: var(--border-width-default) solid transparent; }
.kg-ts-button--primary { background: var(--fill-primary); color: var(--text-inverse); box-shadow: var(--shadow-sm); }
.kg-ts-button--primary:hover { background: var(--fill-primary-hover); }
.kg-ts-button--secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-default); }
.kg-ts-button:disabled { opacity: var(--chip-disabled-opacity); cursor: not-allowed; }

.kg-ts-notice { padding: var(--space-150) var(--space-200); border-radius: var(--radius-lg); background: var(--color-accent-bg);
  color: var(--text-accent); font-size: var(--text-style-body-medium-font-size); }
.kg-ts-notice--error { background: var(--base-red-50); color: var(--color-danger-text); }

/* Exam-sheet problem view: centered, figures/equations fit the width. */
.kg-ts-sheet { width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-300) var(--space-250); border-radius: var(--radius-2xl);
  background: var(--bg-raised); box-shadow: var(--shadow-section); }
.kg-ts-sheet-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-150); margin-bottom: var(--space-200); }
.kg-ts-sheet-counter { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-weight: var(--text-style-weight-medium); }
.kg-ts-sheet-section { padding: var(--space-250) 0; border-top: var(--border-width-default) solid var(--border-divider); }
.kg-ts-sheet-section:first-of-type { border-top: 0; }
.kg-ts-sheet-kicker { display: inline-block; margin-bottom: var(--space-100); padding: var(--space-025) var(--space-150);
  border-radius: var(--radius-full); background: var(--badge-soft-bg); color: var(--badge-soft-text);
  font-size: var(--text-style-caption-medium-font-size); font-weight: var(--text-style-weight-bold); }
.kg-ts-sheet-body { font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; min-width: 0; }
.kg-ts-sheet-body img, .kg-ts-sheet-body svg { max-width: 100%; height: auto; }
.kg-ts-sheet-body .katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: var(--space-050) 0; }
.kg-ts-sheet-body .katex { max-width: 100%; }
.kg-ts-solution { margin-top: var(--space-150); border-radius: var(--radius-lg); background: var(--bg-sunken); padding: var(--space-150) var(--space-200); }
.kg-ts-solution > summary { min-height: 44px; display: flex; align-items: center; font-weight: var(--text-style-weight-bold); cursor: pointer; }

/* Thumb-reach bar. Only 확인 is emphasized. */
.kg-ts-bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr 1.4fr 1fr;
  gap: var(--space-150); padding: var(--space-150) var(--space-250) calc(var(--space-150) + env(safe-area-inset-bottom));
  background: var(--bg-raised); box-shadow: var(--shadow-lg); }
.kg-ts-bar-button { min-height: 56px; border: var(--border-width-default) solid var(--border-default); border-radius: var(--radius-full);
  background: var(--bg-raised); color: var(--text-primary); font: inherit; font-size: var(--text-style-label-large-font-size);
  font-weight: var(--text-style-weight-bold); cursor: pointer; }
.kg-ts-bar-button--primary { border-color: transparent; background: var(--fill-primary); color: var(--text-inverse); }
.kg-ts-bar-button:disabled { opacity: var(--chip-disabled-opacity); cursor: not-allowed; }

.kg-ts-overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: var(--decision-trace-backdrop-scrim); }
.kg-ts-panel { width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-250);
  padding: var(--space-300) var(--space-250) calc(var(--space-300) + env(safe-area-inset-bottom));
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; background: var(--bg-raised); box-shadow: var(--shadow-modal); }
.kg-ts-check { display: flex; align-items: center; gap: var(--space-150); min-height: 44px; font-size: var(--text-style-body-large-font-size); }
.kg-ts-check input { width: 22px; height: 22px; accent-color: var(--color-accent); }

.kg-ts-chat { display: flex; flex-direction: column; gap: var(--space-100); padding: var(--space-200); border-radius: var(--radius-xl);
  background: var(--bg-raised); border: var(--border-width-default) solid var(--border-default); }
.kg-ts-chat-msg { max-width: 88%; padding: var(--space-100) var(--space-200); border-radius: var(--radius-lg); background: var(--fill-soft);
  font-size: var(--text-style-body-medium-font-size); overflow-wrap: anywhere; white-space: pre-wrap; }
.kg-ts-chat-msg--mine { align-self: flex-end; background: var(--color-accent-soft); }
.kg-ts-login-hint { color: var(--text-secondary); font-size: var(--text-style-body-medium-font-size); text-align: center; }

@media (min-width: 900px) {
  .kg-ts-page { padding-bottom: 0; }
  .kg-ts-body { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: var(--space-400); align-items: start; }
  .kg-ts-body--detail .kg-ts-list-pane { display: flex; }
  .kg-ts-detail-pane { display: block; position: sticky; top: 140px; }
  .kg-ts-bottom-bar { position: sticky; bottom: 0; margin-top: var(--space-200); border-radius: var(--radius-2xl); box-shadow: var(--shadow-md); }
  .kg-ts-overlay { align-items: center; }
  .kg-ts-panel { border-radius: var(--radius-2xl); }
}
