/* STRATA — shared styles. Palette: parchment, ink, terracotta, sage, slate, amber. */
:root {
  --paper: #f4efe6;
  --paper-2: #eae2d4;
  --ink: #241f1a;
  --ink-soft: #5c5348;
  --terra: #c56a4a;
  --terra-deep: #a34f33;
  --sage: #7fbf6a;
  --sage-deep: #46803a;
  --slate: #7c8494;
  --amber: #f2b64b;
  --night: #1b2436;
  --display: "Avenir Next", "Futura", "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 15% -5%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------- landing */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #d9cfbf;
}
.brand {
  font-family: var(--display); font-weight: 800; letter-spacing: 0.32em;
  font-size: 15px;
}
.topbar nav { display: flex; gap: clamp(10px, 2vw, 26px); }
.topbar nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar nav a:hover { color: var(--terra-deep); }

.hero {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(20px, 4vw, 54px); align-items: center;
  padding: clamp(28px, 5vw, 80px) clamp(16px, 5vw, 64px) clamp(24px, 4vw, 56px);
  max-width: 1240px; margin: 0 auto;
}
.kicker {
  margin: 0 0 10px; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--terra-deep); font-weight: 700;
}
.hero h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, 11vw, 132px); line-height: 0.92; letter-spacing: 0.02em;
  margin: 0 0 14px;
  background: linear-gradient(120deg, var(--ink) 55%, var(--terra-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: clamp(15px, 1.6vw, 19px); line-height: 1.55; color: var(--ink-soft); margin: 0 0 26px; max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

#play-now, .big, #play-now-2 {
  display: inline-block; text-decoration: none; font-weight: 700; letter-spacing: 0.04em;
  color: #fff8ef; background: linear-gradient(160deg, var(--terra) 0%, var(--terra-deep) 100%);
  padding: 14px 30px; border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(163, 79, 51, 0.75), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#play-now:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(163,79,51,0.8); }
a.ghost {
  text-decoration: none; color: var(--ink); border: 1.5px solid #cfc4b2;
  padding: 13px 24px; border-radius: 999px; font-weight: 600; font-size: 15px;
}
a.ghost:hover { border-color: var(--terra); color: var(--terra-deep); }
.big { font-size: 19px; padding: 18px 42px; }

.hero-preview-wrap { position: relative; }
#hero-preview {
  display: block; width: 100%; aspect-ratio: 16 / 10; min-height: 220px;
  border-radius: 18px; background: #10161f;
  border: 1px solid #cbc0ae;
  box-shadow: 0 30px 60px -34px rgba(36, 31, 26, 0.55);
}
.preview-label {
  display: block; margin-top: 8px; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-soft); text-align: right;
}

.panel {
  max-width: 1240px; margin: 0 auto; padding: clamp(26px, 4vw, 56px) clamp(16px, 5vw, 64px);
}
.panel h2 {
  font-family: var(--display); font-weight: 800; letter-spacing: 0.01em;
  font-size: clamp(24px, 3.4vw, 40px); margin: 0 0 8px;
}
.panel .sub { color: var(--ink-soft); margin: 0 0 22px; max-width: 60ch; }

#gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
#gallery figure { margin: 0; }
#gallery img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 14px; border: 1px solid #d2c8b6;
  background: #10161f;
  box-shadow: 0 18px 34px -22px rgba(36,31,26,0.5);
}
#gallery figcaption { font-size: 12px; color: var(--ink-soft); margin-top: 7px; letter-spacing: 0.04em; }

.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr); gap: clamp(20px, 4vw, 48px); }
#features { list-style: none; margin: 12px 0 0; padding: 0; }
#features li {
  position: relative; padding: 12px 0 12px 34px; border-bottom: 1px dashed #d3c9b7;
  line-height: 1.55; color: var(--ink-soft);
}
#features li::before {
  content: ""; position: absolute; left: 6px; top: 18px; width: 12px; height: 12px;
  background: linear-gradient(160deg, var(--sage), var(--sage-deep));
  border-radius: 3px; transform: rotate(8deg);
  box-shadow: 2px 2px 0 rgba(36,31,26,0.14);
}
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.swatches span {
  font-size: 11px; letter-spacing: 0.06em; padding: 7px 11px 7px 26px; border-radius: 999px;
  background: #fffdf8; border: 1px solid #d8cebb; color: var(--ink-soft); position: relative;
}
.swatches span::before {
  content: ""; position: absolute; left: 8px; top: 8px; width: 12px; height: 12px;
  border-radius: 3px; background: var(--sw);
}

#controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 18px; }
.control-col {
  background: #fffdf8; border: 1px solid #ddd3c1; border-radius: 16px; padding: 18px 20px;
}
.control-col h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--terra-deep); }
.control-col ul { list-style: none; margin: 0; padding: 0; }
.control-col li { padding: 7px 0; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 3px 7px; border-radius: 6px;
  background: var(--paper-2); border: 1px solid #cfc4b2; box-shadow: 0 1px 0 #c2b7a4;
  color: var(--ink);
}

.cta {
  text-align: center; padding: clamp(40px, 6vw, 92px) 20px;
  background: linear-gradient(180deg, transparent, rgba(197, 106, 74, 0.08));
}
.cta h2 { font-family: var(--display); font-weight: 800; font-size: clamp(24px, 4vw, 44px); margin: 0 0 24px; }

footer {
  padding: 26px clamp(16px, 5vw, 64px) 40px; font-size: 12px; color: var(--ink-soft);
  border-top: 1px solid #d9cfbf; max-width: 1240px; margin: 0 auto;
}
footer span { font-family: var(--display); font-weight: 800; letter-spacing: 0.2em; }

/* ------------------------------------------------------------- game */
body.game { overflow: hidden; background: #10161f; touch-action: none; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: var(--body); }
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  transform: translate(-50%, -50%);
}
#crosshair span {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, transparent 46%, rgba(247,243,232,0.95) 46% 54%, transparent 54%),
    linear-gradient(to bottom, transparent 46%, rgba(247,243,232,0.95) 46% 54%, transparent 54%);
  mix-blend-mode: difference;
}
#hud-top { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; display: flex; gap: 8px; align-items: center; }
.chip {
  font-family: var(--mono); font-size: 11px; padding: 5px 10px; border-radius: 999px;
  background: rgba(16, 22, 31, 0.55); color: #e9e2d3; border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(6px);
}
#new-world {
  pointer-events: auto; cursor: pointer; font-size: 11px; letter-spacing: 0.08em;
  padding: 5px 12px; border-radius: 999px; color: #ffe9d8;
  background: rgba(163, 79, 51, 0.85); border: 1px solid rgba(255,255,255,0.2);
}
#item-name {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #f2ead9;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
#hotbar {
  position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 6px; padding: 5px; border-radius: 14px;
  background: rgba(16, 22, 31, 0.5); border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(6px);
}
.slot {
  width: 46px; height: 46px; border-radius: 9px;
  background-color: rgba(244, 239, 230, 0.14);
  background-size: cover; border: 2px solid rgba(255,255,255,0.18);
  position: relative;
}
.slot[aria-selected="true"] {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(242, 182, 75, 0.35), 0 4px 12px -4px rgba(0,0,0,0.7);
  transform: translateY(-3px);
}
.slot::after {
  content: attr(data-slot); position: absolute; left: 4px; top: 2px;
  font-family: var(--mono); font-size: 9px; color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

.hint {
  position: fixed; left: 50%; bottom: 82px; transform: translateX(-50%);
  margin: 0; font-size: 12px; color: #e8e0d0; opacity: 1; transition: opacity 0.6s;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9); pointer-events: none; text-align: center;
  max-width: 92vw;
}

#overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 40%, rgba(16,22,31,0.55), rgba(16,22,31,0.88));
  transition: opacity 0.4s;
}
#overlay.gone { opacity: 0; pointer-events: none; }
.card {
  background: rgba(244, 239, 230, 0.96); color: var(--ink);
  border-radius: 20px; padding: clamp(22px, 4vw, 40px); max-width: min(480px, 92vw);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,0.7); text-align: center;
}
.card h1 { font-family: var(--display); font-weight: 800; font-size: clamp(38px, 8vw, 64px); margin: 0 0 6px; letter-spacing: 0.03em; }
.card .tag { color: var(--ink-soft); margin: 0 0 18px; }
.mini { list-style: none; margin: 0 0 22px; padding: 0; text-align: left; }
.mini li { font-size: 13px; color: var(--ink-soft); padding: 5px 0; line-height: 1.4; }
#play-btn {
  font: inherit; font-weight: 700; cursor: pointer; color: #fff8ef;
  background: linear-gradient(160deg, var(--terra), var(--terra-deep));
  border: 0; padding: 13px 30px; border-radius: 999px;
}

/* touch controls */
#touch-ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#touch-ui[hidden] { display: none; }
#joy-move {
  pointer-events: auto; position: absolute; touch-action: none;
  left: calc(18px + env(safe-area-inset-left)); bottom: calc(22px + env(safe-area-inset-bottom));
  width: 128px; height: 128px; border-radius: 50%;
  background: rgba(16, 22, 31, 0.42); border: 1px solid rgba(255,255,255,0.22);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
}
#joy-knob {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(242, 182, 75, 0.85); box-shadow: 0 4px 14px -4px rgba(0,0,0,0.8);
  pointer-events: none;
}
.tbtn {
  pointer-events: auto; touch-action: none;
  position: absolute; width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: 0.06em; color: #f6efdf;
  background: rgba(16, 22, 31, 0.42); border: 1px solid rgba(255,255,255,0.22);
  backdrop-filter: blur(4px); user-select: none;
}
.tbtn:active { background: rgba(197, 106, 74, 0.6); }
#btn-jump  { right: calc(18px + env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); }
#btn-break { right: calc(106px + env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom)); }
#btn-place { right: calc(18px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .tagline { max-width: none; }
  .slot { width: 40px; height: 40px; }
  #joy-move { width: 112px; height: 112px; }
  .tbtn { width: 66px; height: 66px; font-size: 11px; }
  #btn-break { right: calc(92px + env(safe-area-inset-right)); }
}
@media (max-width: 390px) {
  .topbar nav a { font-size: 12px; }
  #hero-preview { aspect-ratio: 4 / 3; }
  .hero-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .slot { width: 34px; height: 34px; }
  #hotbar { gap: 4px; bottom: calc(158px + env(safe-area-inset-bottom)); }
  #item-name { bottom: calc(206px + env(safe-area-inset-bottom)); }
}
