:root {
  --nav-h: 68px;
  --ink: #4a2612;
  --ink-soft: #8a5a34;
  --accent: #ff5a2d;
  --accent-soft: #ff9a3c;
  --cheese: #ffc857;
  --panel: rgba(255, 248, 230, 0.72);
  --shadow: rgba(120, 70, 10, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: #f2c84b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.site-bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    url("./assets/bg.png") center center / cover no-repeat,
    #f2c84b;
}

.site-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 236, 180, 0.16);
  backdrop-filter: blur(3px) saturate(1.04);
  -webkit-backdrop-filter: blur(3px) saturate(1.04);
}

.stage {
  z-index: 1;
}

.nav {
  position: relative;
  z-index: 20;
  height: var(--nav-h);
  min-height: var(--nav-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: visible;
  border-bottom: 1px solid rgba(120, 70, 10, 0.12);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(120, 70, 10, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.brand-mark {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 6px 14px rgba(255, 90, 45, 0.28),
    0 0 0 2px rgba(143, 209, 58, 0.35);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name {
  font-family: "Fredoka", "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.ca-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  max-width: min(52vw, 420px);
  margin: 0;
  padding: 9px 16px;
  border: 1px solid rgba(255, 90, 45, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: copy;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 6px 16px rgba(255, 154, 60, 0.14);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ca-btn #caLabel {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ca-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 90, 45, 0.35);
  box-shadow: 0 8px 18px rgba(255, 154, 60, 0.2);
}

.ca-btn:active {
  background: rgba(255, 255, 255, 0.98);
}

.ca-btn[hidden] {
  display: none;
}

.ca-btn.is-copied {
  background: linear-gradient(180deg, #ff7a3c 0%, var(--accent) 100%);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 90, 45, 0.28);
}

.ca-btn.is-failed {
  background: #fff1f0;
  border-color: rgba(220, 38, 38, 0.35);
  color: #b91c1c;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
  z-index: 1;
  margin-left: auto;
  flex-shrink: 0;
}

.twitter-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, #ff7a3c 0%, var(--accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 18px rgba(255, 90, 45, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.twitter-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 22px rgba(255, 90, 45, 0.36);
}

.twitter-btn:active {
  transform: translateY(0);
}

.twitter-icon {
  display: block;
}

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
}

.game-frame {
  width: min(100%, calc((100vh - var(--nav-h) - 32px) * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - var(--nav-h) - 32px);
  border-radius: 22px;
  overflow: hidden;
  background: #1d120b;
  border: 3px solid rgba(255, 248, 220, 0.92);
  box-shadow:
    0 18px 40px var(--shadow),
    0 0 0 5px rgba(242, 200, 75, 0.45);
  animation: rise 0.55s ease-out both;
}

.game-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

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

@media (max-width: 640px) {
  :root {
    --nav-h: 60px;
  }

  .nav {
    padding: 0 12px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .ca-btn {
    max-width: min(46vw, 240px);
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .twitter-btn {
    width: 38px;
    height: 38px;
  }

  .stage {
    padding: 10px;
  }

  .game-frame {
    width: 100%;
    border-radius: 12px;
  }
}
