:root {
  --bg: #f4efe6;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-strong: #fffaf1;
  --ink: #1f2a2a;
  --muted: #61706d;
  --accent: #bf5a36;
  --accent-dark: #8f3d21;
  --line: rgba(31, 42, 42, 0.12);
  --success: #1d7a52;
  --error: #aa3a2a;
  --loading: #7a5b1d;
  --shadow: 0 18px 50px rgba(77, 53, 30, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 90, 54, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(87, 119, 111, 0.18), transparent 24%),
    linear-gradient(180deg, #efe6d8 0%, #f7f3ec 100%);
  min-height: 100vh;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  padding: 28px 32px 18px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

.hero h1,
.result-header h2 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
  font-weight: 800;
}

.hero-copy {
  max-width: 720px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.form-card,
.result-card {
  padding: 28px;
}

.form-card {
  margin-top: 8px;
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

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

.form-card > form > .grid-two:first-child {
  grid-template-columns: 1fr;
}

.field,
.upload-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(31, 42, 42, 0.08);
  background: rgba(255, 255, 255, 0.45);
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.field span,
.upload-title {
  font-weight: 700;
}

.field-tip {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.info-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(31, 42, 42, 0.08);
  background: rgba(255, 255, 255, 0.45);
}

.info-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.field input,
.field select,
.upload-box input,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
  font-family: inherit;
}

.control-card select {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  text-align-last: center;
}

.upload-grid {
  margin-top: 20px;
}

.upload-box {
  padding: 18px;
  border: 1px dashed rgba(31, 42, 42, 0.2);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.45);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.upload-box.is-selected {
  border-color: rgba(191, 90, 54, 0.45);
  background: rgba(255, 247, 240, 0.95);
  transform: translateY(-1px);
}

.upload-hint,
.note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.upload-state {
  display: inline-flex;
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 42, 42, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-box.is-selected .upload-state {
  background: rgba(191, 90, 54, 0.12);
  color: var(--accent-dark);
}

.actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  font-family: inherit;
}

#submit-btn,
.secondary-btn {
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
}

#submit-btn {
  background: var(--accent);
  color: white;
}

#submit-btn.is-ready {
  background: linear-gradient(135deg, #b94f2f 0%, #cf6b3d 55%, #e08f53 100%);
  box-shadow: 0 10px 24px rgba(191, 90, 54, 0.22);
}

#submit-btn:hover,
.secondary-btn:hover,
.tab-btn:hover {
  transform: translateY(-1px);
}

#submit-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.secondary-btn {
  background: #e9dfd0;
  color: var(--ink);
}

.status-stack {
  margin-top: 20px;
}

.progress-card {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(122, 91, 29, 0.08);
  border: 1px solid rgba(122, 91, 29, 0.16);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--ink);
}

.progress-track {
  margin-top: 12px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(31, 42, 42, 0.1);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bf5a36 0%, #d58445 50%, #e6b85c 100%);
  box-shadow: 0 0 18px rgba(191, 90, 54, 0.25);
  transition: width 0.45s ease;
}

.progress-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-message {
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 600;
}

.status-message.success {
  background: rgba(29, 122, 82, 0.12);
  color: var(--success);
}

.status-message.error {
  background: rgba(170, 58, 42, 0.12);
  color: var(--error);
}

.status-message.loading {
  background: rgba(122, 91, 29, 0.12);
  color: var(--loading);
}

.stats-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.result-card {
  margin-top: 24px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.tab-btn {
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-weight: 700;
}

.tab-btn.active {
  background: var(--ink);
  color: white;
}

.tab-panel {
  display: none;
  margin-top: 18px;
}

.tab-panel.active {
  display: block;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.48);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.55;
}

th {
  position: sticky;
  top: 0;
  background: #f7f0e6;
}

th:nth-child(1),
td:nth-child(1) {
  width: 6%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 21%;
}

td:nth-child(2) {
  font-family: "Times New Roman", Times, serif;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

th:nth-child(3),
td:nth-child(3) {
  width: 36.5%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 36.5%;
}

textarea {
  min-height: 460px;
  resize: vertical;
  line-height: 1.5;
}

.subtitle-edit {
  width: 100%;
  min-height: 88px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
  font-size: 16px;
  font-family: "Times New Roman", Times, serif;
  color: var(--ink);
}

.subtitle-edit {
  width: 100%;
  min-height: 96px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
  font-size: 16px;
  font-family: "Times New Roman", Times, serif;
  color: var(--ink);
}

.hidden {
  display: none;
}

@media (max-width: 840px) {
  .grid-two,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .result-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
    padding-bottom: 28px;
  }

  .hero,
  .form-card,
  .result-card {
    padding: 20px;
  }
}
