@font-face {
  font-family: "Noto Sans CJK TC Subset";
  src: url("fonts/NotoSansCJKtc-Regular-subset.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans CJK TC Subset";
  src: url("fonts/NotoSansCJKtc-Bold-subset.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold: #f3d26a;
  --gold-deep: #c48422;
  --ink: #2a1608;
  --panel: rgba(24, 14, 8, 0.78);
  --cream: #fff6d8;
  --error: #ffd2d2;
  --font: "Noto Sans CJK TC Subset", "Noto Sans CJK TC", "Noto Sans TC",
    "Microsoft JhengHei", "PingFang TC", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1c120c;
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Letterbox fill when the 16:9 stage does not cover the viewport */
.sky-bleed {
  position: fixed;
  inset: 0;
  /* Opaque sky gradient for letterbox sides (bg_far is transparent at the bottom) */
  background: linear-gradient(180deg, #f3d6b3 0%, #e9c4b8 32%, #d4c2d4 58%, #b7c8b0 82%, #6e8a50 100%);
}

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Keep the 16:9 composition on ultrawide screens so characters stay on the path */
@media (min-aspect-ratio: 2/1) {
  .stage {
    inset: auto;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: calc(100vh * 16 / 9);
    height: 100vh;
    box-shadow: 0 0 60px 12px rgba(28, 16, 8, 0.4);
  }
}

.world {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layer {
  position: absolute;
  inset: 0 -6%;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.layer-far {
  background-image: url("assets/bg_far.png");
  animation: drift 46s ease-in-out infinite alternate;
}

.layer-mid {
  background-image: url("assets/bg_mid.png");
  animation: drift 32s ease-in-out infinite alternate-reverse;
}

.layer-near {
  background-image: url("assets/bg_near.png");
  animation: drift 20s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translateX(-2.4%); }
  to { transform: translateX(2.4%); }
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 40%, rgba(20, 10, 4, 0.38) 100%),
    linear-gradient(180deg, rgba(40, 20, 8, 0.12) 0%, transparent 28%, transparent 72%, rgba(10, 6, 2, 0.28) 100%);
}

/* Characters stand on the cobblestone path (~18% from the bottom of the 16:9 art) */
.actors {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16.5%;
  height: 0;
  z-index: 2;
}

.sprite {
  position: absolute;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-repeat: no-repeat;
}

.knight {
  left: 16%;
  width: 48px;
  height: 48px;
  background-image: url("assets/knight_idle.png");
  background-size: 96px 48px;
  transform: scale(4);
  transform-origin: left bottom;
  animation: knight-idle 0.7s infinite;
}

@keyframes knight-idle {
  0%, 49.9% { background-position: 0 0; }
  50%, 100% { background-position: -48px 0; }
}

.slime {
  right: 18%;
  width: 48px;
  height: 48px;
  background-image: url("assets/slime_bounce.png");
  background-size: 96px 48px;
  transform: scale(3.5);
  transform-origin: right bottom;
  animation: slime-frames 0.55s infinite, slime-bob 0.55s ease-in-out infinite;
}

@keyframes slime-frames {
  0%, 49.9% { background-position: 0 0; }
  50%, 100% { background-position: -48px 0; }
}

@keyframes slime-bob {
  0%, 100% { margin-bottom: 0; }
  50% { margin-bottom: 6px; }
}

/* UI */
.ui {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 7% 24px 0;
  text-align: center;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}

.fx-roar {
  width: 96px;
  height: 96px;
  position: relative;
  background-image: url("assets/fx_roar.png");
  background-size: 384px 96px;
  transform: scale(1.7);
  transform-origin: center center;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 8px rgba(40, 0, 40, 0.45));
  animation: roar 1.2s infinite;
}

@keyframes roar {
  0%, 24.9% { background-position: 0 0; }
  25%, 49.9% { background-position: -96px 0; }
  50%, 74.9% { background-position: -192px 0; }
  75%, 100% { background-position: -288px 0; }
}

.title {
  position: relative;
  margin: 18px 0 0;
  font-size: clamp(40px, 7.2vw, 76px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.15;
  color: #ffd56a;
  -webkit-text-stroke: 5px #3a1a06;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #8a4a12, 0 8px 0 #2a1406, 0 14px 18px rgba(0, 0, 0, 0.4);
}

.title::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: linear-gradient(180deg, #fff8d0 0%, #ffe27a 34%, #f0b33a 70%, #d48918 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: none;
  pointer-events: none;
}

.tagline {
  margin: 10px 0 0;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #fff6d8;
  text-shadow:
    -1px -1px 0 #2a1408,
     1px -1px 0 #2a1408,
    -1px  1px 0 #2a1408,
     1px  1px 0 #2a1408,
     0 3px 8px rgba(0, 0, 0, 0.55);
}

.panel {
  width: min(360px, 86%);
  padding: 22px 22px 18px;
  background:
    linear-gradient(180deg, rgba(62, 38, 18, 0.72) 0%, rgba(22, 12, 6, 0.86) 100%);
  border: 3px solid #e8c56a;
  box-shadow:
    0 0 0 2px #5a3814,
    0 0 0 5px #241408,
    0 14px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 230, 160, 0.28),
    inset 0 0 24px rgba(0, 0, 0, 0.25);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 50px;
  margin: 0 0 12px;
  padding: 0 16px;
  border: 2px solid #f0d48a;
  background: linear-gradient(180deg, #6e4524 0%, #3c2410 100%);
  color: var(--cream);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 3px 0 #1a0c04, inset 0 1px 0 rgba(255, 240, 200, 0.2);
  transition: background 0.15s ease, transform 0.08s ease, filter 0.15s ease;
}

.btn-email {
  margin-bottom: 0;
}

.btn:hover {
  background: linear-gradient(180deg, #8a582c 0%, #4c2c14 100%);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1a0c04;
}

.btn:focus-visible {
  outline: 3px solid #ffe07a;
  outline-offset: 3px;
}

.btn-github {
  background: linear-gradient(180deg, #3a3230 0%, #1c1614 100%);
  border-color: #d8c8a0;
}

.btn-github:hover {
  background: linear-gradient(180deg, #524844 0%, #2a221e 100%);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 4px;
  flex-shrink: 0;
}

.btn-github .btn-icon {
  background: #161014;
  color: #fff;
}

.btn-icon svg {
  display: block;
}

.or-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  color: #f0d48a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.or-line::before,
.or-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e8c56a, transparent);
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-label {
  color: #ffe7a8;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.email-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 2px solid #e8c56a;
  background: rgba(16, 10, 6, 0.78);
  color: var(--cream);
  font-family: inherit;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 230, 160, 0.12);
}

.email-input::placeholder {
  color: rgba(255, 230, 180, 0.45);
}

.email-input:focus {
  outline: 3px solid #ffe07a;
  outline-offset: 2px;
}

.note {
  margin: 12px 0 0;
  min-height: 1.4em;
  padding: 8px 10px;
  background: rgba(40, 28, 12, 0.55);
  border: 1px solid #e8c56a;
  color: #ffe7a8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.note[hidden],
.error[hidden] {
  display: none;
}

.error {
  margin: 14px 0 0;
  min-height: 1.4em;
  padding: 8px 10px;
  background: rgba(120, 20, 20, 0.55);
  border: 1px solid #e08080;
  color: var(--error);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-shadow: 0 1px 0 #3a0000;
}

@media (max-width: 720px) {
  .ui {
    padding-top: max(32px, 6vh);
  }

  .title {
    letter-spacing: 0.06em;
    -webkit-text-stroke-width: 4px;
  }

  .knight {
    left: 8%;
    transform: scale(3);
  }

  .slime {
    right: 8%;
    transform: scale(2.6);
  }

  .fx-roar {
    transform: scale(1.35);
    margin-bottom: 2px;
  }

  .panel {
    padding: 16px 14px 14px;
  }

  .btn {
    height: 48px;
    font-size: 16px;
    letter-spacing: 0.04em;
  }
}

@media (max-aspect-ratio: 3/4) {
  .ui {
    padding-top: max(40px, 8vh);
    justify-content: flex-start;
  }

  .logo {
    margin-bottom: 22px;
  }

  .title {
    font-size: clamp(36px, 11vw, 56px);
    margin-top: 12px;
  }

  .actors {
    bottom: 16.5%;
  }

  .knight {
    left: 6%;
    transform: scale(3.2);
  }

  .slime {
    right: 6%;
    transform: scale(2.8);
  }
}

@media (max-height: 500px) {
  .fx-roar {
    display: none;
  }

  .ui {
    padding-top: 4%;
  }

  .title {
    font-size: 36px;
    margin-top: 0;
  }

  .knight,
  .slime {
    transform: scale(2.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .layer-far,
  .layer-mid,
  .layer-near,
  .knight,
  .slime,
  .fx-roar {
    animation: none;
  }

  .layer-far,
  .layer-mid,
  .layer-near {
    inset: 0;
    transform: none;
  }

  /* Static composite avoids drifting seams when motion is off */
  .world::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("assets/bg_field.png") center bottom / cover no-repeat;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    z-index: 1;
  }

  .layer {
    display: none;
  }
}
