:root {
  --bg: #ffffff;
  --ink: #111827;
  --gray-1: #374151;
  --gray-2: #6b7280;
  --gray-3: #d1d5db;
  --gray-4: #e5e7eb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Lexend", "Segoe UI", "Noto Sans", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  width: min(1180px, 94vw);
  margin: 28px auto 42px;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  letter-spacing: -0.03em;
}

.lead {
  margin: 8px 0 0;
  color: var(--gray-1);
  font-size: clamp(1.02rem, 1.4vw, 1.24rem);
}

.stepper {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.step-pill {
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-1);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.93rem;
  cursor: default;
}

.step-pill.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 600;
}

.screen {
  margin-top: 20px;
  border: 1px solid var(--gray-4);
  border-radius: 18px;
  padding: 22px;
  background: #fff;
}

.screen h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--gray-2);
}

.small {
  font-size: 0.9rem;
}

.load-row {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.load-row input[type="file"] {
  min-width: min(480px, 100%);
}

.step1-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 520px);
  gap: 18px;
  align-items: start;
}

.status-text {
  margin: 12px 0 0;
  color: var(--gray-1);
  font-weight: 500;
}

.summary-card {
  margin-top: 12px;
  border: 1px solid var(--gray-3);
  border-radius: 14px;
  padding: 14px;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
}

.meta-table tr + tr th,
.meta-table tr + tr td {
  padding-top: 8px;
}

.meta-table th,
.meta-table td {
  font-size: clamp(1.06rem, 1.8vw, 1.18rem);
  line-height: 1.25;
}

.meta-table th {
  width: 34%;
  text-align: right;
  padding-right: 14px;
  font-weight: 300;
  color: var(--gray-2);
  white-space: nowrap;
}

.meta-table td {
  text-align: left;
  font-weight: 700;
  color: var(--gray-1);
  word-break: break-word;
}

.library-preview {
  border: 1px solid var(--gray-4);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 8px;
}

.preview-figure {
  margin: 0;
  text-align: center;
}

.preview-image {
  max-width: 100%;
  height: min(360px, 42vh);
  object-fit: contain;
  border: 1px solid var(--gray-4);
  border-radius: 14px;
  padding: 8px;
  background: #fff;
}

.preview-counter {
  margin-top: 8px;
  color: var(--gray-2);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.arrow-btn {
  font-family: inherit;
}

.arrow-btn {
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-1);
  border-radius: 12px;
  width: 52px;
  height: 52px;
  font-size: 1.1rem;
  cursor: pointer;
}

.arrow-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.arrow-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.primary-btn,
.secondary-btn {
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

.primary-btn:hover {
  background: #1d4ed8;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.secondary-btn {
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-1);
}

.secondary-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.icon-btn {
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-1);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  cursor: pointer;
}

.icon-btn .icon-svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.icon-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.moment-nav {
  margin-top: 16px;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.moment-nav.nav-right {
  justify-content: flex-end;
}

.moment-nav.nav-left {
  justify-content: flex-start;
}

.evaluator-grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evaluator-grid label {
  display: grid;
  gap: 7px;
  font-size: 0.94rem;
}

.full-width {
  grid-column: 1 / -1;
}

input[type="text"],
select,
textarea,
input[type="file"] {
  width: 100%;
  border: 1px solid var(--gray-3);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.consent-row {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  color: var(--gray-1);
}

.consent-row input[type="checkbox"] {
  margin-top: 2px;
}

.eval-topbar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.eval-top-right,
.item-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-1);
}

.real-phrase-label {
  margin: 12px 0 0;
  color: var(--gray-2);
  font-size: 0.9rem;
}

.real-phrase {
  margin: 6px 0 0;
  font-size: clamp(1.06rem, 1.4vw, 1.25rem);
  color: var(--ink);
}

.pragmatic-layout,
.top-two-col,
.bottom-two-col {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.stage-image-card,
.stage-input-card,
.sliders-panel,
.chart-box,
.rubric-details {
  border: 1px solid var(--gray-4);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.stage-image {
  width: 100%;
  height: min(340px, 34vh);
  object-fit: contain;
  border: 1px solid var(--gray-4);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.stage-input-card label {
  display: grid;
  gap: 8px;
  font-size: 1rem;
  color: var(--gray-1);
}

.pragmatic-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dimension-layout {
  margin-top: 12px;
}

.right-title {
  margin: 0;
  font-size: 1rem;
}

.sliders-column {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.sliders-panel {
  max-height: 420px;
  overflow: auto;
}

.dimension-card {
  border: 1px solid var(--gray-4);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.dimension-meta strong {
  font-size: 0.92rem;
  color: var(--gray-1);
  display: block;
}

.dimension-meta p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--gray-2);
  line-height: 1.35;
}

.radio-scale {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radio-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  min-width: 24px;
}

.radio-number {
  font-size: 0.76rem;
  color: var(--gray-2);
  font-weight: 600;
  line-height: 1;
}

.radio-option input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--gray-3);
  border-radius: 999px;
  margin: 0;
  display: grid;
  place-items: center;
  background: #fff;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.radio-option input[type="radio"]::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
  transform: scale(0);
  transition: transform 0.15s ease;
}

.radio-option.active .radio-number {
  color: var(--blue);
}

.radio-option.active input[type="radio"] {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.radio-option.active input[type="radio"]::before {
  transform: scale(1);
}

.chart-box {
  position: relative;
  display: grid;
  place-items: center;
}

.score-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

.rubric-details {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.rubric-item {
  border: 1px solid var(--gray-4);
  border-radius: 10px;
  padding: 8px;
}

.rubric-item h4 {
  margin: 0;
  font-size: 0.93rem;
  color: var(--gray-1);
}

.rubric-item p {
  margin: 6px 0 0;
  font-size: 0.89rem;
  color: var(--gray-2);
  line-height: 1.35;
}

.rubric-item.summary {
  border-color: #c7d2fe;
  background: #f8faff;
}

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

.screen-actions.tight {
  margin-top: 10px;
}

@media (max-width: 980px) {
  .pragmatic-layout,
  .top-two-col,
  .bottom-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .step1-grid,
  .evaluator-grid {
    grid-template-columns: 1fr;
  }

  .dimension-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .radio-scale {
    justify-content: flex-start;
  }

  .library-preview {
    grid-template-columns: 42px 1fr 42px;
  }

  .arrow-btn {
    width: 42px;
    height: 42px;
  }

  .pragmatic-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .moment-nav {
    flex-wrap: wrap;
  }
}
