/* ==========================================================================
   Jade Hunt — original Bao Duo Duo mini game
   The page owns its visual language: forest lacquer, old jade, ivory paper and
   a restrained antique-gold line. No external fonts, images or CDN assets.
   ========================================================================== */

.jh-page {
  --jh-forest: #12352f;
  --jh-forest-deep: #0a211d;
  --jh-forest-700: #1b463d;
  --jh-forest-500: #2f6559;
  --jh-jade: #6f9b83;
  --jh-jade-soft: #dce8df;
  --jh-ivory: #f6f1e6;
  --jh-ivory-light: #fffdf8;
  --jh-paper: #f8f7f3;
  --jh-gold: #765c24;
  --jh-gold-deep: #5e491d;
  --jh-gold-light: #d8c28d;
  --jh-gold-line: #c9b98d;
  --jh-ink: #20312d;
  --jh-ink-soft: #3c4a45;
  --jh-muted: #63716c;
  --jh-line: #ded9cd;
  --jh-line-strong: #c8c1b2;
  --jh-danger: #8a3324;
  --jh-danger-bg: #fbf1ee;
  --jh-success-bg: #eaf1ec;
  --jh-shadow: 0 24px 70px rgba(10, 33, 29, 0.14);
  --jh-shadow-card: 0 1px 2px rgba(16, 32, 28, 0.05), 0 12px 30px rgba(16, 32, 28, 0.06);
  --jh-r-sm: 4px;
  --jh-r-md: 8px;
  --jh-r-lg: 16px;
  --jh-r-xl: 26px;
  --jh-focus: rgba(122, 95, 38, 0.42);
  --jh-serif: "Noto Serif TC", "Songti TC", "Big5 Ming", "PMingLiU", "PingFang TC", "Microsoft JhengHei", Georgia, serif;
  --jh-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --jh-mono: "SFMono-Regular", "Cascadia Mono", "Menlo", "Consolas", monospace;

  min-height: 100%;
  margin: 0;
  color: var(--jh-ink);
  background:
    radial-gradient(circle at 82% 4%, rgba(183, 149, 85, 0.16), transparent 32rem),
    radial-gradient(circle at 7% 32%, rgba(47, 101, 89, 0.10), transparent 34rem),
    var(--jh-ivory);
  font-family: var(--jh-serif);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

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

.jh-page [hidden] { display: none !important; }

.jh-page a { color: inherit; }

.jh-page h1,
.jh-page h2,
.jh-page h3,
.jh-page p { margin-top: 0; }

.jh-page button,
.jh-page input { font: inherit; }

.jh-page :focus-visible {
  outline: 3px solid var(--jh-gold);
  outline-offset: 3px;
}

.jh-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.jh-skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  color: var(--jh-ivory-light);
  background: var(--jh-forest-deep);
  border: 1px solid var(--jh-gold-light);
  border-radius: var(--jh-r-sm);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
.jh-skip:focus { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Shell, header, footer
   -------------------------------------------------------------------------- */

.jh-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 28px;
}

.jh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 18px;
  border-bottom: 1px solid rgba(118, 92, 36, 0.24);
}

.jh-brand {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  color: var(--jh-forest);
  text-decoration: none;
}

.jh-brand__seal {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--jh-gold);
  border: 1px solid var(--jh-gold);
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  box-shadow: inset 0 0 0 4px rgba(216, 194, 141, 0.18);
}

.jh-brand__wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.jh-brand__shop {
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.jh-brand__game {
  margin-top: 2px;
  color: var(--jh-gold);
  font-family: var(--jh-sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.32em;
}

.jh-header__nav {
  display: flex;
  gap: 18px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.jh-header__nav a {
  color: var(--jh-ink-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.jh-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 30px;
  padding: 22px 0 4px;
  border-top: 1px solid rgba(118, 92, 36, 0.22);
  color: var(--jh-muted);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}
.jh-footer p { margin: 0; }
.jh-footer a {
  flex: 0 0 auto;
  color: var(--jh-gold-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.jh-noscript {
  margin: 24px 0;
  padding: 18px 20px;
  color: var(--jh-danger);
  background: var(--jh-danger-bg);
  border: 1px solid rgba(138, 51, 36, 0.28);
  border-radius: var(--jh-r-md);
}

.jh-main {
  padding-top: 30px;
  outline: none;
}

/* --------------------------------------------------------------------------
   Shared type, panels, buttons, fields
   -------------------------------------------------------------------------- */

.jh-eyebrow,
.jh-kicker {
  margin-bottom: 10px;
  color: var(--jh-gold);
  font-family: var(--jh-sans);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  line-height: 1.5;
  text-transform: uppercase;
}

.jh-panel {
  position: relative;
  padding: clamp(18px, 3vw, 30px);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(201, 185, 141, 0.58);
  border-radius: var(--jh-r-lg);
  box-shadow: var(--jh-shadow-card);
  backdrop-filter: blur(7px);
}

.jh-panel__head {
  margin-bottom: 18px;
}
.jh-panel__head h2 {
  margin: 0;
  color: var(--jh-forest);
  font-size: clamp(1.25rem, 2.3vw, 1.62rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
}
.jh-panel__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.jh-panel__note {
  margin: -4px 0 14px;
  color: var(--jh-muted);
  font-size: 0.78rem;
  line-height: 1.65;
}
.jh-mini-count {
  flex: 0 0 auto;
  margin: 4px 0 0;
  padding: 4px 9px;
  color: var(--jh-gold-deep);
  background: rgba(216, 194, 141, 0.16);
  border: 1px solid rgba(201, 185, 141, 0.62);
  border-radius: 999px;
  font-family: var(--jh-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.jh-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--jh-line-strong);
  border-radius: 999px;
  background: var(--jh-ivory-light);
  box-shadow: 0 1px 0 rgba(16, 32, 28, 0.04);
  font-family: var(--jh-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.jh-button:hover { border-color: var(--jh-gold); background: #fffdf8; }
.jh-button:active { transform: translateY(1px); }
.jh-button:disabled {
  color: #8b938e;
  border-color: var(--jh-line);
  background: #f0eee7;
  cursor: not-allowed;
  transform: none;
}
.jh-button--primary {
  color: var(--jh-ivory-light);
  border-color: var(--jh-forest);
  background: var(--jh-forest);
  box-shadow: 0 10px 24px rgba(18, 53, 47, 0.20);
}
.jh-button--primary:hover {
  border-color: var(--jh-forest-700);
  background: var(--jh-forest-700);
}
.jh-button--ghost {
  color: var(--jh-forest);
  border-color: rgba(118, 92, 36, 0.42);
  background: rgba(255, 253, 248, 0.72);
}
.jh-button--ghost:hover { border-color: var(--jh-gold); background: var(--jh-ivory-light); }
.jh-button--quiet {
  color: var(--jh-muted);
  border-color: transparent;
  background: transparent;
}
.jh-button--quiet:hover { color: var(--jh-forest); border-color: var(--jh-line); background: rgba(255, 253, 248, 0.6); }
.jh-button kbd,
.jh-keys kbd {
  display: inline-grid;
  min-width: 19px;
  min-height: 19px;
  place-items: center;
  padding: 0 4px;
  color: var(--jh-gold-deep);
  border: 1px solid rgba(201, 185, 141, 0.7);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(216, 194, 141, 0.16);
  font-family: var(--jh-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
}

.jh-page input[type="range"] {
  width: 100%;
  min-height: 34px;
  accent-color: var(--jh-forest-500);
  cursor: pointer;
}

.jh-page input[type="file"] {
  border: 0;
  background: transparent;
}

.jh-page .jh-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* --------------------------------------------------------------------------
   Setup hero
   -------------------------------------------------------------------------- */

.jh-hero {
  max-width: 900px;
  margin: 24px auto clamp(28px, 5vw, 52px);
  text-align: center;
}
.jh-hero__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 18px;
  color: var(--jh-forest);
  font-weight: 500;
  line-height: 1.08;
}
.jh-hero__zh {
  font-size: clamp(2.65rem, 8vw, 5.7rem);
  letter-spacing: 0.1em;
}
.jh-hero__en {
  color: var(--jh-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.18rem, 3vw, 2rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.05em;
}
.jh-hero__lead {
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--jh-ink-soft);
  font-size: clamp(0.94rem, 1.8vw, 1.06rem);
  line-height: 1.9;
}
.jh-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.jh-pills li {
  padding: 5px 12px;
  color: var(--jh-forest-700);
  border: 1px solid rgba(47, 101, 89, 0.25);
  border-radius: 999px;
  background: rgba(220, 232, 223, 0.4);
  font-family: var(--jh-sans);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.jh-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: start;
}

.jh-setup-panel { padding-bottom: 24px; }

/* --------------------------------------------------------------------------
   Photo flow (built by photo-ui.mjs)
   -------------------------------------------------------------------------- */

.jh-photo-flow { margin-top: 2px; }
.jh-photo-steps {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.jh-photo-step {
  padding-top: 20px;
  border-top: 1px solid rgba(201, 185, 141, 0.42);
}
.jh-photo-step:first-child { padding-top: 0; border-top: 0; }

.jh-step-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.jh-step-heading__index {
  color: var(--jh-gold);
  font-family: var(--jh-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.jh-step-heading h3 {
  margin: 0;
  color: var(--jh-forest);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.jh-step-copy {
  margin-bottom: 12px;
  color: var(--jh-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}
.jh-help {
  margin: 8px 0 0;
  color: var(--jh-muted);
  font-size: 0.74rem;
  line-height: 1.65;
}
.jh-help--strong { color: var(--jh-ink-soft); }

.jh-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.jh-file-field { position: relative; min-width: 0; }
.jh-file-field__face {
  width: 100%;
  min-height: 48px;
  padding-inline: 12px;
}
.jh-file-field__input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.jh-file-field:focus-within .jh-file-field__face {
  outline: 3px solid var(--jh-gold);
  outline-offset: 3px;
}

.jh-crop-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.42fr);
  gap: 14px;
  align-items: start;
}
.jh-crop-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(18, 53, 47, 0.28);
  border-radius: var(--jh-r-md);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    var(--jh-forest-deep);
  background-position: 0 0, 8px 8px, 0 0;
  background-size: 16px 16px, 16px 16px, auto;
  box-shadow: inset 0 0 0 1px rgba(216, 194, 141, 0.18);
}
.jh-crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}
.jh-crop-canvas:active { cursor: grabbing; }
.jh-crop-empty {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  padding: 24px;
  place-items: center;
  color: rgba(246, 241, 230, 0.72);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
}
.jh-crop-tools {
  display: grid;
  gap: 10px;
}

.jh-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.jh-control { display: grid; gap: 3px; }
.jh-control__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--jh-ink-soft);
  font-family: var(--jh-sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.jh-control output {
  color: var(--jh-gold-deep);
  font-family: var(--jh-mono);
  font-size: 0.68rem;
  font-weight: 700;
}
.jh-palette-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 20px;
  margin-top: 2px;
}
.jh-palette-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(18, 53, 47, 0.24);
  border-radius: 50%;
  background: var(--jh-dot, var(--jh-jade));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.jh-palette-line span {
  color: var(--jh-muted);
  font-family: var(--jh-sans);
  font-size: 0.68rem;
}

.jh-preview-wrap {
  display: grid;
  grid-template-columns: minmax(120px, 0.58fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.jh-preview-frame {
  overflow: hidden;
  border: 1px solid rgba(18, 53, 47, 0.32);
  border-radius: var(--jh-r-md);
  background: var(--jh-forest-deep);
  box-shadow: 0 8px 22px rgba(10, 33, 29, 0.16);
}
.jh-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.jh-preview-meta {
  margin: 0 0 8px;
  color: var(--jh-forest);
  font-family: var(--jh-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.jh-process-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--jh-muted);
  font-size: 0.74rem;
  line-height: 1.6;
}
.jh-process-status[data-tone="error"] { color: var(--jh-danger); }
.jh-process-status[data-tone="ok"] { color: var(--jh-forest-500); }
.jh-start-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.jh-start-row .jh-button { min-width: 180px; }

.jh-setup-status {
  min-height: 1.5em;
  margin: 16px 0 0;
  color: var(--jh-ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}
.jh-setup-status[data-tone="error"] { color: var(--jh-danger); }
.jh-setup-status[data-tone="ok"] { color: var(--jh-forest-500); }

/* --------------------------------------------------------------------------
   Setup guide
   -------------------------------------------------------------------------- */

.jh-guide {
  padding: clamp(20px, 3vw, 30px);
  color: var(--jh-ivory);
  background:
    radial-gradient(circle at 85% 5%, rgba(216, 194, 141, 0.14), transparent 18rem),
    linear-gradient(155deg, var(--jh-forest-700), var(--jh-forest-deep));
  border: 1px solid rgba(216, 194, 141, 0.34);
  border-radius: var(--jh-r-lg);
  box-shadow: var(--jh-shadow);
}
.jh-guide .jh-kicker { color: var(--jh-gold-light); }
.jh-guide h2 {
  margin-bottom: 20px;
  color: var(--jh-ivory-light);
  font-size: clamp(1.24rem, 2.1vw, 1.55rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.45;
}
.jh-guide__list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.jh-guide__list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 194, 141, 0.20);
}
.jh-guide__list li:first-child { padding-top: 0; border-top: 0; }
.jh-guide__num {
  color: var(--jh-gold-light);
  font-family: var(--jh-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.jh-guide__list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--jh-ivory-light);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.jh-guide__list p {
  margin: 0;
  color: rgba(246, 241, 230, 0.76);
  font-size: 0.76rem;
  line-height: 1.7;
}
.jh-guide__privacy {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(216, 194, 141, 0.24);
  color: rgba(246, 241, 230, 0.72);
  font-size: 0.7rem;
  line-height: 1.65;
}
.jh-guide__privacy span {
  flex: 0 0 auto;
  padding: 1px 6px;
  color: var(--jh-forest-deep);
  border-radius: 3px;
  background: var(--jh-gold-light);
  font-family: var(--jh-sans);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Play screen
   -------------------------------------------------------------------------- */

.jh-screen--play { padding-top: 4px; }

.jh-play-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(118, 92, 36, 0.24);
}
.jh-play-head__copy { min-width: 0; }
.jh-play-head h1 {
  margin: 0 0 6px;
  color: var(--jh-forest);
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.15;
  outline: none;
}
.jh-game-status {
  max-width: 680px;
  margin: 0;
  color: var(--jh-muted);
  font-size: 0.84rem;
  line-height: 1.65;
}
.jh-game-status[data-tone="error"] { color: var(--jh-danger); }
.jh-game-status[data-tone="ok"] { color: var(--jh-forest-500); }

.jh-hud {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}
.jh-hud__item {
  min-width: 84px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(201, 185, 141, 0.62);
  border-radius: var(--jh-r-md);
  background: rgba(255, 253, 248, 0.7);
  text-align: center;
}
.jh-hud__value {
  display: block;
  color: var(--jh-forest);
  font-family: var(--jh-mono);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}
.jh-hud__slash { margin: 0 2px; color: var(--jh-gold-line); }
.jh-hud__label {
  display: block;
  margin-top: 1px;
  color: var(--jh-muted);
  font-family: var(--jh-sans);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.jh-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.jh-toolbar .jh-button { min-height: 42px; padding: 8px 14px; font-size: 0.76rem; }

.jh-play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.82fr);
  gap: clamp(18px, 3vw, 28px);
  align-items: start;
}

.jh-board-panel { overflow: hidden; }
.jh-board-note {
  margin: 4px 0 0;
  color: var(--jh-gold-deep);
  font-family: var(--jh-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: right;
}

/* Board + exterior ring ---------------------------------------------------- */

.jh-board-frame {
  position: relative;
  width: min(100%, 620px);
  aspect-ratio: 1;
  margin: 4px auto 0;
  border: 1px solid rgba(148, 124, 78, 0.42);
  border-radius: var(--jh-r-md);
  background:
    radial-gradient(circle at 50% 48%, rgba(216, 194, 141, 0.24), transparent 62%),
    repeating-linear-gradient(45deg, rgba(118, 92, 36, 0.045) 0 1px, transparent 1px 9px),
    linear-gradient(150deg, #fbf6e9, #eadcb9 74%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 253, 248, 0.5),
    inset 0 0 48px rgba(118, 92, 36, 0.1),
    0 18px 42px rgba(70, 54, 25, 0.14);
  isolation: isolate;
}
.jh-board-frame::before,
.jh-board-frame::after {
  position: absolute;
  z-index: 0;
  content: "";
  pointer-events: none;
}
.jh-board-frame::before {
  inset: calc(100% / (var(--jh-cols, 8) + 2));
  border: 1px solid rgba(216, 194, 141, 0.26);
  border-radius: 3px;
  background: rgba(246, 241, 230, 0.035);
}
.jh-board-frame::after {
  inset: 10px;
  border: 1px solid rgba(216, 194, 141, 0.09);
  border-radius: 5px;
}

.jh-board {
  position: absolute;
  z-index: 1;
  inset: calc(100% / (var(--jh-cols, 8) + 2));
  display: grid;
  grid-template-columns: repeat(var(--jh-cols, 8), minmax(0, 1fr));
  grid-template-rows: repeat(var(--jh-rows, 8), minmax(0, 1fr));
  gap: 0.25px;
  padding: 0.25px;
  border: 1px solid rgba(118, 92, 36, 0.32);
  border-radius: 3px;
  /* A restrained dark mauve/charcoal seam shows between adjacent stones.
     It stays quiet against dark palette pixels while reading as a fine join,
     not a white stripe. Cleared cells carry their own white pattern. */
  background-color: #4a4147;
  background-image: none;
}

/* Colored cells are plain palette squares. The only separation between them
   is the board's 0.25px seam: no inset ring, glow, gradient or rounded corner. */
.jh-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-color: var(--jh-cell-color, var(--jh-jade));
  background-image: none;
  box-shadow: none;
  transition: background-color 220ms ease, opacity 220ms ease;
}

.jh-cell.is-color {
  background-color: var(--jh-cell-color, var(--jh-jade));
  background-image: none;
  border-radius: 0;
  box-shadow: none;
}

.jh-cell.is-cleared {
  /* Each cleared square owns the same near-white lattice-dot pattern; the
     removed pixel's RGB is never reused. No dark fill, inset ring or mark. */
  background-color: #fdfcf7;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(42, 54, 50, 0.13) 0 0.6px, transparent 0.8px),
    repeating-linear-gradient(45deg, rgba(42, 54, 50, 0.055) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(42, 54, 50, 0.055) 0 1px, transparent 1px 9px);
  background-size: 9px 9px, auto, auto;
  box-shadow: none;
  opacity: 1;
}
.jh-cell.is-hint {
  animation: jh-hint-pulse 900ms ease-in-out 2;
  filter: brightness(1.18) saturate(1.08);
}
@keyframes jh-hint-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1.05); }
  50% { transform: scale(1.12); filter: brightness(1.4); }
}

/* The small jade courier --------------------------------------------------- */

.jh-carrier-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.jh-home {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(100% - (100% / (var(--jh-cols, 8) + 2)) / 2);
  width: calc(100% / (var(--jh-cols, 8) + 2) * 0.7);
  aspect-ratio: 1;
  border: 1px dashed rgba(216, 194, 141, 0.55);
  border-radius: 50%;
  background: rgba(216, 194, 141, 0.12);
  transform: translate(-50%, -50%);
}
.jh-home span {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  color: rgba(246, 241, 230, 0.66);
  font-family: var(--jh-sans);
  font-size: clamp(0.42rem, 0.8vw, 0.58rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateX(-50%);
}

.jh-carrier {
  --jh-carried-color: #9ed7b8;
  --jh-carrier-color: #6f9b83;
  --jh-carrier-edge: rgba(8, 28, 23, 0.62);
  --jh-carrier-detail: rgba(8, 28, 23, 0.62);
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(100% - (100% / (var(--jh-cols, 8) + 2)) / 2);
  width: calc(100% / (var(--jh-cols, 8) + 2) * 0.68);
  height: calc(100% / (var(--jh-cols, 8) + 2) * 0.94);
  transform: translate(-50%, -50%);
  transition: none;
}
.jh-carrier--active {
  left: 0;
  top: 0;
  will-change: transform;
}
.jh-carrier__head {
  position: absolute;
  top: 14%;
  left: 50%;
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: var(--jh-carrier-color, #f0d4b0);
  background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.24), transparent 55%, rgba(0, 0, 0, 0.14));
  box-shadow: inset 0 0 0 1px var(--jh-carrier-edge, rgba(8, 28, 23, 0.62));
  transform: translateX(-50%);
}
.jh-carrier__hat {
  position: absolute;
  z-index: 2;
  top: 2%;
  left: 50%;
  width: 72%;
  height: 24%;
  border-radius: 50% 50% 22% 22%;
  background-color: var(--jh-carrier-color, var(--jh-gold-light));
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.30), transparent 52%, rgba(0, 0, 0, 0.20));
  box-shadow: inset 0 0 0 1px var(--jh-carrier-edge, rgba(8, 28, 23, 0.62)), 0 2px 0 rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
}
.jh-carrier__body {
  position: absolute;
  top: 35%;
  left: 50%;
  width: 54%;
  height: 40%;
  border-radius: 22% 22% 28% 28%;
  background-color: var(--jh-carrier-color, var(--jh-jade));
  background-image:
    linear-gradient(90deg, transparent 42%, var(--jh-carrier-detail, rgba(8, 28, 23, 0.5)) 42% 58%, transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.20), transparent 48%, rgba(0, 0, 0, 0.18));
  box-shadow: inset 0 0 0 1px var(--jh-carrier-edge, rgba(8, 28, 23, 0.5));
  transform: translateX(-50%);
}
.jh-carrier__basket {
  position: absolute;
  top: 55%;
  right: -6%;
  width: 38%;
  height: 23%;
  border: 1px solid var(--jh-carrier-edge, rgba(216, 194, 141, 0.72));
  border-radius: 20% 20% 34% 34%;
  background-color: var(--jh-carrier-color, var(--jh-jade));
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 1px, var(--jh-carrier-detail, rgba(18, 53, 47, 0.32)) 1px 3px);
  transform: rotate(7deg);
}
.jh-carrier__pixel {
  position: absolute;
  z-index: 5;
  top: -26%;
  left: 50%;
  width: 42%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 253, 248, 0.8);
  border-radius: 2px;
  background: var(--jh-carried-color);
  box-shadow: 0 0 0 1px rgba(10, 33, 29, 0.5);
  opacity: 0;
  transform: translateX(-50%) scale(0.2);
  transition: none;
}
.jh-carrier.is-carrying .jh-carrier__pixel {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.jh-pickup-transfer {
  --jh-carried-color: #9ed7b8;
  position: absolute;
  z-index: 6;
  left: 0;
  top: 0;
  border: 0;
  border-radius: 0;
  background: var(--jh-carried-color);
  box-shadow: none;
  pointer-events: none;
  will-change: transform, opacity;
  transition: none;
}
.jh-carrier__foot {
  position: absolute;
  bottom: 1%;
  width: 18%;
  height: 24%;
  border-radius: 40% 40% 20% 20%;
  background-color: var(--jh-carrier-color, var(--jh-forest-deep));
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.16));
  box-shadow: inset 0 0 0 1px var(--jh-carrier-edge, rgba(8, 28, 23, 0.5));
  transform-origin: 50% 0;
}
.jh-carrier__foot--a { left: 34%; }
.jh-carrier__foot--b { right: 34%; }
.jh-carrier.is-walking .jh-carrier__foot--a { animation: jh-step-a 280ms steps(2, end) infinite; }
.jh-carrier.is-walking .jh-carrier__foot--b { animation: jh-step-b 280ms steps(2, end) infinite; }

@keyframes jh-step-a {
  0%, 100% { transform: rotate(-14deg); }
  50% { transform: rotate(18deg); }
}
@keyframes jh-step-b {
  0%, 100% { transform: rotate(18deg); }
  50% { transform: rotate(-14deg); }
}

.jh-board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--jh-muted);
  font-family: var(--jh-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.jh-board-legend span { display: inline-flex; align-items: center; gap: 6px; }
.jh-legend-swatch {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--jh-jade);
  box-shadow: inset 0 0 0 1px rgba(18, 53, 47, 0.28);
}
.jh-legend-swatch--cleared {
  background-color: #fdfcf7;
  background-image: repeating-linear-gradient(45deg, rgba(42, 54, 50, 0.14) 0 1px, transparent 1px 4px);
  border: 1px solid rgba(201, 185, 141, 0.82);
  box-shadow: none;
}
.jh-legend-person {
  width: 12px;
  height: 16px;
  border-radius: 45% 45% 30% 30%;
  background: var(--jh-forest-500);
  box-shadow: inset 0 -4px 0 var(--jh-gold-line);
}
.jh-board-hint {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 185, 141, 0.32);
  color: var(--jh-muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

/* Queue lanes -------------------------------------------------------------- */

.jh-side { display: grid; gap: 16px; }

.jh-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.jh-lane {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(201, 185, 141, 0.52);
  border-radius: var(--jh-r-md);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.86), rgba(246, 241, 230, 0.58));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.jh-lane__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
  color: var(--jh-gold-deep);
  font-family: var(--jh-sans);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.3;
}
.jh-lane__count {
  color: var(--jh-muted);
  font-family: var(--jh-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
.jh-lane__stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.jh-lane__empty {
  display: grid;
  min-height: 64px;
  place-items: center;
  color: var(--jh-muted);
  border: 1px dashed rgba(201, 185, 141, 0.52);
  border-radius: 5px;
  font-family: var(--jh-sans);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.jh-card {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
  padding: 7px;
  overflow: hidden;
  color: var(--jh-ink);
  border: 1px solid rgba(18, 53, 47, 0.18);
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 1px 2px rgba(16, 32, 28, 0.07);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background-color 140ms ease;
}
.jh-card--top {
  min-height: 66px;
  border-color: rgba(118, 92, 36, 0.46);
  background: linear-gradient(145deg, #fffdf8, #f4ecdd);
  box-shadow: 0 7px 16px rgba(16, 32, 28, 0.1);
}
.jh-card--top:not(:disabled):hover {
  border-color: var(--jh-gold);
  box-shadow: 0 9px 20px rgba(16, 32, 28, 0.15);
  transform: translateY(-1px);
}
.jh-card:not(.jh-card--top):disabled {
  color: var(--jh-ink-soft);
  opacity: 1;
  cursor: default;
}
.jh-card:disabled { cursor: default; }
.jh-card.is-locked { filter: saturate(0.8); }
.jh-card.is-blocked {
  border-style: dashed;
  background:
    repeating-linear-gradient(-45deg, rgba(216, 194, 141, 0.12) 0 5px, transparent 5px 10px),
    rgba(255, 253, 248, 0.86);
}
.jh-card__swatch {
  width: 9px;
  min-height: 100%;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 45%),
    var(--jh-card-color, var(--jh-jade));
  box-shadow: inset 0 0 0 1px rgba(10, 33, 29, 0.22);
}
.jh-card__body { min-width: 0; }
.jh-card__topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.jh-card__label {
  overflow: hidden;
  color: var(--jh-forest);
  font-family: var(--jh-sans);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jh-card__count {
  flex: 0 0 auto;
  color: var(--jh-gold-deep);
  font-family: var(--jh-mono);
  font-size: 0.59rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.jh-card__meter {
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 53, 47, 0.1);
}
.jh-card__meter > span {
  display: block;
  width: calc(var(--jh-ratio, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: var(--jh-card-color, var(--jh-jade));
}
.jh-card__badge {
  display: inline-block;
  margin-top: 4px;
  padding: 0 4px;
  color: var(--jh-danger);
  border: 1px solid rgba(138, 51, 36, 0.24);
  border-radius: 3px;
  background: rgba(138, 51, 36, 0.06);
  font-family: var(--jh-sans);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.jh-card--top .jh-card__label { font-size: 0.72rem; }
.jh-card--top .jh-card__count { font-size: 0.64rem; }

/* Parking slots ------------------------------------------------------------ */

.jh-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.jh-slot {
  position: relative;
  min-width: 0;
  min-height: 96px;
  padding: 7px;
  overflow: hidden;
  border: 1px dashed rgba(201, 185, 141, 0.68);
  border-radius: var(--jh-r-md);
  background:
    linear-gradient(180deg, rgba(246, 241, 230, 0.55), rgba(255, 253, 248, 0.42));
}
.jh-slot::before {
  position: absolute;
  top: 5px;
  right: 6px;
  color: rgba(118, 92, 36, 0.5);
  font-family: var(--jh-mono);
  font-size: 0.52rem;
  font-weight: 700;
  content: attr(data-slot);
}
.jh-slot.is-filled {
  border-style: solid;
  border-color: rgba(118, 92, 36, 0.38);
  background:
    linear-gradient(150deg, #fffdf8, #f4ecdd);
  box-shadow: 0 5px 12px rgba(16, 32, 28, 0.06);
}
.jh-slot.is-blocked {
  border-color: rgba(138, 51, 36, 0.36);
  background:
    repeating-linear-gradient(-45deg, rgba(138, 51, 36, 0.045) 0 4px, transparent 4px 8px),
    #fffaf7;
}
.jh-slot.is-disabled {
  color: var(--jh-muted);
  border-style: dotted;
  background: rgba(235, 230, 216, 0.28);
  opacity: 0.62;
}
.jh-slot.is-disabled::before { color: rgba(99, 113, 108, 0.58); }
.jh-slot__empty {
  display: grid;
  height: 100%;
  min-height: 78px;
  place-items: center;
  color: rgba(99, 113, 108, 0.76);
  font-family: var(--jh-sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
}
.jh-slot__card { display: none; }
.jh-slot.is-filled .jh-slot__card { display: block; }
.jh-slot.is-filled .jh-slot__empty { display: none; }
.jh-slot__swatch {
  display: block;
  width: 100%;
  height: 18px;
  margin-bottom: 5px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 58%),
    var(--jh-card-color, var(--jh-jade));
  box-shadow: inset 0 0 0 1px rgba(10, 33, 29, 0.2);
}
.jh-slot__label {
  display: block;
  overflow: hidden;
  color: var(--jh-forest);
  font-family: var(--jh-sans);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jh-slot__count {
  display: block;
  margin-top: 1px;
  color: var(--jh-gold-deep);
  font-family: var(--jh-mono);
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.jh-slot__badge {
  display: inline-block;
  margin-top: 4px;
  padding: 0 3px;
  color: var(--jh-danger);
  border: 1px solid rgba(138, 51, 36, 0.24);
  border-radius: 3px;
  font-family: var(--jh-sans);
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1.5;
}
.jh-slot__meter {
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 53, 47, 0.1);
}
.jh-slot__meter > span {
  display: block;
  width: calc(var(--jh-ratio, 0) * 100%);
  height: 100%;
  background: var(--jh-card-color, var(--jh-jade));
}

/* Result recovery ---------------------------------------------------------- */

.jh-result {
  margin-top: 22px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(118, 92, 36, 0.4);
  border-radius: var(--jh-r-lg);
  background:
    radial-gradient(circle at 90% 0%, rgba(216, 194, 141, 0.2), transparent 24rem),
    linear-gradient(145deg, #fffdf8, #f2eadb);
  box-shadow: var(--jh-shadow);
}
.jh-result[data-state="lost"] {
  border-color: rgba(138, 51, 36, 0.34);
  background:
    radial-gradient(circle at 90% 0%, rgba(138, 51, 36, 0.08), transparent 24rem),
    linear-gradient(145deg, #fffdf8, #fbf1ee);
}
.jh-result h2 {
  margin-bottom: 8px;
  color: var(--jh-forest);
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.jh-result p:not(.jh-kicker) {
  max-width: 760px;
  margin-bottom: 18px;
  color: var(--jh-ink-soft);
  font-size: 0.88rem;
  line-height: 1.75;
}
.jh-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.jh-keys {
  margin: 18px 0 0;
  color: var(--jh-muted);
  font-family: var(--jh-sans);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .jh-setup-grid { grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.75fr); }
  .jh-play-layout { grid-template-columns: minmax(0, 1fr) minmax(310px, 0.8fr); }
}

@media (max-width: 880px) {
  .jh-setup-grid,
  .jh-play-layout { grid-template-columns: minmax(0, 1fr); }
  .jh-guide { order: -1; }
  .jh-play-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .jh-hud { width: 100%; }
  .jh-hud__item { flex: 1 1 0; }
  .jh-board-panel { padding-bottom: 18px; }
  .jh-side { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr); align-items: start; }
  .jh-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .jh-shell { width: min(100% - 24px, 1240px); }
  .jh-header { padding-top: 16px; }
  .jh-main { padding-top: 20px; }
  .jh-hero { margin-top: 12px; margin-bottom: 26px; }
  .jh-hero__title { gap: 4px 12px; }
  .jh-hero__lead { font-size: 0.9rem; line-height: 1.8; }
  .jh-crop-wrap { grid-template-columns: minmax(0, 1fr); }
  .jh-crop-stage {
    width: min(86vw, 42svh, 420px);
    max-width: 100%;
    margin-inline: auto;
  }
  .jh-preview-wrap { grid-template-columns: minmax(110px, 0.48fr) minmax(0, 1fr); }
  .jh-side { grid-template-columns: minmax(0, 1fr); }
  .jh-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* Keep crop controls in a centered touch-safe column with clear side gutters. */
@media (max-width: 700px), (pointer: coarse) {
  .jh-crop-wrap { grid-template-columns: minmax(0, 1fr); }
  .jh-crop-tools,
  .jh-controls {
    width: min(70vw, 520px);
    max-width: 100%;
    margin-inline: auto;
  }
  .jh-crop-tools { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .jh-crop-tools .jh-help { grid-column: auto; }
  .jh-controls { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

@media (max-width: 520px) {
  .jh-brand__shop { font-size: 0.86rem; }
  .jh-brand__seal { width: 38px; height: 38px; }
  .jh-header__nav { font-size: 0.74rem; }
  .jh-panel { padding: 16px; }
  .jh-setup-panel { padding-bottom: 16px; }
  .jh-source-actions { grid-template-columns: minmax(0, 1fr); }
  .jh-controls { grid-template-columns: minmax(0, 1fr); }
  .jh-preview-wrap { grid-template-columns: minmax(0, 1fr); }
  .jh-preview-frame { width: min(100%, 260px); margin-inline: auto; }
  .jh-start-row .jh-button { width: 100%; }
  .jh-lanes { gap: 5px; }
  .jh-lane { padding: 6px; }
  .jh-card { grid-template-columns: 7px minmax(0, 1fr); gap: 5px; padding: 6px; }
  .jh-card--top { min-height: 72px; }
  .jh-card__label { font-size: 0.6rem; }
  .jh-card--top .jh-card__label { font-size: 0.65rem; }
  .jh-card__count { font-size: 0.54rem; }
  .jh-card--top .jh-card__count { font-size: 0.58rem; }
  .jh-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jh-slot { min-height: 84px; }
  .jh-slot__empty { min-height: 66px; }
  .jh-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jh-toolbar .jh-button { width: 100%; }
  .jh-result__actions .jh-button { width: 100%; }
  .jh-keys { display: none; }
}

@media (max-width: 370px) {
  .jh-lane__head { font-size: 0.56rem; }
  .jh-lane__count { display: none; }
  .jh-card__badge { display: none; }
}

/* --------------------------------------------------------------------------
   Reduced motion, contrast, print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .jh-page *,
  .jh-page *::before,
  .jh-page *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
  .jh-carrier { transition: none; }
  .jh-cell.is-hint { animation: none; filter: brightness(1.35) saturate(1.12); }
  .jh-carrier.is-walking .jh-carrier__foot--a,
  .jh-carrier.is-walking .jh-carrier__foot--b { animation: none; }
}

@media (forced-colors: active) {
  .jh-panel,
  .jh-board-frame,
  .jh-lane,
  .jh-card,
  .jh-slot,
  .jh-result { border: 1px solid CanvasText; }
  .jh-board { background: Canvas; }
  .jh-cell { border: 1px solid CanvasText; }
  .jh-cell.is-cleared {
    background: Canvas;
    background-image: none;
    box-shadow: none;
  }
  .jh-button { border: 1px solid ButtonText; }
}

@media print {
  .jh-header__nav,
  .jh-toolbar,
  .jh-footer,
  .jh-skip { display: none; }
  .jh-page { background: #fff; }
}

/* Compact, original play arena: board / recovery / five slots / rising queues. */
.jh-header-play-title { display:none; margin:0; font-family:var(--jh-sans); font-size:.72rem; font-weight:700; line-height:1.25; letter-spacing:.02em; outline:none; }
.jh-header-play-title span { margin-left:5px; color:var(--jh-gold-deep); font-weight:500; }
.jh-sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.jh-playing { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
.jh-playing .jh-shell { width:min(calc(100% - 12px),560px); }
.jh-playing .jh-header { padding:8px 0; min-height:46px; gap:8px; }
.jh-playing .jh-brand { gap:8px; }
.jh-playing .jh-brand__seal { width:30px; height:30px; font-size:1rem; }
.jh-playing .jh-brand__shop { font-size:.78rem; line-height:1.2; }
.jh-playing .jh-brand__game { display:none; }
.jh-playing .jh-header-play-title { display:block; }
.jh-playing .jh-header__nav { font-size:.66rem; white-space:nowrap; }
.jh-playing .jh-main { padding-top:6px; }
.jh-playing .jh-play-head { display:flex; flex-direction:row; align-items:center; gap:8px; margin:0 0 5px; padding:0; border:0; }
.jh-playing .jh-hud { display:flex; gap:8px; width:auto; flex:0 0 auto; }
.jh-playing .jh-hud__item { display:flex; flex:0 0 auto; white-space:nowrap; align-items:baseline; gap:3px; min-width:0; padding:0; border:0; border-radius:0; background:none; }
.jh-playing .jh-hud__value { display:inline; font-size:.7rem; line-height:1.3; }
.jh-playing .jh-hud__label { display:inline; font-size:.58rem; margin:0; letter-spacing:0; }
.jh-playing .jh-game-status { min-width:0; margin:0; font-size:.64rem; line-height:1.4; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.jh-playing .jh-game-status[data-tone="error"] { white-space:normal; }
.jh-playing .jh-toolbar { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; margin:0 0 7px; }
.jh-playing .jh-toolbar .jh-button { width:100%; min-height:30px; padding:4px 3px; font-size:.67rem; border-radius:6px; }
.jh-playing .jh-toolbar kbd { display:none; }
.jh-playing .jh-play-layout { display:flex; flex-direction:column; align-items:stretch; gap:8px; }
.jh-arena { position:relative; min-width:0; }
.jh-playing .jh-board-panel { padding:0; overflow:visible; border:0; background:none; box-shadow:none; }
.jh-playing .jh-board-frame {
  width:min(100%,520px,calc(100svh - 200px));
  max-height:calc(100svh - 200px);
  margin:0 auto;
  border-color:rgba(148,124,78,.42);
  border-radius:10px;
  background:
    radial-gradient(circle at 50% 46%,rgba(216,194,141,.24),transparent 60%),
    repeating-linear-gradient(45deg,rgba(118,92,36,.045) 0 1px,transparent 1px 9px),
    linear-gradient(150deg,#fbf6e9,#eadcb9 74%);
  box-shadow:
    inset 0 0 0 3px rgba(255,253,248,.5),
    inset 0 0 20px rgba(118,92,36,.10),
    0 6px 18px rgba(70,54,25,.12);
}
.jh-playing .jh-board, .jh-playing .jh-board-frame::before { inset:max(8px,calc(100% / (var(--jh-cols,8) + 2))); }
.jh-playing .jh-board-frame::before { border-color:rgba(118,92,36,.22); background:rgba(255,253,248,.26); }
.jh-playing .jh-carrier-layer { position:absolute; inset:0; z-index:8; pointer-events:none; }
.jh-playing .jh-carrier { width:13px; height:19px; }
.jh-recovery-row { display:flex; justify-content:center; align-items:center; height:34px; }
.jh-playing .jh-home { position:relative; left:auto; top:auto; width:38px; height:22px; margin:0; border:2px solid #c7af83; border-radius:50%; transform:none; background:radial-gradient(ellipse at 52% 72%,#46664e 0,#19392c 45%,#09221b 75%); box-shadow:inset 0 3px 5px #041b16,0 2px 1px #fff8e0; }
.jh-playing .jh-home span { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); }
.jh-playing .jh-slots-panel,.jh-playing .jh-lanes-panel { margin:0; padding:0; border:0; background:none; box-shadow:none; }
.jh-playing .jh-slots { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; width:min(100%,420px); margin:0 auto; padding:0; list-style:none; }
.jh-playing .jh-slot { position:relative; height:clamp(42px,13vw,64px); min-height:0; padding:0; border:1px solid #c5cabb; border-radius:8px; background:#fffefa; box-shadow:inset 0 -3px 0 rgba(15,44,34,.12),0 2px 4px rgba(15,44,34,.1); }
.jh-playing .jh-slot::before { display:none; }
.jh-playing .jh-slot.is-filled { background:var(--jh-card-color); border-color:rgba(12,42,32,.25); }
.jh-playing .jh-slot.is-blocked { background:var(--jh-card-color); }
.jh-playing .jh-slot.is-blocked::after { content:"…"; position:absolute; right:3px; bottom:0; font-size:11px; color:var(--jh-card-ink); }
.jh-playing .jh-slot__empty { min-height:0; height:100%; font-size:0; }
.jh-playing .jh-slot__card { display:none; width:100%; height:100%; padding:0; }
.jh-playing .jh-slot.is-filled .jh-slot__card { display:grid; place-items:center; }
.jh-playing .jh-slot.is-filled .jh-slot__empty { display:none; }
.jh-playing .jh-slot__swatch,.jh-playing .jh-slot__label,.jh-playing .jh-slot__meter,.jh-playing .jh-slot__badge { display:none!important; }
.jh-playing .jh-slot__count { color:var(--jh-card-ink,#173d31); font-family:var(--jh-sans); font-weight:800; font-size:clamp(1.05rem,4.5vw,1.45rem); line-height:1; margin:0; }
.jh-playing .jh-lanes { display:grid; grid-template-columns:repeat(3,var(--jh-queue-size)); gap:10px; justify-content:center; width:auto; margin:0; --jh-queue-size:clamp(42px,13.5vw,64px); }
.jh-playing .jh-lane { position:relative; min-width:0; margin:0; padding:0; border:0; border-radius:0; background:none; box-shadow:none; }
.jh-playing .jh-lane__head { position:absolute; top:-11px; right:0; height:0; margin:0; padding:0; z-index:2; }
.jh-playing .jh-lane__title,.jh-playing .jh-lane__count,.jh-playing .jh-lane__empty { display:none; }
.jh-playing .jh-lane__stack { display:flex; flex-direction:column; gap:7px; margin:0; padding:0; list-style:none; }
.jh-playing .jh-lane__item { margin:0; padding:0; border:0; }
.jh-playing .jh-card { display:grid; grid-template-columns:minmax(0,1fr); place-items:center; width:var(--jh-queue-size); height:var(--jh-queue-size); min-height:0; min-width:0; padding:0; gap:0; border:1px solid rgba(14,45,34,.25); border-radius:9px; background:var(--jh-card-color); box-shadow:inset 0 3px 0 rgba(255,255,255,.2),inset 0 -5px 0 rgba(7,36,27,.2),0 2px 3px rgba(12,38,30,.15); transform:none; }
.jh-playing .jh-card--top { min-height:0; outline:2px solid rgba(255,253,243,.95); outline-offset:1px; }
.jh-playing .jh-card.is-locked { opacity:.72; transform:none; }
.jh-playing .jh-card__body,.jh-playing .jh-card__topline { display:grid; place-items:center; gap:0; margin:0; padding:0; width:100%; }
.jh-playing .jh-card__topline { grid-template-columns:minmax(0,1fr); }
.jh-playing .jh-card__swatch,.jh-playing .jh-card__label,.jh-playing .jh-card__meter,.jh-playing .jh-card__badge { display:none!important; }
.jh-playing .jh-card .jh-card__count { color:var(--jh-card-ink,#fffdf8); font-family:var(--jh-sans); font-size:clamp(1.15rem,5vw,1.65rem); font-weight:800; line-height:1; white-space:nowrap; margin:0; }
.jh-playing .jh-card[hidden] { display:none!important; }
.jh-playing .jh-lane__stack.is-advancing { animation:jh-queue-push 160ms ease-out; }
@keyframes jh-queue-push { from { transform:translateY(18px); } to { transform:translateY(0); } }
.jh-playing .jh-keys { margin:8px 0 0; font-size:.57rem; line-height:1.3; }
.jh-playing .jh-footer { display:none; }
.jh-playing .jh-result { margin:10px 0 0; padding:12px; }
.jh-playing .jh-result h2 { font-size:1.2rem; }
.jh-playing .jh-result__actions { display:flex; flex-wrap:wrap; gap:6px; }
.jh-playing .jh-result__actions .jh-button { width:auto; min-height:32px; padding:5px 10px; font-size:.7rem; }
@media(max-width:520px) {
  .jh-playing .jh-keys { display:none; }
}
@media(prefers-reduced-motion:reduce) { .jh-playing .jh-lane__stack.is-advancing { animation:none; } }

/* Compact speed selector: visual pace only; each slot keeps its own 500ms dispatch cadence. */
.jh-speed-row { display:flex; align-items:center; gap:7px; margin:0 0 7px; min-height:28px; }
.jh-speed-label { color:var(--jh-muted); font-size:.67rem; font-weight:700; }
.jh-speed-control { display:inline-flex; gap:2px; padding:2px; border:1px solid rgba(118,92,36,.34); border-radius:7px; background:rgba(255,253,248,.78); }
.jh-speed-button { min-width:34px; min-height:25px; padding:2px 7px; border:0; border-radius:5px; color:var(--jh-forest); background:transparent; font:700 .68rem var(--jh-sans); cursor:pointer; }
.jh-speed-button[aria-pressed="true"] { color:var(--jh-ivory-light); background:var(--jh-forest); }
.jh-speed-button:focus-visible { outline:2px solid var(--jh-gold); outline-offset:2px; }
.jh-playing .jh-speed-row { margin:0 0 5px; min-height:25px; }
.jh-playing .jh-speed-label { font-size:.6rem; }
.jh-playing .jh-speed-button { min-width:30px; min-height:23px; padding:1px 6px; font-size:.64rem; }
.jh-playing #jh-new-photo-button[hidden],
.jh-playing #jh-result-new[hidden] { display:none!important; }

/* Compact play controls: speed at the left, counters beside it, icon actions at
   the right. Normal live status stays screen-reader only; errors get one full
   row only while the error tone is present. */
.jh-mobile-control-bar {
  position:relative;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  width:100%;
  margin:0 0 6px;
}
.jh-mobile-control-bar .jh-speed-cycle-button {
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:center;
  min-width:42px;
  min-height:42px;
  padding:0 8px;
  color:var(--jh-forest);
  border:1px solid rgba(118,92,36,.38);
  border-radius:8px;
  background:rgba(255,253,248,.9);
  font:800 .8rem/1 var(--jh-sans);
  cursor:pointer;
  touch-action:manipulation;
}
.jh-mobile-control-bar .jh-speed-cycle-button:active { background:rgba(246,241,230,.96); }
.jh-mobile-control-bar .jh-speed-cycle-button:focus-visible,
.jh-mobile-control-bar .jh-toolbar .jh-button:focus-visible {
  outline:3px solid var(--jh-gold);
  outline-offset:2px;
}
.jh-mobile-control-bar .jh-hud {
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:6px;
  width:auto;
  min-width:0;
  margin:0;
}
.jh-mobile-control-bar .jh-hud__item {
  display:flex;
  flex:0 0 auto;
  align-items:baseline;
  gap:3px;
  min-width:0;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:none;
  white-space:nowrap;
}
.jh-mobile-control-bar .jh-hud__value { display:inline; font-size:.7rem; line-height:1.3; }
.jh-mobile-control-bar #jh-cleared-count {
  color:transparent;
  background-image:linear-gradient(100deg,#d34b3c 0%,#e6a637 24%,#45a879 48%,#4288cc 73%,#8861c3 100%);
  background-clip:text;
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  font-weight:900;
}
.jh-mobile-control-bar #jh-total-count { color:var(--jh-muted); font-size:.9em; }
.jh-mobile-control-bar .jh-hud__label { display:inline; margin:0; font-size:.58rem; letter-spacing:0; }
.jh-mobile-control-bar #jh-game-status {
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
  color:var(--jh-muted);
  font-size:.64rem;
  line-height:1.4;
}
.jh-mobile-control-bar #jh-game-status[data-tone="error"] {
  position:static!important;
  order:3;
  flex:1 0 100%;
  width:auto!important;
  height:auto!important;
  margin:0!important;
  padding:5px 8px!important;
  overflow:visible!important;
  clip:auto!important;
  white-space:normal!important;
  color:var(--jh-danger);
  border:1px solid rgba(138,51,36,.28)!important;
  border-radius:6px;
  background:var(--jh-danger-bg);
}
.jh-mobile-control-bar .jh-toolbar {
  display:flex;
  flex:0 0 auto;
  align-items:center;
  gap:4px;
  margin:0 0 0 auto;
  padding:0;
}
.jh-mobile-control-bar .jh-toolbar .jh-button {
  display:inline-flex;
  width:40px;
  min-width:40px;
  height:42px;
  min-height:42px;
  align-items:center;
  justify-content:center;
  padding:0;
  border-radius:8px;
  font-size:0;
  line-height:1;
  touch-action:manipulation;
}
.jh-mobile-control-bar .jh-toolbar .jh-button svg {
  display:block;
  flex:0 0 auto;
  width:18px;
  height:18px;
}
.jh-mobile-control-bar .jh-toolbar kbd { display:none; }
@media(max-width:370px) {
  .jh-mobile-control-bar { gap:4px; }
  .jh-mobile-control-bar .jh-speed-cycle-button { min-width:38px; padding:0 5px; font-size:.74rem; }
  .jh-mobile-control-bar .jh-hud { gap:4px; }
  .jh-mobile-control-bar .jh-hud__label { font-size:.5rem; }
  .jh-mobile-control-bar .jh-hud__value { font-size:.66rem; }
  .jh-mobile-control-bar .jh-toolbar { gap:3px; }
  .jh-mobile-control-bar .jh-toolbar .jh-button { width:36px; min-width:36px; }
}

/* Product detail entry: show the generated preview and start action first. */
body.jh-product-mode .jh-hero { display:none; }
body.jh-product-mode .jh-main { padding-top:10px; }
body.jh-product-mode .jh-setup-grid { display:flex; flex-direction:column; gap:10px; }
body.jh-product-mode .jh-setup-panel { order:0; width:100%; padding:12px; }
body.jh-product-mode .jh-setup-panel > .jh-panel__head { display:none; }
body.jh-product-mode .jh-photo-flow { margin:0; }
body.jh-product-mode .jh-photo-steps { display:flex; flex-direction:column; gap:10px; }
body.jh-product-mode .jh-photo-step--source { display:none!important; }
body.jh-product-mode .jh-photo-step--preview { order:0; padding:0; border:0; }
body.jh-product-mode .jh-photo-step--crop { order:1; padding-top:10px; }
body.jh-product-mode .jh-photo-step--preview .jh-preview-wrap { grid-template-columns:minmax(140px,.7fr) minmax(0,1fr); gap:10px; }
body.jh-product-mode .jh-preview-frame { width:100%; max-width:340px; }
body.jh-product-mode .jh-start-row { margin-top:10px; }
body.jh-product-mode .jh-start-row .jh-button { min-width:190px; }
body.jh-product-mode .jh-setup-status { margin-top:8px; }
body.jh-product-mode .jh-guide { order:1; width:100%; padding:16px; }
body.jh-product-mode #jh-new-photo-button,
body.jh-product-mode #jh-result-new { display:none!important; }
body.jh-product-mode .jh-footer { margin-top:12px; }
@media(max-width:520px) {
  body.jh-product-mode .jh-photo-step--preview .jh-preview-wrap { grid-template-columns:minmax(0,1fr); justify-items:center; gap:8px; }
  body.jh-product-mode .jh-preview-frame { width:min(100%,280px); }
  body.jh-product-mode .jh-preview-meta,
  body.jh-product-mode .jh-process-status { text-align:center; }
  body.jh-product-mode .jh-start-row { justify-content:center; }
}
