/* Same palette, type and card language as the other Hoodimong games (cream cards, stitch lines, round buttons). */
:root {
  --cream: #f6eee3;
  --paper: #fffaf3;
  --ink: #3b3029;
  --muted: #8b7d70;
  --line: #eadccb;
  --coral: #e8846a;
  --coral-dark: #c96a52;
  --gold: #e9b44c;
  --stitch: #e0c6a8;
  --shadow: 0 6px 18px rgba(92, 66, 40, .14);
  --head: "Jua", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --body: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream) url(assets/bg/bg_04_house_interior.jpg) center / cover no-repeat fixed;
  color: var(--ink);
  font: 15px/1.45 var(--body);
  overscroll-behavior: none;
  touch-action: manipulation;
}
body::before { content: ""; position: fixed; inset: 0; background: rgba(246, 238, 227, .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: -1; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

#app { max-width: 480px; height: 100dvh; margin: 0 auto; overflow: hidden; display: flex; flex-direction: column; padding: 10px 14px calc(10px + var(--safe-b)); gap: 8px; }

.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); display: grid; place-items: center; flex: none; }
.icon-btn img { width: 30px; height: 30px; }
.icon-btn:active { transform: scale(.94); }
.lang-btn { width: 40px; font: 15px/1 var(--head); color: var(--coral-dark); }
.sheet .lang-btn { width: 52px; }

.topbar { display: flex; align-items: center; gap: 8px; }
.brand { flex: 1; display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand b { font: 26px/1 var(--head); color: var(--coral-dark); }
.brand small { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.status { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #6d5a49; background: rgba(255, 250, 243, .85); border-radius: 14px; padding: 6px 12px; box-shadow: var(--shadow); min-height: 32px; }
.status b { font: 15px var(--head); color: var(--coral-dark); }
.status b.pop { animation: bump .4s ease; }
.legend { display: flex; justify-content: center; gap: 10px; background: rgba(255, 250, 243, .85); border-radius: 14px; padding: 4px 10px; box-shadow: var(--shadow); }
.legend span { display: flex; align-items: center; gap: 1px; font-size: 12px; color: #8a6a4c; }
.legend img { width: 26px; height: 26px; object-fit: contain; }

.stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; container-type: size; }
.board { display: grid; gap: 7px; width: min(100cqw, calc(100cqh * var(--cols) / var(--rows) * .75)); grid-template-columns: repeat(var(--cols), 1fr); }
.card { aspect-ratio: 3 / 4; perspective: 600px; position: relative; padding: 0; border-radius: 14px; }
.card .in { position: absolute; inset: 0; transition: transform .35s cubic-bezier(.3, .9, .4, 1.1); transform-style: preserve-3d; }
.card.up .in { transform: rotateY(180deg); }
.card .back, .card .front { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(92, 66, 40, .18); }
.card .back { background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .22) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .22) 0 5px, transparent 5px 10px), #e8a58f; }
.card .back::after { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(255, 255, 255, .75); border-radius: 10px; }
.card .back img { width: 42%; opacity: .9; filter: drop-shadow(0 2px 2px rgba(92, 66, 40, .25)); }
.card .front { transform: rotateY(180deg); background: var(--plate); }
.card .front::after { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(255, 255, 255, .7); border-radius: 10px; }
.card .front img { width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(92, 66, 40, .2)); }
.card.found .front { box-shadow: 0 0 0 3px var(--gold), 0 3px 8px rgba(92, 66, 40, .18); }
.card.found .in { animation: found .5s ease; }
.card.nope .in { animation: nope .4s ease; }
.card.hinted .back { box-shadow: 0 0 0 4px #9fc58a, 0 0 16px #9fc58a; animation: pulse .7s ease-in-out 3; }
.card:active .in { scale: .96; }
.banner { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 999px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); font: 16px var(--head); white-space: nowrap; }
.banner button { border: 0; background: linear-gradient(180deg, #ef977d, var(--coral)); color: #fff; font: 15px var(--head); border-radius: 999px; padding: 7px 14px; cursor: pointer; }

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 58px; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); font: 13.5px var(--head); color: #6d5a49; }
.tool img { width: 28px; height: 28px; object-fit: contain; }
.tool.friend img { width: 34px; height: 34px; margin-top: -6px; }
.tool:active { transform: scale(.96); }
.tool:disabled { opacity: .45; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.grid button { aspect-ratio: 1; border-radius: 14px; background: #fff3e2; font: 17px var(--head); color: #6d4f35; display: grid; place-items: center; line-height: 1; }
.grid button small { font-size: 9px; color: var(--gold); letter-spacing: -1px; }
.grid button.cur { box-shadow: 0 0 0 3px var(--coral); }
.grid button:disabled { opacity: .35; }
.stars { font-size: 30px; color: var(--gold); letter-spacing: 4px; }
@keyframes found { 0% { scale: 1; } 40% { scale: 1.1; } 100% { scale: 1; } }
@keyframes nope { 0%, 100% { translate: 0; } 30% { translate: -5px; } 70% { translate: 5px; } }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }

/* sheets, buttons, toast (as in the puzzle game) */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(59, 48, 41, .42); display: grid; place-items: end center; animation: fade .2s ease; }
.sheet { width: min(480px, 100%); background: var(--paper); border-radius: 28px 28px 0 0; padding: 18px 20px calc(20px + var(--safe-b)); box-shadow: 0 -8px 30px rgba(60, 40, 25, .25); animation: rise .28s cubic-bezier(.2, .9, .3, 1.1); text-align: center; max-height: 92dvh; overflow: auto; }
.sheet .eyebrow { font-size: 12px; letter-spacing: .5px; color: var(--muted); }
.sheet h2 { font: 26px/1.25 var(--head); margin: 4px 0 6px; }
.sheet p { margin: 6px 0; color: #5d4f44; }
.sheet .actor { display: flex; justify-content: center; align-items: flex-end; gap: 4px; min-height: 120px; margin: 4px 0; }
.sheet .actor img { width: 110px; }
.sheet .steps { text-align: left; margin: 10px 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sheet .steps li { background: #fff3e2; border-radius: 14px; padding: 8px 12px; font-size: 14px; color: #6d4f35; display: flex; gap: 8px; align-items: center; }
.sheet .steps img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.sheet .tip { background: #fff3e2; border-radius: 14px; padding: 8px 12px; font-size: 13.5px; color: #7a5a3c; }
.sheet .result { display: flex; justify-content: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.sheet .result span { background: #fff3e2; border-radius: 14px; padding: 6px 12px; font: 16px var(--head); display: flex; align-items: center; gap: 6px; }
.sheet .result img { width: 28px; height: 28px; object-fit: contain; }
.btn { width: 100%; height: 54px; border-radius: 18px; font: 21px var(--head); margin-top: 10px; }
.btn.primary { background: linear-gradient(180deg, #ef977d, var(--coral)); color: #fff; box-shadow: 0 5px 0 var(--coral-dark); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--coral-dark); }
.btn.ghost { background: #f3e8da; color: #6d5a49; }
.setting { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.switch { width: 52px; height: 30px; border-radius: 15px; background: #ddd0c0; position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--coral); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -140%); background: #3b3029; color: #fff; padding: 10px 16px; border-radius: 14px; z-index: 40; font-size: 14px; transition: transform .25s ease; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.08); } }
@keyframes ready { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.05); } }
@keyframes alarm { 50% { box-shadow: var(--shadow), 0 0 0 6px rgba(232, 132, 106, .35); } }
@keyframes cheer { 0% { transform: translateY(40%) scale(.6); opacity: 0; } 18% { transform: translateY(-6%) scale(1.04); opacity: 1; } 30% { transform: translateY(0) scale(1); } 80% { opacity: 1; } 100% { transform: translateY(20%) scale(.9); opacity: 0; } }

body.reduced *, body.reduced *::before, body.reduced *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
@media (max-height: 700px) { .friend .ring { width: 48px; height: 48px; } .friend .ring img { width: 40px; height: 40px; } .friend small { min-height: 0; } }
