:root {
  --bg: #edf4f8;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: #f8fbfd;
  --ink: #173047;
  --muted: #5b7183;
  --line: #d3dee8;
  --primary: #0d66c2;
  --primary-strong: #084d92;
  --accent: #17795f;
  --warm: #f5b55f;
  --ok: #1f7a48;
  --bad: #b04b36;
  --shadow: 0 18px 42px rgba(33, 63, 92, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background:
    radial-gradient(820px 460px at 0% 0%, rgba(13, 102, 194, 0.16), transparent 62%),
    radial-gradient(720px 420px at 100% 0%, rgba(245, 181, 95, 0.22), transparent 55%),
    linear-gradient(180deg, #f9fbfe, #eef4fa 54%, #e6eef6);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-like {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  background: #edf4fb;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

button:hover:not(:disabled),
.button-like:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(23, 48, 71, 0.12);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #f8fbff;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  background: #edf4fb;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.95em;
  color: var(--ink);
}

.page {
  width: min(1240px, 94vw);
  margin: 24px auto 42px;
  display: grid;
  gap: 18px;
}

.hero,
.panel {
  border-radius: 26px;
  border: 1px solid rgba(72, 102, 129, 0.14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.hero {
  padding: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 18px;
  color: #f8fcff;
  background:
    linear-gradient(135deg, rgba(8, 77, 146, 0.98), rgba(13, 102, 194, 0.96) 58%, rgba(23, 121, 95, 0.94));
}

.eyebrow {
  display: inline-block;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 12px 0 14px;
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.04;
}

.hero-intro {
  max-width: 62ch;
  color: rgba(248, 252, 255, 0.88);
  font-size: 1.05rem;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(248, 252, 255, 0.16);
  border: 1px solid rgba(248, 252, 255, 0.18);
}

.hero .pill {
  color: #f8fcff;
}

.hero .pill code {
  background: rgba(8, 33, 61, 0.42);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-side {
  display: grid;
  gap: 12px;
}

.hero-card,
.score-card {
  border-radius: 20px;
  padding: 16px;
  background: rgba(248, 252, 255, 0.12);
  border: 1px solid rgba(248, 252, 255, 0.18);
}

.hero-card h2,
.score-card strong {
  margin-bottom: 10px;
}

.hero-card ol {
  margin: 0;
  padding-left: 20px;
}

.hero-card li + li {
  margin-top: 8px;
}

.score-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(248, 252, 255, 0.78);
}

.score-card strong {
  display: block;
  font-size: 1.5rem;
}

.panel {
  padding: 18px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.sub {
  margin-bottom: 0;
  color: var(--muted);
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 253, 0.92));
}

.question-card h3 {
  margin-bottom: 10px;
  font-size: 1.03rem;
}

.task-text {
  min-height: 72px;
  color: #29455d;
}

.answer-row {
  margin-top: 12px;
}

.model-answer {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f8fc;
  border: 1px dashed #c9d8e7;
  color: #29455d;
  font-size: 0.94rem;
}

.feedback {
  min-height: 1.4rem;
  margin-top: 10px;
  font-weight: 800;
}

.feedback.ok {
  color: var(--ok);
}

.feedback.bad {
  color: var(--bad);
}

.sql-panel {
  overflow: hidden;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sql-shell {
  display: grid;
  grid-template-columns: minmax(220px, 0.52fr) minmax(0, 1.8fr);
  gap: 14px;
}

.sql-notes,
.sql-workspace {
  display: grid;
  gap: 14px;
}

.mini-card,
.editor-card,
.results-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(245, 249, 252, 0.93));
}

.mini-card ul {
  margin: 0;
  padding-left: 18px;
}

.mini-card li + li {
  margin-top: 6px;
}

.field-label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 800;
}

#sqlEditor {
  min-height: 180px;
  font-family: "Consolas", "Courier New", monospace;
  line-height: 1.45;
}

.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.results-head h3 {
  margin-bottom: 0;
}

#sqlResultStatus {
  color: var(--muted);
  font-size: 0.94rem;
}

.sql-results {
  min-height: 180px;
  overflow: auto;
  width: 100%;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  color: #8296a9;
  border: 1px dashed #cbd8e5;
  border-radius: 16px;
  padding: 24px;
  background: #f8fbfd;
}

.sql-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 16px;
  overflow: hidden;
}

.sql-table th,
.sql-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #dde7f0;
  text-align: left;
  vertical-align: top;
}

.sql-table th {
  position: sticky;
  top: 0;
  background: #edf4fb;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sql-table tbody tr:nth-child(even) {
  background: rgba(237, 244, 251, 0.42);
}

.table-dialog {
  width: min(1100px, 94vw);
  max-width: 1100px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  box-shadow: var(--shadow);
}

.table-dialog::backdrop {
  background: rgba(18, 35, 51, 0.5);
  backdrop-filter: blur(3px);
}

.table-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 253, 0.92));
}

.table-dialog__header h2 {
  margin-bottom: 8px;
}

.table-dialog__content {
  max-height: 70vh;
  overflow: auto;
  padding: 18px;
  background: #fff;
}

.feedback-line {
  min-height: 1.4rem;
  margin: 0;
  font-weight: 800;
}

@media (max-width: 920px) {
  .hero,
  .sql-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(96vw, 1240px);
    margin: 16px auto 28px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 16px;
  }

  .panel-head,
  .results-head {
    flex-direction: column;
  }

  .editor-actions,
  .toolbar-actions {
    width: 100%;
  }

  .editor-actions button,
  .toolbar-actions button,
  .panel-head > button {
    flex: 1 1 auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .page {
    width: 100%;
    margin: 0;
  }

  .hero,
  .panel {
    box-shadow: none;
    border: 1px solid #d7dee5;
  }
}
