/* layout.css */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.top-sticky-bar {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  width: 100%;
  flex-shrink: 0;
  padding: 0 20px;
  background-color: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease);
  z-index: var(--z-topbar);
}

.top-sticky-bar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.brand-name {
  margin-right: auto;
  color: var(--focus-ring);
}

.lang-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.app-layout-container {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.sidebar-wrapper {
  display: flex;
  flex: 1;
  min-width: 0;
  position: relative;
}

.controls-sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--bg-surface-2);
  border-right: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: width var(--dur-slow) var(--ease), border-right-width var(--dur-slow) var(--ease), background-color var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease);
}

.sidebar-wrapper.collapsed .controls-sidebar {
  width: 0;
  border-right-width: 0;
}

.sidebar-scrollable-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  padding: 12px;
  gap: 4px;
  overflow-y: auto;
  width: var(--sidebar-width);
  box-sizing: border-box;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.footer-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.metrics-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 6px;
  border-top: 1px solid var(--border-color);
}

.input-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px max(2rem, calc((100% - 960px) / 2));
  overflow: hidden;
  box-sizing: border-box;
}

.workspace-footer-link {
  text-align: center;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 8px;
}

#grid-workspace,
#notes-workspace,
#analytics-workspace,
#privacy-workspace {
  display: none;
}

[data-view-mode="lists"] #grid-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

[data-view-mode="notes"] #notes-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

[data-view-mode="analytics"] #analytics-workspace {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

[data-view-mode="privacy"] #privacy-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

[data-view-mode="notes"] #recall-viewer,
[data-view-mode="notes"] .exam-counter-strip,
[data-view-mode="notes"] .grid-footer,
[data-view-mode="analytics"] #recall-viewer,
[data-view-mode="analytics"] .exam-counter-strip,
[data-view-mode="analytics"] .view-row,
[data-view-mode="privacy"] #recall-viewer,
[data-view-mode="privacy"] .exam-counter-strip,
[data-view-mode="privacy"] .view-switch,
[data-view-mode="privacy"] .grid-footer,
[data-view-mode="privacy"] .workspace-footer-link {
  display: none !important;
}

#grid-workspace.exam-hidden,
#spreadsheet-container.exam-hidden,
.grid-footer.exam-hidden,
.hint-card.exam-hidden,
.view-switch.exam-hidden {
  display: none !important;
}

#recall-viewer {
  display: none;
  min-height: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 16px;
  overflow-y: auto;
  box-sizing: border-box;
}

#recall-viewer.exam-active {
  display: block;
}

.exam-counter-strip {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.exam-counter-strip.exam-active {
  display: flex;
}

.mobile-playback-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 4px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-sizing: border-box;
  flex-shrink: 0;
  z-index: var(--z-sticky);
}