:root {
  --bg-paper: #f5efe2;
  --bg-ink: #132238;
  --bg-panel: rgba(255, 251, 243, 0.9);
  --line: #d8c5a2;
  --line-strong: #9f7f52;
  --text-main: #132238;
  --text-soft: #41566f;
  --accent: #b5602c;
  --accent-strong: #8f4518;
  --accent-soft: #f0d5bf;
  --success: #1f6d4b;
  --error: #9b2f2f;
  --font-title: "Cormorant Garamond", Georgia, serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --shadow: 0 18px 40px rgba(19, 34, 56, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-main);
  background: radial-gradient(circle at top right, #fef5df 0%, #f5efe2 40%, #e9dbc3 100%);
  min-height: 100vh;
}

.page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(19, 34, 56, 0.08) 0%, transparent 40%),
    repeating-linear-gradient(-45deg, rgba(19, 34, 56, 0.03) 0, rgba(19, 34, 56, 0.03) 8px, transparent 8px, transparent 16px);
  pointer-events: none;
  z-index: -1;
}

.shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.6rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 1.5rem 1.6rem;
  background: linear-gradient(145deg, rgba(19, 34, 56, 0.95), rgba(30, 50, 78, 0.96));
  color: #f5ede1;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease-out;
}

.hero-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.8;
}

.hero h1 {
  margin: 0.4rem 0 0.65rem;
  font-family: var(--font-title);
  font-size: clamp(1.7rem, 2.9vw, 2.5rem);
  font-weight: 700;
  line-height: 1.05;
}

.hero-subtitle {
  margin: 0;
  color: #d9e2f3;
  line-height: 1.55;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem;
  box-shadow: 0 10px 20px rgba(19, 34, 56, 0.08);
  animation: rise 0.4s ease-out;
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 0.7rem;
  font-family: var(--font-title);
  font-size: 1.5rem;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid #d7a47e;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.grid {
  display: grid;
  gap: 0.8rem;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7b48e;
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
}

textarea {
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 96, 44, 0.16);
}

.question-list {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.8rem;
}

.question-card {
  border: 1px solid #d6c39f;
  border-radius: 12px;
  background: #fffaf1;
  padding: 0.95rem 1rem;
}

.question-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.question-head h3 {
  margin: 0 0 0.5rem;
  font-size: 1.03rem;
}

.points {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.mc-options {
  display: grid;
  gap: 0.35rem;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  line-height: 1.5;
}

.option input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.65rem;
}

.inline-form label {
  min-width: 110px;
}

.actions,
.actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.actions {
  margin-top: 1rem;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.5rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.btn-primary {
  background: linear-gradient(165deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 8px 16px rgba(143, 69, 24, 0.25);
}

.btn-secondary {
  background: #f4e4cf;
  color: #5e3e23;
  border-color: #d8b792;
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: #bec7d3;
}

.error-text {
  min-height: 1.1rem;
  margin: 0.6rem 0 0;
  color: var(--error);
  font-weight: 700;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.hidden {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.65rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid #d9ccb4;
  padding: 0.5rem 0.45rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  color: #4f6178;
  background: #f8f0e2;
  font-weight: 700;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(181, 96, 44, 0.08);
}

.selected-row {
  background: rgba(181, 96, 44, 0.12);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.detail-card {
  border: 1px solid #d6c39f;
  border-radius: 10px;
  padding: 0.7rem;
  background: #fff9ef;
}

.detail-card h4 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
}

.detail-card p {
  margin: 0.2rem 0;
}

.answer-box {
  border: 1px solid #d4bc99;
  background: #fffdf8;
  border-radius: 10px;
  padding: 0.6rem;
  min-height: 74px;
  white-space: pre-wrap;
  line-height: 1.52;
}

mark {
  background: #fde297;
  color: #5a3a1a;
  padding: 0 0.15rem;
}

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

.status-pill {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
}

.status-submitted {
  background: #e8ebef;
  color: #384656;
}

.status-graded {
  background: #d8f0e4;
  color: #1f5d42;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .panel {
    padding: 1rem;
  }

  .inline-form label {
    min-width: 100%;
  }
}
