/* The original green game sits as one complete panel inside the project page. */
.kaya-game [hidden] { display: none !important; }
.kaya-game button { font: inherit; text-transform: uppercase; }
.play-layout {
  --ink: #32422f;
  --ink-soft: #53624b;
  --ink-mute: #6a785f;
  --line-soft: #32422f26;
  --kaya: #607f44;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(104px, 11vw, 140px);
  align-items: start;
  gap: 24px;
  width: 100%;
  margin-top: clamp(10px, 1.5vw, 24px);
  padding: clamp(18px, 2.5vw, 36px);
  color: var(--ink);
  background: #eef2e6;
  border: 1px solid #b1bea0;
  border-radius: 2px;
}
.play-area { min-width: 0; }
.game-heading { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.game-heading h2 { margin: 0; }
.game-heading p { text-align: right; }
.start-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -40%); display: flex; flex-direction: column; align-items: center; gap: 24px; width: min(70%, 240px); }
.start-overlay button { width: min(100%, 150px); min-height: 42px; padding: 8px 12px; border-radius: 3px; font-size: 12px; letter-spacing: .035em; }
.stage:not([data-phase="ready"]):not([data-phase="error"]) .start-overlay { display: none; }
.stage[data-phase="ready"] canvas, .stage[data-phase="error"] canvas { opacity: 0; }
.stage { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e5ead7; border: 1px solid #b1bea0; border-radius: 6px; isolation: isolate; }
.stage canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.stage-toolbar { position: absolute; inset: 16px 18px auto; display: flex; justify-content: flex-end; font-size: 11px; pointer-events: none; }
.stage-toolbar button { padding: 7px 13px; min-height: 34px; border: 1px solid #ffffff45; border-radius: 3px; background: #32422fdf; color: #f4f6ee; pointer-events: auto; }
.stage-message { position: absolute; bottom: 24px; left: 8%; right: 8%; text-align: center; color: var(--ink); font-size: clamp(12px, 1.3vw, 18px); pointer-events: none; }
.stage[data-mode="camera"] .stage-message:not(:empty) { width: fit-content; max-width: 84%; margin: auto; padding: 8px 14px; border-radius: 4px; background: #32422fe8; color: #f4f6ee; }
.stage[data-phase="countdown"] .stage-message { top: 42%; bottom: auto; font-size: clamp(44px, 7vw, 88px); font-weight: 650; }
.stage[data-phase="won"] .stage-message { color: #e5eacb; font-size: clamp(21px, 3vw, 40px); font-weight: 650; }
.recipe { display: grid; grid-template-columns: 1fr; gap: clamp(12px, 2vw, 26px); width: 100%; list-style: none; margin: 0; padding: 0; }
.recipe li { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-mute); text-transform: uppercase; border: 0; padding-bottom: 11px; }
.recipe canvas { display: block; width: 60px; height: 25px; object-fit: contain; opacity: .65; }
.recipe li.is-added { color: var(--ink); }
.recipe li.is-added canvas, .recipe li.is-next canvas { opacity: 1; }
.control-panel { min-width: 0; }
.status h2 { max-width: none; margin: 0 0 16px; font-size: clamp(20px, 2.1vw, 28px); line-height: 1.2; font-weight: 550; letter-spacing: -.025em; text-transform: uppercase; }
.status p { max-width: 52ch; margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.status p:empty { display: none; }
.actions { display: grid; gap: 9px; margin-top: 28px; }
.actions button { width: 100%; min-height: 46px; border-radius: 3px; padding: 12px 16px; font-size: 12px; font-weight: 550; letter-spacing: .035em; transition: background .2s; }
.primary { border: 1px solid #536d3b; color: #fff; background: #607f44; }
.primary:hover { background: #526f39; }
.secondary { border: 1px solid var(--ink-mute); color: var(--ink); background: transparent; }
.secondary:hover { background: #32422f0a; }
.kaya-game button:focus-visible { outline: 2px solid var(--kaya); outline-offset: 4px; }
.error { margin: 14px 0 0; background: #efddd3; color: #743e30; padding: 12px; font-size: 13px; line-height: 1.5; border-radius: 3px; }
.hold-progress { position: absolute; inset: 20px 32% auto; text-align: center; color: #f4f6ee; background: #32422fe8; border-radius: 4px; padding: 9px 14px; }
.hold-progress span { display: block; font-size: 11px; }
.hold-progress strong { display: block; font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hold-progress progress { display: block; width: 100%; height: 6px; margin-top: 4px; accent-color: var(--kaya); }
.toast-rating { width: min(100%, 430px); margin: 22px 0 4px; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.toast-rating__label { margin: 0 0 10px; color: var(--ink-mute); font-size: 12px; }
.toast-rating__summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 18px; color: #526f39; }
.toast-rating__summary > strong { font-size: clamp(18px, 1.7vw, 22px); font-weight: 650; letter-spacing: -.035em; }
.toast-rating__summary > span { white-space: nowrap; }
.toast-rating__summary b { font-size: clamp(38px, 4vw, 52px); line-height: 1; font-weight: 650; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.toast-rating__summary small { font-size: 22px; margin-left: 3px; }
.toast-rating[data-grade="good"] .toast-rating__summary { color: #876d2f; }
.toast-rating[data-grade="close"] .toast-rating__summary { color: #936246; }
.toast-rating__metric { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--ink-soft); }
.toast-rating__metric strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.toast-rating > progress { display: block; width: 100%; height: 4px; margin: 7px 0 14px; accent-color: var(--kaya); }
.kaya-game progress { appearance: none; -webkit-appearance: none; border: 0; border-radius: 2px; overflow: hidden; background: #32422f20; }
.kaya-game progress::-webkit-progress-bar { background: #32422f20; }
.kaya-game progress::-webkit-progress-value { background: var(--kaya); }
.kaya-game progress::-moz-progress-bar { background: var(--kaya); }
@media (max-width: 680px) {
  .play-layout { grid-template-columns: minmax(0, 1fr) 72px; gap: 20px 14px; padding: 16px; }
  .game-heading { grid-template-columns: 1fr; gap: 8px; }
  .game-heading p { text-align: left; }
  .stage { aspect-ratio: 3 / 4; min-height: 300px; }
  .start-overlay { width: 84%; gap: 20px; }
  .stage-toolbar { inset: 9px 10px auto; font-size: 9px; }
  .stage-toolbar button { min-height: 30px; }
  .stage-message { bottom: 14px; }
  .recipe { gap: 24px; padding: 0; }
  .recipe li { font-size: 9px; text-align: center; }
  .recipe canvas { width: 44px; height: 21px; }
  .control-panel { display: contents; }
  .recipe { grid-column: 2; grid-row: 2; }
  .toast-rating, .error, .actions { grid-column: 1 / -1; }
  .status p { font-size: 14px; }
  .actions { margin-top: 20px; }
  .hold-progress { top: 12px; inset-inline: 24%; padding: 6px 10px; }
  .hold-progress strong { font-size: 22px; }
  .hold-progress span { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { .kaya-game * { transition: none !important; } }

/* Handwritten typography belongs only to the green game panel. */
.kaya-game .play-layout { font-family:'Patrick Hand', cursive; font-weight:400; }
.kaya-game .play-layout :is(h2,strong,b,button) { font-family:'Patrick Hand', cursive; font-weight:400; }
.kaya-game .play-layout .status h2 { font-size:clamp(25px,2.5vw,34px); letter-spacing:0; }
.kaya-game .play-layout .status p { font-size:19px; }
.kaya-game .play-layout .recipe li { font-size:15px; }
.kaya-game .play-layout :is(.start-overlay button,.actions button) { font-size:17px; letter-spacing:0; }
.kaya-game .play-layout :is(.toast-rating__label,.toast-rating__metric,.hold-progress span) { font-size:15px; }
@media(max-width:680px) {
 .kaya-game .play-layout .status h2 { font-size:25px; }
 .kaya-game .play-layout .status p { font-size:17px; }
 .kaya-game .play-layout .recipe li { font-size:12px; }
}

.kaya-logo { display:block; width:240px; max-width:100%; height:150px; object-fit:cover; object-position:center 53%; }
.stage[data-phase="won"] .stage-message { top:50%; bottom:auto; transform:translateY(-50%); display:flex; flex-direction:column; align-items:center; gap:12px; padding:20px 28px; }

.kaya-game .play-layout .start-overlay button { font-size:19px; }

.end-controls { position:absolute; z-index:3; bottom:7%; left:50%; transform:translateX(-50%); display:flex; flex-direction:column; align-items:center; gap:12px; text-align:center; width:min(80%,280px); padding:16px; border-radius:6px; background:#eef2e6ed; }
.end-controls[hidden],.stage-resume[hidden] { display:none; }
.end-controls .kaya-logo { width:200px; height:125px; }
.end-controls p { margin:0; font-size:28px; line-height:1.1; }
.end-controls p:empty { display:none; }
.end-controls button,.stage-resume { min-height:42px; padding:8px 22px; border-radius:3px; font-size:19px; }
.stage-resume { position:absolute; bottom:12%; left:50%; transform:translateX(-50%); }

.kaya-game .recipe { margin-top:8px; }
.stage { touch-action:none; }
@media(max-width:680px) {
 .play-layout { grid-template-columns:minmax(0,1fr); padding:12px; }
 .recipe { grid-column:1; grid-row:auto; grid-template-columns:repeat(6,minmax(0,1fr)); gap:4px; }
 .kaya-game .play-layout .recipe li { font-size:10px; }
 .recipe canvas { width:36px; height:20px; }
 .stage { aspect-ratio:4/3; min-height:0; }
 .start-overlay { gap:8px; transform:translate(-50%,-50%); }
 .start-overlay .kaya-logo { width:140px; height:88px; }
 .start-overlay button { min-height:40px; }
 .end-controls { bottom:5%; padding:10px; gap:6px; }
 .end-controls .kaya-logo { width:120px; height:75px; }
}
