:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #666666;
  --line: #e7e7e7;
  --soft-line: #f0f0f0;
  --gold: #c7b961;
  --gold-dark: #9a8827;
  --green: #7cd9b5;
  --green-dark: #168f64;
  --dark: #111111;
  --shadow: 0 0 25px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: 70px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: 1px;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.wrap {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 24px;
}

.logo-text {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
  font-size: 18px;
}

.logo-text b {
  color: var(--gold);
  font-weight: 400;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  color: #555555;
  font-size: 14px;
}

.top-nav a:hover {
  color: var(--gold-dark);
}

.loading-cover {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #555555;
  cursor: progress;
}

body.is-ready .loading-cover {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  font-weight: 700;
}

.button:hover {
  border-color: #cfcfcf;
}

.button-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #ffffff;
}

.button-dark {
  background: var(--dark);
  border-color: var(--dark);
  color: #ffffff;
}

.button-green {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.button-line {
  background: #ffffff;
}

.button.disabled,
.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.site-footer {
  margin-top: 40px;
  padding: 30px 0;
  color: #666666;
  font-size: 14px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  min-height: 600px;
  margin-top: 30px;
  margin-bottom: 20px;
}

.bulletin-section,
.login-section,
.content-section,
.notice-box {
  background: var(--surface);
}

.bulletin-section {
  min-height: 600px;
}

.scroll-panel {
  height: 540px;
  margin: 30px;
  padding-right: 30px;
  overflow-y: auto;
  text-align: left;
}

.scroll-panel::-webkit-scrollbar {
  width: 5px;
  background: #dddddd;
}

.scroll-panel::-webkit-scrollbar-thumb {
  background: #666666;
}

.scroll-panel h1,
.scroll-panel h2 {
  color: var(--gold);
  font-weight: 400;
}

.scroll-panel h1 {
  margin-top: 0;
  font-size: 24px;
}

.scroll-panel h2 {
  margin-top: 28px;
  font-size: 20px;
}

.scroll-panel p {
  margin: 0 0 14px;
  color: #333333;
  font-size: 15px;
}

.login-section {
  min-height: 600px;
  padding: 30px;
  text-align: center;
}

.login-copy {
  margin: 4px 0 8px;
  color: #e9e9e9;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
}

.login-section h2 {
  margin: 0 0 24px;
  font-weight: 400;
}

.login-form {
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 8px;
  color: #555555;
  text-align: left;
  font-size: 14px;
}

.field input {
  width: 100%;
  padding: 12px;
  border: 2px solid #f5f5f5;
  background: #f5f5f5;
  outline: 0;
}

.field input:focus {
  border-color: var(--gold);
  background: #ffffff;
}

.form-note {
  margin: 4px 0;
  color: #777777;
  font-size: 12px;
  line-height: 1.8;
  text-align: left;
}

.status-text {
  min-height: 24px;
  color: var(--gold-dark);
  font-size: 14px;
}

.page-stack {
  display: grid;
  gap: 28px;
  padding: 30px 0;
}

.content-section {
  padding: 26px;
}

.section-head {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  text-align: left;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.gold-text {
  color: var(--gold-dark) !important;
}

.data-table {
  display: table;
  width: 100%;
  overflow: hidden;
  border: 1px solid #e4e3e3;
  background: #ffffff;
}

.table-row {
  display: table-row;
}

.table-row > div {
  display: table-cell;
  padding: 10px;
  border-top: 1px solid var(--soft-line);
  color: #333333;
  font-size: 14px;
  vertical-align: middle;
}

.table-row.table-head > div {
  border-top: 0;
  background: #f9f9f9;
  color: #111111;
  font-weight: 700;
}

.compact .table-row > div {
  width: 25%;
}

.actions-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.notice-box {
  padding: 20px;
  color: #3e3e3e;
  font-size: 13px;
  text-align: left;
}

.notice-box p {
  margin: 0;
}

.qa-panel {
  display: none;
}

.qa-panel.is-open {
  display: block;
}

.qa-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(255, 255, 255, 0.82);
}

.qa-modal {
  position: fixed;
  z-index: 31;
  top: 60px;
  left: 50%;
  width: min(400px, calc(100% - 48px));
  padding: 25px;
  background: #ffffff;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.qa-modal h2 {
  margin: 0 0 8px;
  color: #787878;
  font-size: 15px;
  font-weight: 400;
  text-align: center;
}

.qa-modal h3 {
  margin: 0 0 10px;
  color: var(--gold-dark);
  font-size: 22px;
  font-weight: 400;
  text-align: center;
}

.qa-modal form {
  display: grid;
  gap: 5px;
}

.qa-modal label {
  display: block;
  padding: 3px;
  cursor: pointer;
  text-align: left;
}

.qa-modal input {
  margin-right: 8px;
}

body[data-page="exam"] {
  background: #ffffff;
}

.exam-head {
  border-bottom: 1px solid var(--line);
}

.exam-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
}

.exam-head h1 {
  margin: 0;
  color: var(--gold);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 4px;
}

.exam-head small {
  margin-left: 10px;
  color: #a8a8a8;
  font-size: 18px;
  letter-spacing: 1px;
}

.countdown {
  color: #333333;
  font-size: 18px;
}

.countdown span {
  color: var(--gold-dark);
  font-weight: 700;
}

.exam-question {
  padding-top: 50px;
  padding-bottom: 50px;
}

.question-title {
  width: min(920px, 100%);
  margin: 0 auto 24px;
  text-align: left;
}

.question-number {
  display: inline-block;
  margin-bottom: 12px;
  color: #555555;
  font-size: 20px;
}

.question-number span:first-child {
  color: var(--gold);
  font-size: 25px;
}

.question-line {
  display: flex;
  align-items: baseline;
  gap: 15px;
  margin-bottom: 14px;
  font-size: 19px;
}

.question-line strong {
  min-width: 76px;
  color: #af9917;
  font-size: 25px;
  font-weight: 400;
}

.question-title p {
  margin: 0;
  color: #333333;
  font-size: 16px;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(920px, 100%);
  margin: 0 auto 24px;
  padding: 0;
  list-style: none;
}

.choice-list li {
  min-height: 92px;
}

.choice-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  border: 2px solid var(--line);
  background: #ffffff;
  color: #222222;
  cursor: pointer;
  text-align: left;
}

.choice-button:hover {
  background: #e7e7e7;
}

.choice-button.is-active {
  border-color: var(--gold);
  background: var(--gold);
  color: #ffffff;
}

.choice-list[data-type="multiple"] .choice-button {
  border-color: #cbeee0;
}

.choice-list[data-type="multiple"] .choice-button:hover {
  background: #cbeee0;
}

.choice-list[data-type="multiple"] .choice-button.is-active {
  border-color: var(--green);
  background: var(--green);
}

.write-area {
  display: none;
  width: min(920px, 100%);
  margin: 0 auto 24px;
}

.write-area.is-open {
  display: block;
}

.write-area textarea {
  width: 100%;
  min-height: 220px;
  padding: 25px;
  border: 0;
  background: #f9f9f9;
  color: #222222;
  font-size: 16px;
  outline: 0;
  resize: vertical;
}

.next-button {
  display: block;
  width: min(300px, 100%);
  height: 50px;
  margin: 15px auto 0;
  background: #dbdbdb;
  color: #ffffff;
  cursor: default;
  font-weight: 700;
  user-select: none;
}

.next-button.is-active {
  background: #000000;
  cursor: pointer;
}

.next-button.is-active:hover {
  color: var(--gold);
}

.answer-note {
  margin: 18px 0 0;
  color: #717171;
  font-size: 15px;
  text-align: center;
}

.finish-section {
  display: none;
  padding-top: 60px;
  padding-bottom: 60px;
  text-align: center;
}

.finish-section.is-open {
  display: block;
}

.finish-section h2 {
  margin: 0 0 20px;
  color: var(--gold);
  font-size: 30px;
  font-weight: 400;
}

.finish-section p {
  margin: 0 0 30px;
  color: #333333;
}

@media (max-width: 900px) {
  body {
    padding-top: 96px;
  }

  .topbar,
  .topbar-inner {
    height: 96px;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .top-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }

  .login-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .bulletin-section,
  .login-section {
    min-height: 0;
  }

  .scroll-panel {
    height: auto;
    min-height: 260px;
  }

  .data-table,
  .table-row,
  .table-row > div {
    display: block;
  }

  .table-row {
    border-top: 1px solid var(--soft-line);
  }

  .table-row.table-head {
    display: none;
  }

  .table-row > div {
    border-top: 0;
  }

  .compact .table-row > div {
    width: auto;
  }

  .exam-head-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 18px 0;
  }

  .exam-head h1 {
    text-align: left;
  }

  .exam-head small {
    display: block;
    margin: 6px 0 0;
  }

  .choice-list {
    grid-template-columns: 1fr;
  }

  .question-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .wrap {
    width: min(100% - 30px, 1240px);
  }

  .logo-text {
    gap: 4px;
    font-size: 16px;
  }

  .logo-text b {
    display: block;
    width: 100%;
  }

  .content-section {
    padding: 18px;
  }

  .scroll-panel,
  .login-section {
    margin: 0;
    padding: 20px;
  }
}
