


:root {
  --font-mono: ui-monospace, Consolas, "Courier New", monospace;
  --font-sans: system-ui, -apple-system, sans-serif;

  --bg: #f2f8fb;
  --panel-bg: #ffffff;
  --panel-shadow: 0 4px 18px rgba(0, 20, 30, 0.08);
  --border: #cbdde2;
  --border-light: #e3edf1;
  --text: #173642;
  --text-secondary: #3a5863;
  --accent: #1c6d8c;
  --accent-hover: #155e78;
  --success: #1e9059;
  --warn: #c55a1a;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --header-height: 56px;
}


*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow: hidden;            
  height: 100vh;
  height: 100dvh;              
}


.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}


.global-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  flex-shrink: 0;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toolbar-group select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.controls-row {
  gap: 6px;
}

.time-pill {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-label {
  font-weight: 500;
  opacity: 0.85;
}


.btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn:hover {
  background: #eef5f8;
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}


.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;               
  gap: 16px;
  padding: 16px;
}


.left-column {
  flex: 6;                     
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  gap: 16px;
}


.right-column {
  flex: 4;                     
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.right-column::-webkit-scrollbar {
  width: 5px;
}
.right-column::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}


.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}


.scene-panel {
  flex: 1 1 50%;               
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.scene-panel canvas {
  display: block;
  width: 100%;
  height: 90%;
  border-radius: var(--radius-sm);
  background: #f5fbfd;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-header h2 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.force-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.scene-badge {
  position: absolute;
  bottom: 12px;
  left: 16px;
  background: rgba(23, 54, 66, 0.8);
  color: #d6eaf3;
  padding: 2px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
  pointer-events: none;
}


.left-bottom {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}


.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.tab-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover {
  color: var(--accent-hover);
}


.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}


.tab-pane::-webkit-scrollbar,
.right-column::-webkit-scrollbar {
  width: 5px;
}
.tab-pane::-webkit-scrollbar-thumb,
.right-column::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}


.param-card {
  background: #f9fcfd;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.param-card h4 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin-bottom: 14px;
  color: var(--accent);
}

.param-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.param-row label {
  width: 110px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.param-row input[type="range"] {
  flex: 1;
  min-width: 120px;
}

.param-row input[type="number"] {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.param-row select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.param-shortcuts {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.shortcut-btn {
  font-size: 0.8rem;
}


.state-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.state-card {
  background: #f5fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.state-card small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.state-card strong {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text);
}


.force-table-wrap {
  margin-bottom: 16px;
}

.force-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.force-table th {
  text-align: left;
  padding: 8px;
  background: #edf4f6;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.force-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.force-table th:nth-child(1),
.force-table td:nth-child(1) {
  width: 20%;
}

.force-table th:nth-child(2),
.force-table td:nth-child(2) {
  width: 16%;
}

.force-table th:nth-child(3),
.force-table td:nth-child(3) {
  width: 16%;
}

.force-table th:nth-child(4),
.force-table td:nth-child(4) {
  width: 20%;
}

.force-table th:nth-child(5),
.force-table td:nth-child(5) {
  width: 28%;
}

.force-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.work-energy-line {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
}


.series-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.series-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  cursor: pointer;
}

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 180px;
  background: #fdfdfd;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-tooltip {
  position: absolute;
  background: rgba(12, 40, 52, 0.88);
  color: #e6f2f8;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip.hidden {
  display: none;
}


.event-block h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.event-stream {
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.78rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #f9fcfd;
}

.event-item {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-light);
  color: var(--text-secondary);
}


.summary-block {
  background: #f7fbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}

.summary-block h4 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.summary-block ul {
  list-style: disc;
  padding-left: 20px;
}

.summary-block li {
  font-size: 0.85rem;
  margin-bottom: 5px;
  color: var(--text);
}


.quiz-card {
  background: #f9fcfd;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.quiz-option {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
}

.quiz-option:hover {
  background: #eef5f8;
}

.quiz-option.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.quiz-option.correct,
.quiz-option.correct:hover {
  background: rgba(31, 155, 99, 0.14);
  color: #14623f;
  border-color: #1f9b63;
}

.quiz-option.wrong,
.quiz-option.wrong:hover {
  background: rgba(196, 69, 54, 0.13);
  color: #8f2b21;
  border-color: #c44536;
}

.quiz-option:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-feedback {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-height: 1.6em;
  margin-bottom: 8px;
}

#askAIBtn {
  color: var(--accent);
  margin-left: 8px;
  cursor: pointer;
  text-decoration: underline;
}

.quiz-score {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.quiz-actions {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.quiz-actions-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-actions-one {
  grid-template-columns: 1fr;
}

.quiz-action-btn,
.quiz-actions .btn {
  width: 100%;
}


.chat-config {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.chat-config label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-config input,
.chat-config select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.chat-warning {
  font-size: 0.72rem;
  color: var(--warn);
  margin-bottom: 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fdfdfd;
  margin-bottom: 10px;
  min-height: 160px;
}

.msg-row {
  margin-bottom: 8px;
  display: flex;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 80%;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  background: var(--accent);
  color: #fff;
}

.msg-row.assistant .msg-bubble {
  background: #eef3f6;
  color: var(--text);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
}


@media (max-width: 768px) {
  body {
    overflow: auto;            
    height: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .global-toolbar {
    flex-wrap: wrap;
    height: auto;
    gap: 8px;
    padding: 10px 16px;
  }

  .main-layout {
    flex-direction: column;
    gap: 14px;
    padding: 12px;
  }

  .left-column,
  .right-column {
    flex: none;
    width: 100%;
    overflow: visible;
  }

  .left-column {
    display: block;
  }

  .scene-panel {
    height: 50vh;              
    flex: none;
    margin-bottom: 12px;
  }

  .left-bottom {
    height: auto;
    overflow: visible;
  }

  .right-column {
    overflow: visible;
  }

  .force-table th:nth-child(3),
  .force-table td:nth-child(3) {
    display: none;
  }

  
}