:root {
  color-scheme: light;
  font-family: Arial, "Helvetica Neue", sans-serif;
  background: #f6f7f9;
  color: #17191f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button {
  font: inherit;
}

.shell {
  width: min(920px, calc(100vw - 32px));
  margin: 32px auto;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid #d8dde6;
}

a {
  color: #214f9f;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid #d8dde6;
}

.eyebrow {
  margin: 0 0 8px;
  color: #596274;
  font-size: 14px;
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid #c9d0dc;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shuffle-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #c9d0dc;
  border-radius: 8px;
  background: #ffffff;
  color: #424b5f;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.meta-grid div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #ffffff;
}

.meta-grid span {
  display: block;
  margin-bottom: 8px;
  color: #596274;
  font-size: 13px;
}

.meta-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.content {
  padding: 20px 0;
}

h2 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.content p {
  margin: 0;
  padding: 16px;
  min-height: 72px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #ffffff;
  line-height: 1.7;
  white-space: pre-wrap;
}

.actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.actions button {
  min-height: 44px;
  border: 1px solid #c9d0dc;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.actions button:first-child {
  border-color: #248a5b;
  color: #17633f;
}

.actions button:nth-child(2) {
  border-color: #b84444;
  color: #8c2f2f;
}

.actions button:nth-child(3),
.actions button:nth-child(4) {
  border-color: #214f9f;
  color: #214f9f;
  font-weight: 700;
}

.actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.tutor-insight-panel,
.ai-tutor-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #ffffff;
}

.ai-tutor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-tutor-header h2 {
  margin: 0;
}

.ai-tutor-status {
  color: #596274;
  font-size: 14px;
}

.ai-tutor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-tutor-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #c9d0dc;
  border-radius: 8px;
  background: #ffffff;
  color: #214f9f;
  cursor: pointer;
}

.tutor-insight-panel pre,
.ai-tutor-panel pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.7;
}

.ai-tutor-panel.is-collapsed {
  padding: 12px 16px;
}

.ai-tutor-panel.is-collapsed .ai-tutor-header {
  margin-bottom: 0;
}

.ai-tutor-panel.is-collapsed pre {
  display: none;
}

.status {
  min-height: 24px;
  color: #596274;
}

.wrong-link a {
  color: #214f9f;
}

@media (max-width: 720px) {
  .meta-grid,
  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .ai-tutor-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-tutor-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .ai-tutor-actions button {
    flex: 1 1 96px;
  }

  h1 {
    font-size: 34px;
  }
}
