/* Snow Game site – shared styles */
:root {
  --sky-top: #0f2a4a;
  --sky-mid: #2f6497;
  --sky-low: #a9d2f0;
  --snow: #f6f9fc;
  --ink: #12243a;
  --ink-soft: #4a6079;
  --accent: #ff7a3d;
  --accent-dark: #e05f22;
  --ice: #d9ecf9;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 42, 74, 0.15);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--snow);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 42, 74, 0.92);
  backdrop-filter: blur(6px);
  color: #fff;
}
.topbar .brand { font-weight: 800; letter-spacing: 0.02em; color: #fff; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a {
  color: #e7f2fb; text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 0.95rem;
}
.topbar nav a:hover, .topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 88vh;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 80px 16px 160px;
  color: #fff;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%);
}
.hero h1 {
  font-size: clamp(2.6rem, 9vw, 5.5rem); line-height: 1.02; margin: 0 0 16px;
  font-weight: 900; letter-spacing: -0.02em;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.hero p { font-size: clamp(1.05rem, 2.6vw, 1.3rem); max-width: 620px; margin: 0 auto 32px; color: #e9f4fd; }
.hero .content { position: relative; z-index: 3; }
.mountains { position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: auto; z-index: 2; display: block; }

.btn {
  display: inline-block; text-decoration: none; cursor: pointer; border: 0;
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: 1.2rem;
  padding: 18px 34px; border-radius: 999px;
  box-shadow: 0 10px 24px rgba(224, 95, 34, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { background: var(--accent-dark); transform: translateY(-2px); }
.btn.secondary { background: rgba(255, 255, 255, 0.18); box-shadow: none; font-size: 1rem; padding: 12px 22px; }

/* falling snow */
.snowfall { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

/* ---------- sections ---------- */
.section { max-width: 1100px; margin: 0 auto; padding: 56px 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.feature { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feature h3 { margin: 0 0 6px; }
.feature p { margin: 0; color: var(--ink-soft); }

footer { text-align: center; color: var(--ink-soft); padding: 32px 16px 48px; font-size: 0.9rem; }

/* ---------- gallery ---------- */
.page-head {
  background: linear-gradient(180deg, var(--sky-top), var(--sky-mid));
  color: #fff; padding: 40px 16px 34px; text-align: center;
}
.page-head h1 { margin: 0 0 6px; font-size: clamp(2rem, 6vw, 3rem); }
.page-head p { margin: 0 auto; max-width: 640px; color: #e2effa; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 22px 16px 4px; }
.filters button {
  border: 2px solid var(--ice); background: #fff; color: var(--ink);
  padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters .count { opacity: 0.6; font-weight: 600; margin-left: 4px; }

.grid {
  max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
}
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 0; padding: 0; text-align: left; font: inherit; color: inherit;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15, 42, 74, 0.2); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card .stage {
  height: 260px; background: radial-gradient(circle at 50% 35%, #ffffff 0%, var(--ice) 100%);
  position: relative;
}
.card model-viewer { width: 100%; height: 100%; --poster-color: transparent; background: transparent; }
.card .meta { padding: 14px 16px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card .name { font-weight: 800; font-size: 1.05rem; }
.card .info { color: var(--ink-soft); font-size: 0.88rem; white-space: nowrap; }
.tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(15, 42, 74, 0.85); color: #fff; font-size: 0.75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em;
}
.no-preview {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center; color: var(--ink-soft);
}
.no-preview .big { font-size: 2.6rem; }
.no-preview a { font-weight: 700; }

.empty {
  grid-column: 1 / -1; text-align: center; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 50px 20px; color: var(--ink-soft);
}
.empty .big { font-size: 3rem; }

/* full-screen viewer */
.viewer {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #cfe6f7 70%, #a9d2f0 100%);
}
.viewer.open { display: block; }
.viewer model-viewer { width: 100%; height: 100%; background: transparent; }
.viewer .bar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px;
  background: linear-gradient(180deg, rgba(15, 42, 74, 0.85), rgba(15, 42, 74, 0));
  color: #fff;
}
.viewer .bar h2 { margin: 0; font-size: clamp(1.1rem, 4vw, 1.6rem); }
.viewer .bar .actions { display: flex; gap: 8px; }
.viewer .bar a, .viewer .bar button {
  background: rgba(255, 255, 255, 0.2); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 16px; font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none;
}
.viewer .bar button.close { background: var(--accent); }
.viewer .hint {
  position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; z-index: 2;
  color: var(--ink-soft); font-size: 0.9rem;
}

/* help page */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li {
  counter-increment: step; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 18px 70px; position: relative;
}
.steps li::before {
  content: counter(step); position: absolute; left: 18px; top: 16px;
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 900; display: flex; align-items: center; justify-content: center;
}
.note { background: var(--ice); border-radius: var(--radius); padding: 16px 18px; }
code { background: #e9f1f8; padding: 2px 6px; border-radius: 6px; font-size: 0.92em; }
h2 { margin-top: 40px; }

@media (max-width: 560px) {
  .topbar { padding: 10px 10px; gap: 6px; }
  .topbar .brand { font-size: 0.95rem; white-space: nowrap; }
  .topbar nav { flex-wrap: nowrap; gap: 2px; }
  .topbar nav a { padding: 6px 8px; font-size: 0.85rem; white-space: nowrap; }
  .topbar nav a[href="index.html"] { display: none; }
  .card .stage { height: 230px; }
  .hero { min-height: 80vh; padding-bottom: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .snowfall { display: none; }
}

/* ---------- character customizer ---------- */
.customizer-page { background: #eef5fb; }
.customizer {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  height: calc(100vh - 52px); height: calc(100dvh - 52px);
}
.stage-wrap { position: relative; min-height: 0; overflow: hidden; }
#stage { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#stage:active { cursor: grabbing; }
.stage-hint {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; pointer-events: none;
  color: var(--ink-soft); font-size: 0.85rem; text-shadow: 0 1px 0 #fff;
}
.loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  background: rgba(238, 245, 251, 0.85); color: var(--ink); font-weight: 700; z-index: 3;
}
.loading[hidden] { display: none; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 5px solid var(--ice); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.loading.error .spinner { display: none; }
.loading.error { color: #8e2f2a; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel {
  background: #fff; border-left: 1px solid #dce8f3; overflow-y: auto;
  padding: 18px 18px 28px; -webkit-overflow-scrolling: touch;
}
.panel-head h1 { margin: 0; font-size: 1.6rem; line-height: 1.1; }
.panel-head p { margin: 4px 0 12px; color: var(--ink-soft); }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.panel-actions .primary, .panel-actions .face { grid-column: 1 / -1; }
.act.face { background: #1d2b4a; color: #fff; }
.act.face:hover { background: #12203a; }
.act {
  border: 0; border-radius: 12px; padding: 11px 12px; font: inherit; font-weight: 800; cursor: pointer;
  background: var(--ice); color: var(--ink);
}
.act:hover { filter: brightness(0.96); }
.act.primary { background: var(--accent); color: #fff; }
.act.primary:hover { background: var(--accent-dark); }

.ctl { padding: 12px 0 4px; border-top: 1px solid #eef3f8; margin-top: 10px; }
.ctl h2 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices button {
  flex: 1 1 auto; min-width: 72px; border: 2px solid #dce8f3; background: #fff; color: var(--ink);
  border-radius: 12px; padding: 9px 10px; font: inherit; font-weight: 700; font-size: 0.92rem; cursor: pointer;
}
.choices button:hover { border-color: #b9d3ea; }
.choices button[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 122, 61, 0.45);
}
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 3px solid #fff; box-shadow: 0 0 0 1px #c9d9e8; font: inherit; font-weight: 800; color: var(--ink);
}
.swatch.original { background: #fff; font-size: 1rem; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); transform: scale(1.08); }
.choices button:focus-visible, .swatch:focus-visible, .act:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (max-width: 860px) {
  .customizer { display: block; height: auto; }
  .stage-wrap { height: 58vh; height: 58svh; min-height: 320px; }
  .panel { border-left: 0; border-top: 1px solid #dce8f3; overflow: visible; padding-bottom: 40px; }
  .panel-head h1 { font-size: 1.35rem; }
}
