/* Hermetic skin: manga panel, screentone, cobalt (tokens from 07-agent-identity.md). Scoped to .hm. */
.hm {
  --sk-surface: #FFFFFF; --sk-stage: #FFFFFF; --sk-line: #14130F; --sk-well: #FFFFFF;
  --sk-tone: rgba(20, 19, 15, .16); --sk-frame: #14130F; --sk-limit: #0B3FCF;
  --sk-cell: #FFFFFF; --sk-mark: #1C1B24; --sk-live: #0B3FCF; --sk-live-mark: #FFFFFF;
  --sk-dump: #E4E4E6; --sk-accent: #0B3FCF; --sk-accent-ink: #FFFFFF;
  --hm-ink: #14130F; --hm-muted: #413D35; --hm-meta: #5C574D; --hm-card: #F5F5F6; --hm-hover: #E4E4E6;
  --hm-sans: 'Sohne', 'Instrument Sans', system-ui, sans-serif;
  --hm-mono: 'Array', ui-monospace, 'SF Mono', Menlo, monospace;
  --hm-tile: min(30vw, 150px);
  box-sizing: border-box; width: 100%; max-width: 980px; margin: 0 auto; padding: 12px 16px 24px;
  font-family: var(--hm-sans); color: var(--hm-ink); font-size: 16px; line-height: 1.5;
  display: grid; grid-template-columns: 1fr; grid-template-areas: "stage" "main"; gap: 10px;
}
.hm *, .hm *::before, .hm *::after { box-sizing: border-box; }
.hm [hidden] { display: none !important; }
.hm :focus-visible { outline: 3px solid var(--sk-accent); outline-offset: 3px; }
.hm .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Stage: mascot and speech balloon. Sits beside the board on desktop, above it on phones. */
.hm-stage { grid-area: stage; position: relative; display: flex; flex-direction: row-reverse; align-items: center; gap: 10px; min-height: 64px;
  background: var(--sk-stage); background-image: radial-gradient(var(--sk-tone) 1px, transparent 1.4px); background-size: 6px 6px;
  border: 3px solid var(--sk-frame); padding: 6px 10px; }
.hm-mascot { flex: 0 0 56px; width: 56px; height: 56px; }
.hm-sprite, .hm-sprite svg, .hm-sprite img { display: block; width: 100%; height: 100%; }
.hm-bubble { position: relative; flex: 1 1 auto; margin: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 6px 18px; background: #fff; border: 2px solid var(--hm-ink); border-radius: 50%/60%; font-size: 14px; line-height: 1.25; }
.hm-bubble::after { content: ''; position: absolute; left: -9px; top: 50%; width: 14px; height: 14px; background: #fff; border-bottom: 2px solid var(--hm-ink); border-left: 2px solid var(--hm-ink); transform: translateY(-50%) rotate(45deg); }
.hm-sprite .hm-happy-eyes { display: none; }
.hm-sprite.is-happy .f-eyes { display: none; }
.hm-sprite.is-happy .hm-happy-eyes { display: inline; }
.hm-sprite.is-hop { animation: hm-hop .5s steps(4) 2; }
.hm-sprite.is-shake { animation: hm-shake .3s steps(3) 2; }
@keyframes hm-hop { 50% { transform: translateY(-8px); } }
@keyframes hm-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.hm-main { grid-area: main; min-width: 0; }
.hm-screen { background: var(--sk-surface); border: 4px solid var(--sk-frame); outline: 1px solid var(--hm-ink); outline-offset: -9px; padding: 20px 20px; }
.hm-title { margin: 0 0 8px; font-size: clamp(26px, 6vw, 40px); font-weight: 600; letter-spacing: -.04em; line-height: 1.08; }
.hm-title:focus { outline: none; }
.hm-goal { margin: 0 0 8px; font-size: 18px; max-width: 56ch; }
.hm-onboard { margin: 8px 0; padding-left: 22px; }
.hm-onboard li { margin: 2px 0; }
.hm-abilities { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.hm-abilities li { font-size: 15px; line-height: 1.4; padding: 8px 10px; background: var(--hm-card); border: 1px solid var(--hm-ink); }
.hm-note { margin: 6px 0; font-size: 14px; line-height: 1.4; color: var(--hm-meta); }
.hm-label { font-family: var(--hm-mono); font-size: 12px; letter-spacing: .04em; display: block; color: var(--hm-ink); }

.hm-btn { font-family: var(--hm-sans); font-size: 16px; font-weight: 500; color: var(--hm-ink); background: var(--hm-card); border: 1px solid var(--hm-ink); padding: 10px 18px; min-height: 48px; min-width: 48px; cursor: pointer; box-shadow: 3px 3px 0 var(--hm-ink); margin: 6px 6px 6px 0; }
.hm-btn:hover { background: var(--hm-hover); }
.hm-btn:active { box-shadow: 1px 1px 0 var(--hm-ink); transform: translate(2px, 2px); }
.hm-btn--primary { background: var(--sk-accent); color: var(--sk-accent-ink); }
.hm-btn--primary:hover { background: #0A36B3; }
.hm-btn--small { font-size: 14px; padding: 6px 12px; }
.hm-btn[aria-pressed='true'] { background: var(--hm-hover); outline: 2px solid var(--hm-ink); outline-offset: -2px; }
.hm-btn[aria-disabled='true'] { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* HUD */
.hm-play { display: grid; gap: 10px; grid-template-columns: 1fr; position: relative; }
.hm-hud { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.hm-stat { min-width: 0; }
.hm-val { display: block; font-family: var(--hm-mono); font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-tally { letter-spacing: .04em; font-size: 14px; }
.hm-meter { height: 12px; border: 2px solid var(--hm-ink); background: #fff; }
.hm-meter__fill { display: block; height: 100%; width: 100%; background: var(--sk-limit); }

/* Board: six manga panels in a 3 by 2 page with a white gutter. */
.hm-boardwrap { position: relative; justify-self: center; width: 100%; }
.hm-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; background: #fff; border: 4px solid var(--sk-frame); }
.hm-tile { position: relative; aspect-ratio: 1 / 1; min-height: 72px; padding: 0; margin: 0; display: grid; place-items: center; cursor: pointer; color: var(--sk-mark);
  background: var(--sk-cell); background-image: radial-gradient(var(--sk-tone) 1px, transparent 1.5px); background-size: 7px 7px;
  border: 3px solid var(--hm-ink); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px var(--hm-ink); font: inherit; }
.hm-tile:focus-visible { outline: 3px solid var(--sk-accent); outline-offset: 3px; z-index: 2; }
.hm-board:not(.is-input) .hm-tile { cursor: default; }
.hm-board.is-input .hm-tile:hover { background-color: var(--hm-hover); }
.hm-mark { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 3.6; overflow: visible; }
.hm-mark path[data-fill] { fill: currentColor; stroke-width: 2.6; }
.hm-pupil { fill: currentColor; stroke: none; }
.hm-num { position: absolute; left: 8px; top: 6px; font-family: var(--hm-mono); font-size: 13px; line-height: 1; padding: 2px 5px; background: #fff; border: 1px solid var(--hm-ink); color: var(--hm-ink); }

/* Lit: cobalt fill, white mark, speed lines, heavier frame and a notch badge. Not colour alone. */
.hm-tile.is-lit { background-color: var(--sk-live); background-image: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.28) 0 4deg, transparent 4deg 12deg); color: var(--sk-live-mark); border-width: 5px; transform: scale(1.04); z-index: 1; }
.hm-tile.is-lit .hm-num { background: var(--hm-ink); color: #fff; border-color: #fff; }
.hm-tile.is-miss { border-style: dashed; border-width: 5px; background-color: #fff; background-image: repeating-linear-gradient(45deg, rgba(20,19,15,.3) 0 2px, transparent 2px 8px); }

.hm-cover { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px; text-align: center; background: #fff; border: 4px solid var(--sk-frame); background-image: radial-gradient(var(--sk-tone) 1px, transparent 1.5px); background-size: 7px 7px; }
.hm-cover__text { margin: 0; font-weight: 600; font-size: 17px; background: #fff; padding: 2px 8px; }
.hm-cover__actions { display: flex; flex-wrap: wrap; justify-content: center; }

.hm-dots { display: flex; flex-wrap: wrap; gap: 4px; min-height: 14px; }
.hm-dot { width: 12px; height: 12px; border: 2px solid var(--hm-ink); background: #fff; }
.hm-dot.is-done { background: var(--hm-ink); }
.hm-status { margin: 0; min-height: 1.5em; font-family: var(--hm-mono); font-size: 14px; }
.hm-side { display: flex; flex-wrap: wrap; align-items: center; }
.hm-power { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.hm-power__name { font-weight: 600; }
.hm-power__state { font-family: var(--hm-mono); font-size: 12px; }
.hm-power.is-ready { background: var(--sk-accent); color: var(--sk-accent-ink); }
.hm-keys { display: none; }

/* Over */
.hm-bigscore { margin: 0; font-family: var(--hm-mono); font-size: clamp(36px, 9vw, 64px); line-height: 1.1; }
.hm-overlist { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.hm-overlist strong { font-family: var(--hm-mono); font-size: 20px; font-weight: 400; }
.hm-share { width: 100%; max-width: 560px; display: block; font: 14px/1.4 var(--hm-sans); padding: 8px; border: 1px solid var(--hm-ink); background: var(--hm-card); color: var(--hm-ink); resize: none; margin: 8px 0; }
.hm-actions { display: flex; flex-wrap: wrap; }

@media (min-width: 720px) {
  .hm { grid-template-columns: 230px minmax(0, 1fr); grid-template-areas: "stage main"; align-items: start; }
  .hm-stage { flex-direction: column-reverse; align-items: stretch; gap: 14px; padding: 14px; min-height: 0; }
  .hm-mascot { flex: none; width: 180px; height: 180px; align-self: center; }
  .hm-bubble { min-height: 64px; padding: 10px 22px; font-size: 15px; }
  .hm-bubble::after { left: 50%; top: -9px; border: 0; border-top: 2px solid var(--hm-ink); border-left: 2px solid var(--hm-ink); transform: translateX(-50%) rotate(45deg); }
  .hm-board { gap: 14px; padding: 14px; }
  .hm-val { font-size: 20px; }
  .hm-keys { display: block; }
  .hm-boardwrap { max-width: 560px; justify-self: center; }
}
@media (max-width: 400px) {
  .hm { padding-left: 16px; padding-right: 16px; }
  .hm-screen { padding: 14px; }
  .hm-val { font-size: 15px; }
  .hm-tally { font-size: 12px; }
  .hm-board { gap: 8px; padding: 8px; }
}
.hm-reduced .hm-sprite, .hm-reduced .hm-tile, .hm-reduced .hm-btn { animation: none !important; transition: none !important; }
.hm-reduced .hm-tile.is-lit { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .hm-sprite, .hm-tile, .hm-btn { animation: none !important; transition: none !important; }
  .hm-tile.is-lit { transform: none; }
}
@media (forced-colors: active) {
  .hm-tile.is-lit { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
