@font-face {
  font-family: "MaokenAssortedSans";
  src: url("fonts/MaokenAssortedSans-TC.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
  size-adjust: 120%;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Nunito", "MaokenAssortedSans", "Microsoft JhengHei", sans-serif;
  color: #2f5d3a;
}

.stage {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5vh 1rem;
  overflow: hidden;
  background:
    url("img/HomeBack.png") center / cover no-repeat,
    #8ecff0;
}

.panel {
  width: min(420px, 100%);
  padding: 1.35rem 1.35rem 1.15rem;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.78);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 10px 0 rgba(90, 170, 210, 0.22),
    0 22px 36px rgba(80, 140, 90, 0.18);
  backdrop-filter: blur(6px);
  text-align: center;
}

.panel.is-single {
  width: min(380px, 100%);
  padding: 0.85rem 1rem 0.8rem;
}

.panel.is-dual {
  width: min(560px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 0.85rem 1rem 0.75rem;
}

.title {
  margin: 0 0 0.85rem;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #3f8f4e;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.panel.is-dual .title {
  margin-bottom: 0.55rem;
  font-size: 1.7rem;
}

.step {
  margin-bottom: 0.85rem;
}

.panel.is-dual .step {
  margin-bottom: 0.55rem;
}

.label {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #4a7c52;
}

.panel.is-dual .label {
  margin-bottom: 0.45rem;
  font-size: 0.95rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.72rem 1.6rem;
  min-width: 7.2rem;
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

.panel.is-dual .btn {
  padding: 0.55rem 1.2rem;
  min-width: 6.4rem;
  font-size: 1rem;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.btn:active,
.btn.is-selected,
.btn.is-selected:hover {
  transform: translateY(6px);
  filter: none;
}

.btn-green {
  background: linear-gradient(#9ee36a, #6ec94a);
  box-shadow: 0 6px 0 #4aa43a, 0 10px 14px rgba(70, 140, 60, 0.28);
}

.btn-green:active,
.btn-green.is-selected {
  background: linear-gradient(#4fbe3c, #3a9a2c);
  box-shadow: none;
}

.btn-sky {
  background: linear-gradient(#8ed8f6, #57b8e8);
  box-shadow: 0 6px 0 #3494c4, 0 10px 14px rgba(60, 140, 180, 0.28);
}

.btn-sky:active,
.btn-sky.is-selected {
  background: linear-gradient(#3aa3d0, #2b86b4);
  box-shadow: none;
}

.btn-leaf {
  background: linear-gradient(#7ed89a, #4cba72);
  box-shadow: 0 6px 0 #2f9a55, 0 10px 14px rgba(50, 130, 80, 0.28);
}

.btn-leaf:active,
.btn-leaf.is-selected {
  background: linear-gradient(#38a85e, #2a8a4c);
  box-shadow: none;
}

.btn-enter {
  width: 100%;
  margin-top: 0.35rem;
  min-width: 0;
  background: linear-gradient(#ffe27a, #f0c84a);
  color: #3d6b2e;
  box-shadow: 0 6px 0 #d4a017, 0 10px 14px rgba(180, 140, 30, 0.28);
}

.panel.is-dual .btn-enter {
  margin-top: 0.15rem;
}

.btn-enter:hover {
  filter: brightness(1.03);
}

.btn-enter:active {
  background: linear-gradient(#e8c03a, #c9a018);
  box-shadow: none;
  color: #2f541f;
}

.slot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  text-align: left;
}

.panel.is-dual #credential-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
}

.panel.is-dual .slot {
  gap: 0.32rem;
  margin-bottom: 0.35rem;
}

.slot-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #4a7c52;
}

.panel.is-dual .slot-title {
  font-size: 0.88rem;
}

.panel.is-single .title {
  margin-bottom: 0.4rem;
  font-size: 1.4rem;
}

.panel.is-single .step {
  margin-bottom: 0.4rem;
}

.panel.is-single .label {
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}

.panel.is-single .btn {
  padding: 0.4rem 1.1rem;
  min-width: 5.6rem;
  font-size: 0.9rem;
}

.panel.is-single .btn-enter {
  padding: 0.42rem 1rem;
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.panel.is-single .slot {
  gap: 0.28rem;
  margin-bottom: 0.4rem;
}

.panel.is-single .slot-title,
.panel.is-single .field-label {
  font-size: 0.75rem;
}

.panel.is-single .field-label {
  margin-bottom: 0.12rem;
}

.panel.is-single .field input {
  padding: 0.36rem 0.7rem;
  font-size: 0.84rem;
  border-radius: 12px;
}

.panel.is-single .error {
  min-height: 0.9rem;
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
}

.panel.is-dual .title {
  margin-bottom: 0.4rem;
  font-size: 1.45rem;
}

.panel.is-dual .btn {
  padding: 0.42rem 1rem;
  min-width: 5.4rem;
  font-size: 0.88rem;
}

.panel.is-dual .field-label {
  font-size: 0.74rem;
  margin-bottom: 0.12rem;
}

.field {
  display: block;
}

.field-label {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #4a7c52;
}

.field input {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border: 2px solid #b7e3c0;
  border-radius: 16px;
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #2f5d3a;
}

.panel.is-dual .field input {
  padding: 0.5rem 0.75rem;
  font-size: 0.92rem;
}

.field input::placeholder {
  color: #8fb896;
  font-weight: 700;
}

.field input:focus {
  outline: none;
  border-color: #7ed36a;
  box-shadow: 0 0 0 3px rgba(126, 211, 106, 0.35);
}

.error {
  min-height: 1.2rem;
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #d35a4a;
}

.panel.is-dual .error {
  min-height: 0;
  margin: 0.2rem 0 0.15rem;
  font-size: 0.82rem;
}

.panel.is-dual .error:empty {
  display: none;
}

.is-hidden {
  display: none;
}

@media (max-width: 480px) {
  .btn-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .panel.is-dual .btn-row {
    flex-direction: row;
  }

  .panel.is-dual .btn-row .btn {
    width: auto;
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.7rem;
  }
}

@media (max-height: 700px) {
  .stage {
    padding: 1.5vh 1rem 4vh;
  }
}
