/* Crease: a daily origami puzzle. Built on the site's base styles, with its
   own colour: a sky-blue cutting mat and coral origami paper. */

:root {
  --mat: #e3eef9;
  --mat-dot: rgba(46, 36, 64, 0.16);
  --paper-front: #f4a492;
  --paper-back: #fff8f1;
  --target: #ddd6f7;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}
.home-link { font-weight: 800; text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.topbar-actions { display: flex; gap: 8px; }
#sound-btn .mute { display: none; }
#sound-btn[aria-pressed="false"] .wave { display: none; }
#sound-btn[aria-pressed="false"] .mute { display: inline; }

.stage {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 0;
  font: 600 40px/1.1 var(--serif);
}
.crane { width: 34px; height: 34px; transform: rotate(-6deg); }
.date { margin: 2px 0 16px; text-align: center; color: var(--plum-soft); font-weight: 700; }
.previewing .date { display: table; margin: 4px auto 16px; padding: 3px 12px; border: 2px dashed var(--plum); border-radius: 999px; background: var(--butter); color: var(--plum); }

/* Difficulty tabs */
.levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: #fff;
}
.level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--plum);
  font: 800 15px/1 var(--sans);
  cursor: pointer;
}
.level[aria-current="true"] { background: var(--sky); box-shadow: inset 0 0 0 2px var(--plum); }
.level .done { color: #557344; font-size: 13px; }
.level.practice { padding: 0 14px; color: var(--plum-soft); border-left: 2px dashed var(--line); border-radius: 0 999px 999px 0; }
.level.practice[aria-current="true"] { color: var(--plum); background: var(--butter); border-left-color: transparent; border-radius: 999px; }

/* Practice mode: pick a difficulty, get endless puzzles */
.practice-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: -6px 0 14px;
  padding: 8px 12px;
  border: 2px dashed var(--plum);
  border-radius: 18px;
  background: #fffbea;
  font-weight: 800;
  font-size: 14px;
}
.practice-bar[hidden] { display: none; }
.practice-levels { display: inline-flex; gap: 4px; }
.practice-levels button {
  padding: 5px 12px;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: #fff;
  color: var(--plum);
  font: 800 13px/1 var(--sans);
  cursor: pointer;
}
.practice-levels button[aria-pressed="true"] { background: var(--butter); }
.practice-bar .btn { background: #fff; min-height: 34px; }
.level:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }

/* The board: a cutting mat with the paper on it */
.board-card {
  position: relative;
  padding: 10px;
  border: 2px solid var(--plum);
  border-radius: 26px;
  background: var(--sky);
  box-shadow: 0 6px 0 var(--plum);
}
.board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 18px;
  background: var(--mat);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.board.dragging { cursor: grabbing; }
.board .dot { fill: var(--mat-dot); }
.board .guide { stroke: rgba(46, 36, 64, 0.07); stroke-width: 0.004; }
.board .hint-crease { stroke: #9e3b2f; stroke-width: 0.009; stroke-dasharray: 0.03 0.02; animation: march 0.8s linear infinite; }
.board .target-edge polygon { fill: none; stroke: var(--plum); stroke-width: 0.014; stroke-dasharray: 0.03 0.022; stroke-linejoin: round; }
.board .target-fill polygon { fill: var(--target); }
/* The target outline, drawn over the paper: a pale halo under a dashed line */
.board .target-halo { stroke: #fff; stroke-width: 0.02; stroke-linecap: round; opacity: 0.85; }
.board .target-line { stroke: var(--plum); stroke-width: 0.011; stroke-linecap: round; stroke-dasharray: 0.028 0.02; }
#target-top { pointer-events: none; }
.board .layer { stroke: rgba(46, 36, 64, 0.55); stroke-width: 0.004; stroke-linejoin: round; }
.board .layer.back { fill: var(--paper-back); }
.board .layer.front { fill: url(#paper-front) var(--paper-front); } /* plain coral if the stripes fail */
.board .layer-shadow { fill: rgba(46, 36, 64, 0.16); }
.board .handle { fill: #fff; stroke: var(--plum); stroke-width: 0.005; opacity: 0.9; }
.board .handle.pulse { animation: pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.board .crease-line { stroke: var(--plum); stroke-width: 0.006; stroke-dasharray: 0.02 0.014; }
.board .crease-line.bad { stroke: #9e3b2f; opacity: 0.5; }
.board .snap { fill: none; stroke: var(--plum); stroke-width: 0.007; }
.board .grab { fill: var(--plum); }
.board .hint-arrow { fill: none; stroke: #9e3b2f; stroke-width: 0.012; stroke-linecap: round; stroke-dasharray: 0.035 0.025; animation: march 0.8s linear infinite; }
.board .hint-dot { fill: #9e3b2f; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: 0.5; } }
@keyframes march { to { stroke-dashoffset: -0.06; } }

.nudge {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border: 2px solid var(--plum);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.nudge.show { opacity: 1; }

/* Match meter */
.meter { margin-top: 20px; }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; }
.meter-row strong { font: 800 24px/1 var(--sans); font-variant-numeric: tabular-nums; }
.meter-row.small { margin-top: 6px; font-size: 14px; color: var(--plum-soft); }
.meter-track { height: 14px; margin-top: 6px; border: 2px solid var(--plum); border-radius: 999px; background: #fff; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--sky); border-right: 2px solid var(--plum); transition: width 0.35s ease, background 0.35s; }
.meter-fill.close { background: var(--butter); }
.meter-fill.full { background: var(--mint); }

.controls { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.controls .btn { background: #fff; }

/* Win */
.win { margin-top: 20px; }
.win-card {
  padding: 24px 20px;
  border: 2px solid var(--plum);
  border-radius: 24px;
  background: var(--mint);
  text-align: center;
  box-shadow: 0 6px 0 var(--plum);
  animation: rise 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.win-kicker { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--plum-soft); }
.win-title { margin: 4px 0 6px; font: 600 34px/1.1 var(--serif); }
.stars { margin: 0; font-size: 34px; letter-spacing: 6px; }
.stars .off { opacity: 0.25; filter: grayscale(1); }
.win-line { margin: 8px 0 16px; font-weight: 700; }
.win-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.win-buttons .btn:not(.primary) { background: #fff; }
.share-note { min-height: 1.4em; margin: 10px 0 0; font-weight: 800; }
@keyframes rise { from { transform: translateY(20px) scale(0.96); opacity: 0; } }

.day-done { margin-top: 14px; text-align: center; font-weight: 700; color: var(--plum-soft); }
.day-done strong { color: var(--plum); font-variant-numeric: tabular-nums; }

/* Dialogs (same as the rest of the site) */
.sheet {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 28px 24px 24px;
  border: 2px solid var(--plum);
  border-radius: 24px;
  background: var(--cream);
  color: var(--plum);
}
.sheet::backdrop { background: rgba(46, 36, 64, 0.35); }
.sheet h2 { margin: 0 0 14px; font: 600 26px/1.2 var(--serif); }
.sheet .close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; font-size: 14px; }
.rules { margin: 0 0 18px; padding-left: 22px; display: grid; gap: 8px; }
.wide { width: 100%; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-row > div { display: flex; flex-direction: column; padding: 14px 8px; border-radius: 18px; background: #fff; border: 2px solid var(--plum); text-align: center; font-size: 13px; font-weight: 700; color: var(--plum-soft); }
.big { font: 800 26px/1.2 var(--sans); color: var(--plum); }
.stats-note { margin: 14px 0 0; font-size: 13px; color: var(--plum-soft); text-align: center; }

/* Paper confetti on a win */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bit {
  position: absolute;
  top: 40%;
  left: 50%;
  width: var(--size);
  height: calc(var(--size) * 0.7);
  background: var(--color);
  border: 1.5px solid var(--plum);
  border-radius: 2px;
  animation: flutter 1.3s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}
@keyframes flutter {
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

@media (min-width: 900px) {
  .title { font-size: 46px; }
}

/* About the game: for new players, and so search engines have real text to read */
.about-game { margin: 32px 0 0; padding: 20px 22px; border: 2px solid var(--line); border-radius: 20px; background: #fff; }
.about-game h2 { margin: 0 0 8px; font: 600 22px/1.2 var(--serif); }
.about-game p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; color: var(--plum-soft); }
.about-game p:last-child { margin: 0; }
