:root {
  --bg: #f3efe5;
  --panel: #fffdf8;
  --panel-strong: #f8f1df;
  --line: #d6ccb9;
  --text: #1f1a14;
  --muted: #6f6558;
  --accent: #14532d;
  --accent-2: #b45309;
  --danger: #991b1b;
  --shadow: 0 18px 40px rgba(40, 28, 14, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans SC", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(180, 83, 9, 0.12), transparent 24rem),
    linear-gradient(180deg, #f6f1e7 0%, #efe7d8 100%);
  color: var(--text);
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 28px 22px;
  background: rgba(31, 26, 20, 0.95);
  color: #f8f1df;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f59e0b, #14532d);
  font-size: 24px;
  font-weight: 700;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
}

.brand-subtitle {
  color: rgba(248, 241, 223, 0.68);
  font-size: 13px;
}

.menu {
  display: grid;
  gap: 10px;
}

.menu-item {
  border: 1px solid rgba(248, 241, 223, 0.15);
  background: rgba(248, 241, 223, 0.04);
  color: inherit;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
}

.menu-item.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
}

.sidebar-footer {
  margin-top: auto;
}

.session-badge {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(248, 241, 223, 0.08);
  color: rgba(248, 241, 223, 0.9);
  font-size: 14px;
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.topbar h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.feedback {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #e8f5ec;
  border: 1px solid #9ad0ae;
}

.feedback.error {
  background: #fde8e8;
  border-color: #f0a2a2;
  color: var(--danger);
}

.hidden {
  display: none;
}

.panel {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(214, 204, 185, 0.75);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel.narrow {
  max-width: 480px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.stack-form,
.question-list {
  display: grid;
  gap: 16px;
}

.question-list-compact {
  margin-top: 24px;
}

.form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label span,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 48px;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

select {
  min-height: 48px;
}

.primary-button,
.ghost-button {
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
}

.primary-button {
  border: none;
  background: linear-gradient(135deg, var(--accent), #1d8348);
  color: white;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.card h3,
.question-card h3 {
  margin: 0 0 10px;
}

.card p,
.question-card p,
.hint {
  margin: 0;
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hint {
  font-size: 13px;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.meta-item {
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  padding: 14px;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: white;
}

.question-card .score {
  color: var(--accent-2);
  font-weight: 700;
}

.answer-status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #efe8d5;
  color: #72531a;
  font-size: 12px;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form input {
  width: 320px;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 16px;
  }

  .content {
    padding: 18px;
  }

  .panel-header,
  .topbar,
  .inline-form,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input {
    width: 100%;
  }

  .form-columns {
    grid-template-columns: 1fr;
  }
}
