* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #faf9f5;
  color: #1f1e1b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.date {
  margin: 0 0 2px;
  font-size: 12px;
  color: #8a887f;
}

.hud { display: flex; gap: 6px; }

.pill {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: #f0eee6;
  color: #55534c;
  border-radius: 999px;
  padding: 5px 11px;
}

.pill.streak { background: #faeeda; color: #854f0b; }

.pill.collection { background: #eeedfe; color: #3c3489; }

.tagline {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #8a887f;
}

.motivation-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #55534c;
  background: #f5f3ec;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 16px;
}

#next-line { color: #8a887f; font-variant-numeric: tabular-nums; }

#exclusive-line { color: #3b6d11; font-weight: 600; }

.tagline strong { color: #55534c; font-weight: 600; }

.progress-wrap { margin: 12px 0 10px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #8a887f;
  margin-bottom: 5px;
}

.progress-track {
  height: 5px;
  background: #ecebe3;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: #d97757;
  border-radius: 999px;
  transition: width 0.3s ease;
}

#stage {
  position: relative;
  flex: 1;
  touch-action: none;
}

#board {
  position: absolute;
  border-radius: 12px;
  background: #f0eee6;
  transition: box-shadow 0.6s ease;
}

#board .cell {
  position: absolute;
  border: 1px dashed #d6d3c6;
  border-radius: 3px;
  transition: opacity 0.6s ease;
}

#board.done .cell { opacity: 0; }

#board.done {
  box-shadow: 0 12px 40px rgba(60, 45, 20, 0.25);
  animation: settle-board 0.7s ease;
}

@keyframes settle-board {
  0% { transform: scale(1); }
  35% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

.piece {
  position: absolute;
  background-repeat: no-repeat;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(40, 35, 20, 0.28);
  touch-action: none;
  cursor: grab;
  transform-origin: top left;
  will-change: transform, left, top;
  -webkit-user-select: none;
  user-select: none;
}

.piece.animated { transition: left 0.28s ease, top 0.28s ease, transform 0.28s ease; }

.piece.dragging {
  cursor: grabbing;
  z-index: 50;
  box-shadow: 0 10px 24px rgba(40, 35, 20, 0.35);
}

.piece.placed {
  box-shadow: none;
  border-radius: 0;
  cursor: default;
  z-index: 1;
}

.piece.placed.pop { animation: settle-piece 0.25s ease; }

@keyframes settle-piece {
  0% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

#reveal {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  transform: translate(-50%, 110%);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(40, 35, 20, 0.18);
  padding: 20px 22px calc(22px + env(safe-area-inset-bottom));
  z-index: 100;
}

#reveal.show { transform: translate(-50%, 0); }

.solved-line {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #3b6d11;
}

#reveal h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.art-meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: #8a887f;
}

.art-story {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: #55534c;
}

.reveal-actions { display: flex; gap: 10px; }

.reveal-actions button {
  flex: 1;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 0;
  border-radius: 10px;
  border: 1px solid #dcd9cd;
  background: #ffffff;
  color: #1f1e1b;
  cursor: pointer;
}

.reveal-actions button:active { transform: scale(0.97); }

#share-btn {
  background: #d97757;
  border-color: #d97757;
  color: #ffffff;
}
