/* cat: page-specific styles (shared look lives in /tool.css). Pixel-art treatment: square corners, hard 2-4px borders, stepped bars. */
.stage {
  margin: 0 0 .9rem; border-radius: 0; overflow: hidden;
  border: 4px solid #3a2014; box-shadow: 0 4px 0 #3a2014;
  background: var(--surface); line-height: 0;
}
.scene {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
/* sprites: hard pixels, never smoothed (crisp-edges first as fallback, pixelated wins where supported) */
.scene image { image-rendering: crisp-edges; image-rendering: pixelated; }
.scene[data-phase="night"] #actors { filter: brightness(.8) saturate(.92); }
.scene[data-phase="sunset"] #actors { filter: brightness(.95) sepia(.12); }
.scene [data-hit] { cursor: pointer; }
.scene.playing { cursor: crosshair; }
.status {
  min-height: 2.6em; margin: 0 0 1rem; padding: .55rem .9rem; border-radius: 0;
  background: var(--surface); border: 2px solid var(--text); box-shadow: 3px 3px 0 var(--text);
  text-align: center; font-weight: 600; font-size: .95rem;
  color: var(--text); line-height: 1.5;
}
.panel { border-radius: 0; border: 2px solid var(--text); box-shadow: 3px 3px 0 var(--line); }
.meters { display: grid; gap: .85rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.meter-head { display: flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 600; margin-bottom: .3rem; }
.meter-head .mi { flex: none; }
.meter-label { flex: 1; }
.meter-val { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.meter-label { color: var(--text); }
/* stepped stat bar: 10 hard segments cut out of the fill */
.meter-bar { position: relative; height: 14px; border-radius: 0; background: var(--bg); border: 2px solid var(--text); overflow: hidden; }
.meter-bar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 2px), var(--bg) calc(10% - 2px), var(--bg) 10%);
}
.meter-fill { display: block; height: 100%; width: 0; border-radius: 0; transition: width .4s steps(5, end); }
.m-full { color: #e08a2e; }
.m-full .meter-fill { background: #e98a3a; }
.m-mood { color: #e5577f; }
.m-mood .meter-fill { background: #ee5f88; }
.m-energy { color: #3f9b52; }
.m-energy .meter-fill { background: #4cb35f; }
.m-love { color: #8a63d2; }
.m-love .meter-fill { background: #8a63d2; }
.meter.low .meter-val { color: var(--accent); }
.actions .btn {
  flex: 1 1 8rem; text-align: center; padding: .75rem 1rem; font-size: 1.02rem; border-radius: 0;
  border: 2px solid var(--text); box-shadow: 0 4px 0 var(--text);
}
.actions .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--text); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chips { border: 0; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips legend { padding: 0; margin: 0 0 .5rem; }
.chip { position: relative; margin: 0; font-weight: 600; cursor: pointer; display: inline-flex; }
.chip input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip > span {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 0;
  border: 2px solid var(--line); background: var(--bg); font-size: .92rem;
}
.chip input:checked + span { border-color: var(--text); background: var(--surface); box-shadow: 3px 3px 0 var(--accent); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
input#c-name { border-radius: 0; border: 2px solid var(--text); }
@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } .actions .btn:active { transform: none; } }

/* ---- housing: coins, shop, edit mode */
[hidden] { display: none !important; }
.coin-ico { display: inline-flex; width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.coin-ico svg, .price svg { width: 16px; height: 16px; display: block; }
.tools { display: flex; align-items: center; gap: .75rem; margin: 0 0 .75rem; flex-wrap: wrap; }
.tools .btn { padding: .55rem 1.1rem; border-radius: 0; border: 2px solid var(--text); box-shadow: 0 3px 0 var(--text); font-weight: 700; }
.tools .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--text); }
.coin-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 2px solid var(--text); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.coin-pill.bump { animation: coin-bump .45s steps(3, end); }
@keyframes coin-bump { 0% { transform: translateY(0); } 33% { transform: translateY(-4px); } 66% { transform: translateY(-2px); } 100% { transform: translateY(0); } }
.m-coin .meter-val { color: var(--text); }
.coin-sub { margin: .1rem 0 0; font-size: .8rem; color: var(--muted); }
.scene.editing { cursor: move; outline: 3px dashed #e0306a; outline-offset: -3px; }
.scene.editing #actors, .scene.editing #food { pointer-events: none; }
.scene .furn { pointer-events: none; }
.scene.editing .furn { pointer-events: auto; cursor: grab; }
.edit-bar { margin: 0 0 .9rem; padding: .7rem .8rem; border: 2px solid var(--text); background: var(--surface); box-shadow: 3px 3px 0 var(--line); }
.edit-hint { margin: 0 0 .55rem; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.edit-sel { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 0 0 .6rem; padding: .45rem .5rem; border: 2px solid #e0306a; }
.edit-sel strong { margin-right: .3rem; }
.btn.sm { padding: .4rem .7rem; font-size: .85rem; border-radius: 0; border: 2px solid var(--text); box-shadow: 0 2px 0 var(--text); }
.btn.sm:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--text); }
.tray { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.tile { display: grid; grid-template-rows: 52px auto; justify-items: center; gap: .15rem; width: 5.2rem; padding: .35rem .3rem; border: 2px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: .78rem; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; }
.tile:hover, .tile:focus-visible { border-color: var(--text); }
.tile .thumb { width: 100%; height: 52px; display: block; }
.tile .thumb svg, .card .thumb svg { width: 100%; height: 100%; display: block; }
.tile .tn { font-weight: 600; line-height: 1.2; text-align: center; }
.tile .tc { position: absolute; right: 2px; top: 0; font-weight: 700; font-size: .75rem; background: var(--surface); padding: 0 .2rem; }
.edit-empty { margin: 0; font-size: .85rem; color: var(--muted); }
.ghost { position: fixed; width: 72px; height: 56px; margin: -28px 0 0 -36px; pointer-events: none; z-index: 50; opacity: .85; }
.ghost svg { width: 100%; height: 100%; display: block; }
.shop-coins { margin: 0 0 .7rem; font-weight: 600; }
.shop-msg { min-height: 1.4em; margin: 0 0 .6rem; font-size: .88rem; font-weight: 600; }
.shop { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.card { display: grid; grid-template-columns: 76px 1fr; grid-template-areas: "thumb info" "buy buy"; gap: .35rem .65rem; padding: .55rem; border: 2px solid var(--line); background: var(--bg); }
.card .thumb { grid-area: thumb; width: 76px; height: 64px; background: var(--surface); border: 2px solid var(--line); padding: 3px; box-sizing: border-box; }
.card .info { grid-area: info; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.card .nm { font-size: .98rem; }
.card .meta { font-size: .76rem; color: var(--muted); line-height: 1.4; }
.card .own { font-size: .78rem; font-weight: 600; color: #3f9b52; }
.card .buy { grid-area: buy; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.price { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .btn.short { opacity: .55; }
@media (prefers-reduced-motion: reduce) { .coin-pill.bump { animation: none; } }
