/* Weftbound — warm loom theme, portrait phone-first. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #1d1712; color: #f0e6d8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
#app {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column; padding: 10px 12px 14px;
}
header { padding: 2px 2px 8px; }
#brand { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.35em; color: #e8b04b; }
#hud {
  display: flex; gap: 14px; align-items: baseline; margin-top: 4px;
  font-size: 0.95rem; color: #d8c9ae;
}
#hud-level { font-weight: 700; color: #fff; }
#hud-stars { color: #e8b04b; letter-spacing: 0.15em; }
#homebar {
  height: 5px; background: #3a2d20; border-radius: 3px; margin-top: 8px; overflow: hidden;
}
#homebar-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, #de6b48, #e8b04b, #2a9d8f);
  border-radius: 3px; transition: width 200ms ease-out;
}
#board-wrap { display: flex; justify-content: center; padding: 6px 0 2px; }
#board { touch-action: none; border-radius: 14px; }
#tapestry { padding: 10px 2px 0; }
.tapestry-group { margin-bottom: 8px; }
.tapestry-label {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: #a68d64; margin-bottom: 4px;
}
.strips { display: flex; gap: 3px; }
.strip {
  flex: 1; height: 20px; border-radius: 4px; overflow: hidden;
  background: #2b2119; border: 1px dashed #55432c; position: relative;
}
.strip .fill {
  position: absolute; inset: 0; width: 0%;
  transition: width 650ms ease-in-out;
}
.strip.done { border-style: solid; border-color: #6d5433; }
.strip.done .fill { width: 100%; }
#controls {
  margin-top: auto; padding-top: 12px;
  display: flex; justify-content: space-between; gap: 6px;
}
.ctl {
  flex: 1; min-height: 54px; border: 1px solid #4a3421; border-radius: 12px;
  background: #2b2119; color: #f0e6d8; font-size: 1.15rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer;
}
.ctl span { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: #c9b48c; }
.ctl:active { background: #3a2b1c; }
.ctl.off { opacity: 0.45; }
.overlay {
  position: fixed; inset: 0; background: rgba(12, 8, 5, 0.72);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px;
}
.overlay[hidden] { display: none; }
.card {
  background: #2b2119; border: 1px solid #6d5433; border-radius: 18px;
  padding: 26px 22px 20px; text-align: center; max-width: 360px; width: 100%;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
#complete-stars { font-size: 2.4rem; letter-spacing: 0.2em; color: #55432c; height: 3rem; }
#complete-stars .star { display: inline-block; }
#complete-stars .star.lit { color: #ffc93c; text-shadow: 0 0 14px rgba(255, 201, 60, 0.65); animation: starpop 420ms ease-out backwards; }
#complete-stars .star.lit:nth-child(2) { animation-delay: 140ms; }
#complete-stars .star.lit:nth-child(3) { animation-delay: 280ms; }
@keyframes starpop { 0% { transform: scale(0.2); } 60% { transform: scale(1.45); } 100% { transform: scale(1); } }
#complete-title { font-size: 1.3rem; font-weight: 800; margin-top: 6px; }
#complete-detail { color: #d8c9ae; margin-top: 6px; }
#complete-strip { color: #a8d8b9; margin-top: 8px; font-size: 0.92rem; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.card-buttons { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  flex: 1; min-height: 50px; border-radius: 12px; border: 1px solid #6d5433;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn.primary { background: #e8b04b; color: #241a0d; border-color: #e8b04b; }
.btn.secondary { background: transparent; color: #f0e6d8; }
#level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lvl-btn {
  min-height: 52px; border-radius: 10px; border: 1px solid #4a3421; background: #241a12;
  color: #f0e6d8; font-size: 1rem; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lvl-btn .lstars { font-size: 0.6rem; color: #e8b04b; letter-spacing: 0.1em; min-height: 0.75rem; }
.lvl-btn.current { border-color: #e8b04b; }
