:root {
  /* base surfaces — deep blue-black (Penguin King) */
  --color-navy: #f1ebdb;
  --color-navy-2: #f7f1e4;
  --color-surface: #f9f5eb;
  --color-surface-2: #f3ebda;
  --color-card: #fffefa;
  --color-card-hi: #f6efdf;

  /* brand — royal blue primary, cyan bright, gold accent */
  --color-cyan: #2ba0e0;
  --color-cyan-bright: #1f8fce;
  --color-ice: #bfe6f5;
  --color-orange: #6cbf3c;

  /* text */
  --color-text: #34302a;
  --color-muted: #6c6350;
  --color-faint: #8a7d63;

  /* lines */
  --color-border: rgba(150,125,90,0.3);
  --color-border-2: rgba(150,125,90,0.4);
  --color-border-strong: rgba(108,191,60,0.5);

  --color-danger: #e5484d;

  /* element colors (Palworld 9) */
  --el-neutral: #adbcc6;
  --el-fire: #f2683c;
  --el-water: #3ba7ef;
  --el-electric: #f4cf3c;
  --el-grass: #57c948;
  --el-ice: #57cfe0;
  --el-ground: #d79a54;
  --el-dark: #b558c9;
  --el-dragon: #8a72ef;

  --shadow-card: 0 20px 46px rgba(60,78,112,0.13);
  --shadow-pop: 0 24px 70px rgba(60, 78, 112, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
  min-height: 100%;
  background: var(--color-navy);
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 620px at 50% -8%, rgba(108,191,60,0.13), transparent 62%),
    radial-gradient(900px 520px at 88% 4%, rgba(108,191,60,0.09), transparent 60%),
    radial-gradient(760px 520px at 6% 20%, rgba(43,160,224,0.1), transparent 60%),
    linear-gradient(180deg, #fbf5ea 0%, #f1ebdb 46%, #f1ebdb 100%);
  background-attachment: fixed;
}

/* soft vignette + fine grain, fixed so it never scrolls */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 92% at 50% 0%, transparent 62%, rgba(150, 120, 70, 0.07) 100%);
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.wrap {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

/* ── Hero ─────────────────────────────────────────── */
.hero {
  max-width: 800px;
  margin-bottom: 30px;
  animation: rise 0.55s var(--ease) both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--color-border-2);
  border-radius: 999px;
  color: #2a8f4f;
  background: rgba(108,191,60,0.12);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 10px rgba(108,191,60,0.8);
}

.hero h1 { font-family: "Baloo 2", "Manrope", system-ui, sans-serif; 
  margin: 0;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
  font-weight: 800;
}

.hero h1 .grad {
  color: transparent;
  background: linear-gradient(120deg, #2494d6, #5aa62e);
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 700;
}

.tagline {
  max-width: 640px;
  margin: 15px 0 0;
  color: var(--color-muted);
  font-size: clamp(0.95rem, 2vw, 1.06rem);
}

.shell {
  display: grid;
  gap: 18px;
  animation: rise 0.6s var(--ease) 0.06s both;
}

/* ── Mode switch ──────────────────────────────────── */
.modes {
  width: min(100%, 560px);
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.035);
}

.modes button {
  min-height: 60px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: 180ms var(--ease);
}

.modes button:hover {
  color: var(--color-text);
  background: rgba(108,191,60,0.06);
}

.modes button[aria-pressed="true"] {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: linear-gradient(135deg, rgba(108,191,60,0.18), rgba(108,191,60,0.12));
  box-shadow: inset 0 0 22px rgba(108,191,60,0.06), 0 6px 18px rgba(60, 78, 112, 0.1);
}

.mode-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: var(--color-cyan);
  font-size: 1.1rem;
}

.mode-icon svg { width: 19px; height: 19px; }
.mode-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(60, 78, 112, 0.22));
  transition: transform 180ms var(--ease);
}

.modes button:hover .mode-icon img { transform: scale(1.06) rotate(-3deg); }
.modes button[aria-pressed="true"] .mode-icon img { transform: scale(1.08); }

.modes button > span:last-child { display: grid; gap: 2px; }
.modes b { color: inherit; font-size: 0.9rem; font-weight: 750; }
.modes small { color: var(--color-muted); font-size: 0.73rem; }

/* ── Panels ───────────────────────────────────────── */
.panel {
  position: relative;
  z-index: 1;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(0,0,0,0.035), transparent 120px),
    linear-gradient(150deg, rgba(255,254,249,0.98), rgba(247,240,225,0.98));
  box-shadow: var(--shadow-card);
}

.panel.suggest-open { z-index: 80; }

.section-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  color: var(--color-cyan);
  background: rgba(108,191,60,0.09);
  box-shadow: inset 0 0 14px rgba(108,191,60,0.08);
  font-size: 0.72rem;
  font-weight: 800;
}

.panel h2 {
  margin: 0;
  font-size: clamp(1.08rem, 2.5vw, 1.28rem);
  line-height: 1.25;
  letter-spacing: -0.03em;
  font-weight: 750;
}

.hint { margin: 4px 0 0; color: var(--color-muted); font-size: 0.85rem; }

/* ── Search ───────────────────────────────────────── */
.search-row { position: relative; display: grid; gap: 12px; }
.search-row.dual { grid-template-columns: 1fr auto 1fr; align-items: start; }
.field { position: relative; }

.field input {
  width: 100%;
  min-height: 54px;
  padding: 13px 48px;
  border: 1px solid var(--color-border-2);
  border-radius: 14px;
  outline: none;
  color: var(--color-text);
  background: rgba(255,255,255,0.72);
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}

.field input::placeholder { color: rgba(134, 164, 180, 0.6); }
.field input:hover { border-color: rgba(150,125,90,0.36); }

.field input:focus {
  border-color: var(--color-cyan);
  background: rgba(255,254,250,0.96);
  box-shadow: 0 0 0 3px rgba(108,191,60,0.14);
}

.field .ico {
  position: absolute;
  z-index: 1;
  left: 17px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--color-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

/* ── Portrait frame (.pf) — circular, zoomed so the pal fills the ring ── */
.pf {
  --zoom: 1.16;
  position: relative;
  width: var(--s, 48px);
  height: var(--s, 48px);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid rgba(150,125,90,0.14);
  background: radial-gradient(circle at 50% 34%, #fffefa 0%, #faf4e8 58%, #f7f1e4 100%);
  box-shadow: inset 0 0 0 1px rgba(60,78,112,0.08), inset 0 -6px 15px rgba(60,78,112,0.09);
}

.pf img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(var(--zoom));
  filter: drop-shadow(0 4px 7px rgba(60,78,112,0.12));
}

.pf.failed img { display: none; }

.pf.failed::before {
  content: "";
  width: 46%;
  height: 46%;
  background: var(--color-faint);
  opacity: 0.5;
  -webkit-mask: var(--pal-glyph) center / contain no-repeat;
  mask: var(--pal-glyph) center / contain no-repeat;
}

/* ── Suggest dropdown ─────────────────────────────── */
.suggest {
  position: fixed;
  z-index: 9990;
  min-width: 240px;
  max-height: min(360px, 52vh);
  overflow: auto;
  display: none;
  padding: 6px;
  border: 1px solid var(--color-border-strong);
  border-radius: 16px;
  background: #fbf5ea;
  box-shadow: var(--shadow-pop);
}

.suggest.open { display: block; animation: pop 0.16s var(--ease); }

.suggest button {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 130ms;
}

.suggest button:hover,
.suggest button.active { background: rgba(108,191,60,0.1); }

.suggest .pf { width: 42px; height: 42px; }

.suggest .meta { min-width: 0; display: grid; gap: 4px; }

.suggest .name {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Type icons (official Palworld element badges) ──── */
.type-row { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.type-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(60,78,112,0.12));
}

/* ── Picked card ──────────────────────────────────── */
.picked {
  min-height: 70px;
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid var(--color-border);
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  background: rgba(255, 255, 255, 0.5);
}

.picked.empty {
  color: var(--color-muted);
  font-size: 0.85rem;
  justify-content: flex-start;
}

.picked.empty::before {
  content: "";
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px dashed var(--color-border-2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(108,191,60,0.12), transparent 60%);
  opacity: 0.9;
}

.picked .pf { width: 54px; height: 54px; }

.picked > div { min-width: 0; display: grid; gap: 6px; }
.picked .name { font-size: 0.96rem; font-weight: 750; }

.clear {
  min-height: 36px;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--color-border-2);
  border-radius: 10px;
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  transition: 140ms;
}

.clear:hover { color: var(--color-text); border-color: var(--color-border-strong); }

.plus-mark {
  width: 42px;
  height: 42px;
  margin-top: 6px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 154, 69, 0.4);
  border-radius: 50%;
  color: var(--color-orange);
  background: rgba(245, 154, 69, 0.09);
  box-shadow: 0 0 16px rgba(245, 154, 69, 0.14);
  font-size: 1.15rem;
  font-weight: 800;
}

/* ── Status ───────────────────────────────────────── */
.status { min-height: 1.3em; margin-top: 13px; color: var(--color-muted); font-size: 0.82rem; }
.status.err { color: var(--color-danger); }

/* ── Egg banner (the "reward") ────────────────────── */
.egg-banner {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  display: none;
  align-items: center;
  gap: 17px;
  background:
    radial-gradient(360px 150px at 10% 0%, rgba(108,191,60,0.16), transparent 70%),
    linear-gradient(120deg, rgba(43,160,224,0.1), rgba(255,254,250,0.95));
}

.egg-banner.show { display: flex; animation: rise 0.35s var(--ease); }

.egg-banner .pf {
  width: 84px;
  height: 84px;
  border-color: var(--color-border-strong);
  box-shadow: 0 0 28px rgba(108,191,60,0.18), inset 0 -6px 16px rgba(60,78,112,0.1);
}

.egg-banner > div { min-width: 0; display: grid; gap: 6px; }

.egg-banner .label {
  color: var(--color-cyan-bright);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.egg-banner .name {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.egg-banner .count {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

/* ── Combo grid ───────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.combo {
  min-height: 138px;
  padding: 15px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.035), transparent 60%),
    rgba(255,255,255,0.55);
  transition: transform 180ms var(--ease), border-color 180ms, background 180ms, box-shadow 180ms;
  animation: rise 0.35s var(--ease) both;
}

.combo:hover {
  border-color: var(--color-border-strong);
  background:
    linear-gradient(180deg, rgba(108,191,60,0.06), transparent 60%),
    rgba(255,255,255,0.8);
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(60,78,112,0.11);
}

.combo .side {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.combo .side > span {
  max-width: 112px;
  overflow: hidden;
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
}

/* plus sits centered on the portrait's vertical midpoint (= combo .pf height) */
.combo .mid {
  height: 74px;
  display: grid;
  place-items: center;
  color: var(--color-orange);
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 14px rgba(245, 154, 69, 0.35);
}

/* ── Predict trio ─────────────────────────────────── */
.predict-stage { display: none; padding: 26px 8px 6px; place-items: center; text-align: center; }
.predict-stage.show { display: grid; animation: rise 0.35s var(--ease); }

.trio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 28px);
  flex-wrap: wrap;
}

.pal-node { width: 136px; display: grid; justify-items: center; gap: 10px; }

.pal-node.egg .pf {
  border-color: var(--color-border-strong);
  box-shadow: 0 0 34px rgba(108,191,60,0.16), inset 0 -6px 16px rgba(60,78,112,0.1);
}

.pal-node .nm { font-size: 0.88rem; font-weight: 750; }

.arrow { color: var(--color-cyan); font-size: 1.3rem; font-weight: 800; }

:root {
  --pal-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3c-4.4 0-8 3.2-8 7.2 0 2.5 1.4 4.7 3.5 6 .5.3.8.9.7 1.5l-.2 1c-.2.9.5 1.7 1.4 1.6 1-.1 1.7-.9 1.7-1.9v-.6c0-.3.2-.5.5-.5h.6c.3 0 .5.2.5.5v.6c0 1 .7 1.8 1.7 1.9.9.1 1.6-.7 1.4-1.6l-.2-1c-.1-.6.2-1.2.7-1.5 2.1-1.3 3.5-3.5 3.5-6C20 6.2 16.4 3 12 3Zm-3.4 6.4a1.3 1.3 0 1 1 0 2.6 1.3 1.3 0 0 1 0-2.6Zm6.8 0a1.3 1.3 0 1 1 0 2.6 1.3 1.3 0 0 1 0-2.6Z'/%3E%3C/svg%3E");
}

/* ── Loading / footer ─────────────────────────────── */
.loading { display: inline-flex; align-items: center; gap: 8px; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(108,191,60,0.16);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.foot {
  margin: 28px 0 0;
  color: rgba(134, 164, 180, 0.46);
  font-size: 0.72rem;
  text-align: center;
}

/* ── SEO / FAQ / footer content ───────────────────── */
.seo-block, .faq {
  margin-top: 40px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, rgba(255, 254, 249, 0.9), rgba(247, 240, 225, 0.85));
  box-shadow: var(--shadow-card);
}
.seo-block h2, .faq h2 {
  margin: 0 0 14px;
  font-family: "Baloo 2", "Manrope", system-ui, sans-serif;
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.seo-block h3, .faq-item h3 {
  margin: 22px 0 6px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--color-text);
}
.seo-block p, .faq-item p {
  margin: 0 0 10px;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.seo-block a, .faq-item a { color: var(--color-cyan); font-weight: 700; text-decoration: none; }
.seo-block a:hover, .faq-item a:hover { text-decoration: underline; }
.seo-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.seo-list li { color: var(--color-muted); font-size: 0.95rem; line-height: 1.55; }
.seo-list li strong, .seo-block p strong, .faq-item p strong { color: var(--color-text); }

.faq-item { padding: 14px 0; border-top: 1px solid var(--color-border); }
.faq-item:first-of-type { border-top: 0; padding-top: 4px; }

.site-foot {
  margin: 40px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.site-foot .foot-brand {
  margin: 0 0 8px;
  font-family: "Baloo 2", "Manrope", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}
.site-foot .foot-org {
  margin: 0 auto;
  max-width: 640px;
  color: var(--color-faint);
  font-size: 0.78rem;
  line-height: 1.5;
}
.site-foot .foot-org strong { color: var(--color-muted); }

:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 3px; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 760px) {
  .wrap { width: min(100% - 20px, 1180px); padding: 30px 0 52px; }
  .modes button { min-height: 54px; padding: 8px 10px; }
  .mode-icon { display: none; }
  .modes small { display: none; }
  .search-row.dual { grid-template-columns: 1fr; }
  .plus-mark { margin: 0 auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 480px) {
  .hero h1 .grad { display: block; margin-top: 4px; }
  .panel { padding: 16px; border-radius: 20px; }
  .section-heading { gap: 11px; }
  .combo { min-height: 126px; padding-inline: 9px; }
  .combo .pf { width: 64px; height: 64px; }
  .combo .mid { height: 64px; }
  .pal-node { width: 110px; }
  .pal-node .pf { width: 92px; height: 92px; }
  .pal-node.egg .pf { width: 106px; height: 106px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
