:root {
  --cream: #f3ead8;
  --wall: #ebe2cf;
  --sky: #c5dce8;
  --wood: #8b5a3c;
  --wood-light: #b8845a;
  --brass: #c49a3a;
  --persimmon: #d86b3a;
  --grape: #6b4c8a;
  --moss: #5a7a5c;
  --yamabuki: #e8b84a;
  --ink: #2a3544;
  --mint: #7fd4b8;
  --safe-pad: max(12px, env(safe-area-inset-left));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  color: var(--ink);
  background: var(--wall);
  line-height: 1.45;
}

.workshop-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(197, 220, 232, 0.55) 0%, transparent 38%),
    linear-gradient(165deg, var(--cream) 0%, var(--wall) 45%, #ddd3c0 100%);
}

.window-glow {
  position: absolute;
  top: 0;
  right: 8%;
  width: min(52vw, 320px);
  height: 42vh;
  border-radius: 4px 4px 40% 40%;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.75), rgba(197, 220, 232, 0.35) 55%, transparent 72%);
  opacity: 0.9;
}

.paper-drift {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(232, 184, 74, 0.12) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(216, 107, 58, 0.1) 0 2px, transparent 3px);
  animation: drift 18s linear infinite;
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .paper-drift {
    animation: none;
  }
}

.masthead {
  padding: 10px var(--safe-pad) 0;
}

.back {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
}

.mobile-app {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 var(--safe-pad) 18px;
}

.play-panel {
  padding-bottom: 14px;
}

.hero {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--moss);
  font-weight: 800;
}

.hero h1 {
  margin: 4px 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  font-size: 1.65rem;
  line-height: 1.15;
}

.hero h1 span {
  color: var(--persimmon);
}

.catch {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.burapi-wrap {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
}

.burapi-char {
  display: block;
  width: 72px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(42, 53, 68, 0.25));
  transition: transform 0.35s ease;
}

.burapi-char.steady {
  transform: rotate(0deg);
}

.burapi-char.tilt-l {
  transform: rotate(-8deg);
}

.burapi-char.tilt-r {
  transform: rotate(8deg);
}

.craft-tag {
  position: absolute;
  bottom: -4px;
  right: -6px;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--brass);
  background: rgba(243, 234, 216, 0.85);
  padding: 2px 6px;
  border-radius: 999px;
}

.start-panel,
.play-panel,
.summary-panel {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(139, 90, 60, 0.18);
  border-radius: 16px;
  padding: 16px 14px 18px;
  box-shadow: 0 10px 28px rgba(42, 53, 68, 0.08);
}

.rule-lead,
.kb-hint {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.kb-hint {
  font-size: 0.78rem;
  color: #334155;
}

.btn-primary,
.btn-ghost,
.btn-text {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: none;
  font-weight: 800;
}

.btn-primary {
  background: linear-gradient(180deg, var(--mint) 0%, #5fbf9f 100%);
  color: var(--ink);
  padding: 12px 22px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 4px 0 #4a9a82;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(139, 90, 60, 0.25);
  padding: 8px 12px;
  font-size: 0.82rem;
}

.btn-text {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  padding: 6px;
  font-size: 0.82rem;
}

.records,
.disclaimer {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #334155;
}

.stage-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.stage-head p {
  margin: 4px 0 10px;
  font-size: 0.85rem;
  color: #334155;
}

.torque-hud {
  position: relative;
  z-index: 4;
  margin-bottom: 10px;
  padding: 8px 10px 10px;
  border-radius: 12px;
  background: rgba(243, 234, 216, 0.94);
  border: 1px solid rgba(139, 90, 60, 0.14);
  box-shadow: 0 4px 14px rgba(42, 53, 68, 0.06);
}

.torque-ribbon {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 6px;
  height: 42px;
  margin-bottom: 2px;
}

.ribbon {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--yamabuki), var(--persimmon));
  transform-origin: top center;
  transition: transform 0.12s linear;
}

.ribbon.left {
  justify-self: end;
  width: 72%;
}

.ribbon.right {
  justify-self: start;
  width: 72%;
}

.ribbon.center {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}

.bell-icon {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 40% 40%;
  border: 2px solid var(--brass);
  background: radial-gradient(circle at 40% 30%, #fff6d6, var(--brass));
  opacity: 0.45;
  transition: opacity 0.2s, box-shadow 0.2s;
}

.bell-icon.glow {
  opacity: 1;
  box-shadow: 0 0 16px rgba(232, 184, 74, 0.85);
}

.torque-text {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.torque-hud .torque-text {
  margin: 0 0 8px;
  padding-bottom: 0;
  border-top: none;
  border-bottom: 1px dashed rgba(139, 90, 60, 0.22);
  padding-bottom: 8px;
}

.torque-hud .torque-ribbon {
  height: 40px;
  margin-bottom: 0;
  overflow: hidden;
}

.mobile-wrap {
  position: relative;
  z-index: 1;
  min-height: 300px;
  padding: 20px 6px 28px;
  margin-bottom: 8px;
}

.pivot-mark {
  position: absolute;
  left: 50%;
  top: 62px;
  width: 2px;
  height: 132px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, var(--brass) 0 4px, transparent 4px 8px);
  opacity: 0.55;
}

.beam-assembly {
  position: absolute;
  left: 50%;
  top: 86px;
  width: min(94%, 340px);
  transform: translateX(-50%);
  transform-origin: 50% 8px;
  will-change: transform;
}

.beam-wood {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  box-shadow: 0 3px 0 rgba(42, 53, 68, 0.15);
  position: relative;
}

.beam-wood::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 2px solid var(--brass);
  background: var(--cream);
}

.strings-layer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 4px;
  padding: 0 2px;
}

.hook-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  position: relative;
}

.hook-brass {
  width: 18px;
  height: 22px;
  border: 2px solid var(--brass);
  border-radius: 0 0 9px 9px;
  background: linear-gradient(180deg, #f0d890, var(--brass));
  position: relative;
}

.hook-brass::after {
  content: attr(data-arm);
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  color: #6b5220;
}

.hook-string {
  width: 2px;
  height: 34px;
  background: rgba(42, 53, 68, 0.45);
  transform-origin: top center;
}

.ornament {
  position: relative;
  margin-top: 2px;
  padding: 8px 10px 10px;
  border: none;
  background: transparent;
  cursor: grab;
  touch-action: none;
  transform-origin: top center;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.ornament:active {
  cursor: grabbing;
}

.ornament.dragging {
  z-index: 20;
  filter: drop-shadow(0 8px 12px rgba(42, 53, 68, 0.25));
}

.ornament.kb-focus {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
}

.ornament.hint-ring {
  outline: 3px dashed var(--persimmon);
  outline-offset: 4px;
}

.paper-shape {
  display: block;
  width: 40px;
  height: 48px;
  border-radius: 40% 60% 50% 45%;
  background: linear-gradient(145deg, #fff9ef, #f0e0c8);
  box-shadow: inset 0 -4px 0 rgba(139, 90, 60, 0.12);
}

.paper-shape.kind-nut {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  background: radial-gradient(circle at 35% 30%, #c87840, #8b4518);
}

.paper-shape.kind-bird {
  clip-path: polygon(20% 70%, 50% 10%, 80% 70%, 50% 55%);
  background: linear-gradient(180deg, #f5efe5, #c9b89a);
}

.paper-shape.kind-moon {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  box-shadow: inset -7px 0 0 #e8b84a;
}

.paper-shape.kind-grape {
  width: 34px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, var(--grape), #3d2850);
}

.paper-shape.kind-fruit {
  border-radius: 45% 55% 50% 50%;
  background: radial-gradient(circle at 40% 35%, var(--persimmon), #a84320);
}

.paper-shape.kind-bell {
  width: 30px;
  height: 34px;
  border-radius: 45% 45% 10% 10%;
  background: linear-gradient(180deg, #fff6d6, var(--brass));
}

.weight-dots {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}

.weight-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9a7428;
  font-style: normal;
}

.orn-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  margin-top: 3px;
  color: var(--ink);
}

.hook-slot.drop-target {
  outline: 2px dashed var(--mint);
  outline-offset: 4px;
  border-radius: 8px;
}

.hook-slot.occupied-flash {
  animation: flash 0.35s ease;
}

@keyframes flash {
  50% {
    outline: 2px solid var(--persimmon);
  }
}

.stable-ring {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 52px;
  height: 52px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--mint);
  opacity: 0;
  transition: opacity 0.2s;
}

.stable-ring.active {
  opacity: 1;
  animation: spin 0.9s linear infinite;
}

.stable-ring.ready {
  border-color: var(--mint);
  animation: none;
  opacity: 1;
}

@keyframes spin {
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stable-ring.active {
    animation: none;
    border-color: var(--mint);
  }
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
}

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

.live-msg {
  margin: 10px 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.summary-panel h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: var(--persimmon);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.utility-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}

#btn-hint.hint-idle {
  box-shadow: 0 0 0 2px var(--yamabuki);
}

.mobile-wrap.wind-stage .workshop-bg .paper-drift {
  animation-duration: 8s;
}

.capture-only {
  display: none;
}

html[data-capture="1"] .capture-hide,
html[data-promo-shot="1"] .promo-hide {
  display: none !important;
}

html[data-capture="1"] .capture-only {
  display: block;
}

html[data-capture="1"] .mobile-app {
  max-width: 100%;
}

html[data-capture="1"] .capture-safe {
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}

.capture-hud {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--persimmon);
  margin: 8px 0;
}

html[data-promo-shot="1"] body {
  max-width: 390px;
  margin: 0 auto;
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100dvh;
}

html[data-promo-shot="1"] .mobile-app {
  max-width: 100%;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
}

html[data-promo-shot="1"] .start-panel,
html[data-promo-shot="1"] .utility-row,
html[data-promo-shot="1"] .disclaimer,
html[data-promo-shot="1"] .masthead {
  display: none !important;
}

html[data-promo-shot="1"] .hero {
  margin-bottom: 8px;
}

html[data-promo-shot="1"] .kicker {
  display: none;
}

html[data-promo-shot="1"] .hero h1 {
  font-size: 1.42rem;
}

html[data-promo-shot="1"] .live-msg {
  margin-bottom: 0;
}

html[data-promo-shot="1"] .mobile-app {
  padding-bottom: 6px;
}

html[data-promo-shot="1"] .mobile-app#app {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

html[data-promo-shot="1"] .mobile-wrap {
  min-height: 292px;
}

html[data-promo-shot="1"] .play-panel {
  display: block !important;
  padding-top: 10px;
  overflow-x: clip;
}

html[data-promo-shot="1"] .ornament.hint-ring {
  outline-offset: 2px;
}

html[data-promo-shot="1"] .hook-slot.drop-target {
  outline-offset: 2px;
}

.promo-only {
  display: none;
}

html[data-promo-shot="1"] {
  height: 100%;
}

html[data-promo-shot="1"] .mobile-app#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

html[data-promo-shot="1"] .hero,
html[data-promo-shot="1"] .play-panel {
  flex: 0 0 auto;
}

html[data-promo-shot="1"] .promo-only {
  display: block;
}

html[data-promo-shot="1"] .promo-scene {
  flex: 1 1 auto;
  margin-top: 10px;
  padding: 12px 8px 6px;
  min-height: 148px;
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 28%),
    linear-gradient(165deg, #dcc9a8 0%, #c9ad82 42%, #b8956a 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 8px 20px rgba(42, 53, 68, 0.06);
  position: relative;
  overflow: hidden;
}

html[data-promo-shot="1"] .promo-bench {
  position: relative;
  min-height: 96px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(139, 90, 60, 0.08) 0 14px,
      rgba(184, 132, 90, 0.12) 14px 28px
    ),
    linear-gradient(180deg, #e8d4b4 0%, #d4b88a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

html[data-promo-shot="1"] .promo-tool {
  position: absolute;
  border-radius: 4px;
  opacity: 0.85;
}

html[data-promo-shot="1"] .promo-tool--awl {
  width: 52px;
  height: 8px;
  left: 14%;
  top: 38%;
  background: linear-gradient(90deg, #8b5a3c, #c49a3a);
  transform: rotate(-12deg);
}

html[data-promo-shot="1"] .promo-tool--twine {
  width: 36px;
  height: 36px;
  right: 16%;
  top: 22%;
  border-radius: 50%;
  border: 3px solid rgba(196, 154, 58, 0.55);
  box-shadow: inset 0 0 0 6px rgba(243, 234, 216, 0.5);
}

html[data-promo-shot="1"] .promo-leaf {
  position: absolute;
  width: 14px;
  height: 18px;
  border-radius: 0 70% 0 70%;
  background: rgba(232, 184, 74, 0.55);
  transform: rotate(18deg);
}

html[data-promo-shot="1"] .promo-leaf--a {
  left: 8%;
  bottom: 18%;
  background: rgba(216, 107, 58, 0.45);
  transform: rotate(-24deg);
}

html[data-promo-shot="1"] .promo-leaf--b {
  left: 42%;
  bottom: 8%;
}

html[data-promo-shot="1"] .promo-leaf--c {
  right: 10%;
  bottom: 22%;
  width: 11px;
  height: 15px;
  opacity: 0.7;
}

html[data-promo-shot="1"] .promo-legend {
  margin: 10px 4px 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4a5568;
  letter-spacing: 0.02em;
}
