:root {
  --ink: #00272b;
  --ink-soft: rgba(0, 39, 43, 0.72);
  --muted: #667678;
  --teal: #019ca8;
  --teal-bright: #00aab8;
  --teal-dark: #0d575d;
  --teal-soft: #eff8f9;
  --teal-line: #d9eced;
  --yellow: #ffeab4;
  --yellow-strong: #ffd055;
  --red: #c53022;
  --red-soft: #fff1ed;
  --gray: #f8f8f8;
  --line: #dddddd;
  --panel: #ffffff;
  --shadow: 10px 25px 45px -15px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:
    linear-gradient(145deg, rgba(255, 234, 180, 0.58), transparent 28%),
    radial-gradient(circle at 92% 5%, rgba(0, 170, 184, 0.18), transparent 24%),
    linear-gradient(180deg, #eff8f9 0, #eff8f9 520px, #ffffff 520px, #f8fbfb 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1440px, calc(100% - 40px));
  margin: 16px auto 0;
  padding: 14px 22px;
  border: 1px solid rgba(1, 156, 168, 0.12);
  border-radius: 72px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 11px 20px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
}

.brand,
.brand-tags,
.ticket-card,
.section-heading {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  min-width: 0;
}

.brand-name {
  color: var(--teal-dark);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  white-space: nowrap;
}

.brand-line {
  width: 1px;
  height: 28px;
  background: rgba(0, 39, 43, 0.24);
}

.brand-en {
  color: rgba(0, 39, 43, 0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  white-space: nowrap;
}

.brand-tags {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-tags span,
.fare-note {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 34px auto 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 30px;
  align-items: end;
  padding: 58px 8px 46px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 18px;
  font-size: clamp(31px, 4.3vw, 56px);
  line-height: 1.16;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
}

.hero-copy p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1.8;
}

.hero-highlight {
  padding: 28px;
  border: 6px solid var(--teal);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 12px 20px rgba(1, 156, 168, 0.12);
}

.hero-highlight span,
.summary-card span,
.result-block span,
.value-list span,
.ticket-card span,
.rules-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.hero-highlight strong {
  display: block;
  margin-top: 8px;
  color: var(--teal-dark);
  font-size: 28px;
  line-height: 1.32;
}

.hero-highlight p {
  margin: 14px 0 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.18fr 1.18fr repeat(3, 1fr);
  gap: 14px;
}

.summary-card {
  min-height: 154px;
  padding: 22px;
  border: 1px solid var(--teal-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, var(--teal-soft));
  box-shadow: var(--shadow);
}

.summary-card.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-bright));
}

.summary-card.lottery {
  border-color: rgba(255, 208, 85, 0.55);
  background: linear-gradient(180deg, #fff7e3, var(--yellow));
}

.summary-card.lottery strong {
  color: var(--teal-dark);
}

.summary-card.primary span,
.summary-card.primary small {
  color: rgba(255, 255, 255, 0.76);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
}

.summary-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

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

.input-panel,
.result-panel,
.stage-panel,
.notice {
  border: 1px solid var(--teal-line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 20px;
}

.result-panel {
  position: sticky;
  top: 106px;
  padding: 20px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.ghost-button {
  min-width: 86px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid #b6d9dc;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 900;
}

.ghost-button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.personal-field {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 240px);
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--teal-line);
  border-radius: 14px;
  background: var(--teal-soft);
}

.personal-field span {
  font-weight: 900;
}

.unit-input {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  border: 1px solid #b6d9dc;
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.unit-input:focus-within {
  outline: 3px solid rgba(1, 156, 168, 0.18);
  border-color: var(--teal);
}

.unit-input em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 44px;
  padding-right: 14px;
  color: var(--teal-dark);
  font-style: normal;
  font-weight: 900;
}

input[type="text"] {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 0 8px 0 14px;
  text-align: right;
}

input[type="text"]:focus {
  outline: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--teal-line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.input-table {
  min-width: 980px;
}

thead {
  background: var(--teal-soft);
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--teal-line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #2e4247;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.number,
th.number {
  text-align: right;
}

.recruit-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--teal-line);
}

.mini-input {
  min-width: 0;
}

.mini-unit {
  max-width: 132px;
}

.money,
.wan {
  color: var(--teal-dark);
  font-weight: 900;
  white-space: nowrap;
}

.money.hot {
  color: var(--red);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6f4;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.muted {
  background: var(--gray);
  color: var(--muted);
}

.result-block {
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-bright));
  color: #fff;
}

.result-block span,
.result-block p {
  color: rgba(255, 255, 255, 0.76);
}

.result-block strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.18;
}

.result-block p {
  margin: 12px 0 0;
  line-height: 1.55;
}

.value-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.value-list div {
  padding: 14px;
  border: 1px solid var(--teal-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, var(--teal-soft));
}

.value-list strong {
  display: block;
  margin-top: 4px;
  color: var(--teal-dark);
  font-size: 24px;
}

.ticket-card {
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

.ticket-card div {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: var(--yellow);
}

.ticket-card strong {
  display: block;
  margin-top: 4px;
  color: var(--teal-dark);
  font-size: 22px;
}

.ticket-card small {
  display: block;
  margin-top: 4px;
  color: rgba(0, 39, 43, 0.62);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.rules-grid article {
  padding: 22px;
  border: 1px solid var(--teal-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.rules-grid h3 {
  margin-top: 6px;
  color: var(--teal-dark);
}

.rules-grid p {
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.75;
}

.stage-panel {
  margin-top: 18px;
  padding: 22px;
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.stage-step {
  min-height: 136px;
  padding: 16px;
  border: 1px solid var(--teal-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, var(--gray));
}

.stage-step.active {
  border-color: var(--teal);
  background: linear-gradient(180deg, var(--teal-soft), #fff);
  box-shadow: inset 0 0 0 2px rgba(1, 156, 168, 0.16);
}

.stage-step span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.stage-step strong,
.stage-step small {
  display: block;
}

.stage-step strong {
  margin-top: 12px;
  color: var(--teal-dark);
  font-size: 18px;
}

.stage-step small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.stage-note {
  margin: 16px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.notice {
  margin-top: 18px;
  padding: 18px 22px;
  background: var(--red-soft);
  border-color: rgba(197, 48, 34, 0.18);
}

.notice strong {
  color: var(--red);
}

.notice p {
  margin: 6px 0 0;
  color: rgba(0, 39, 43, 0.74);
  line-height: 1.7;
}

@media (max-width: 1280px) {
  .calculator-layout,
  .hero {
    grid-template-columns: 1fr;
  }

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

  .result-panel {
    position: static;
  }

  .rules-grid,
  .stage-track {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 90% 2%, rgba(0, 170, 184, 0.18), transparent 22%),
      linear-gradient(180deg, #eff8f9 0, #eff8f9 620px, #ffffff 620px, #f8fbfb 100%);
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    width: calc(100% - 24px);
    border-radius: 24px;
    padding: 18px;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand-line {
    display: none;
  }

  .brand-tags {
    justify-content: flex-start;
  }

  main {
    width: calc(100% - 24px);
    margin-top: 16px;
  }

  .hero {
    padding: 30px 0 24px;
  }

  h1 {
    font-size: clamp(27px, 8.2vw, 36px);
    line-height: 1.18;
  }

  .hero-copy p:last-child {
    font-size: 17px;
  }

  .hero-highlight,
  .input-panel,
  .result-panel,
  .stage-panel {
    padding: 18px;
  }

  .summary-grid,
  .rules-grid,
  .stage-track {
    grid-template-columns: 1fr;
  }

  .personal-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }

  .ticket-card {
    align-items: stretch;
    flex-direction: column;
  }
}
