/* Shared look for the game and the minigames: the approved storybook palette from the art sample. */
@font-face { font-family: "WenKai"; src: url("../assets/fonts/wenkai.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "WenKai"; src: url("../assets/fonts/wenkai-medium.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --paper: #f6efe1;
  --paper-2: #efe5d0;
  --paper-3: #e6d8bc;
  --card: #fbf7ee;
  --ink: #3b2c20;
  --ink-2: #6d5847;
  --ink-3: #9a8571;
  --line: rgba(92, 64, 40, .22);
  --moss: #6e9a5a;
  --moss-2: #4f7440;
  --coral: #d9725a;
  --coral-2: #b9573f;
  --teal: #4f9a93;
  --sand: #e3b56c;
  --gold: #e7a83e;
  --night: #1d2a4a;
  --wood: #9b6a42;
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 24px -14px rgba(70, 45, 20, .45), 0 2px 6px -2px rgba(70, 45, 20, .25);
  --font: "WenKai", "LXGW WenKai", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.7 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn {
  border: 1px solid rgba(110, 80, 50, .28); background: #fffaf0; color: var(--ink); border-radius: 12px; padding: 7px 16px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(110, 80, 50, .18); transition: transform .08s, box-shadow .08s, background .2s; font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--coral); color: #fff8ef; border-color: var(--coral-2); box-shadow: 0 2px 0 var(--coral-2); }
.btn.primary:hover { background: #e07d65; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.paper {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid rgba(120, 85, 50, .16);
}

/* minigame frame: the shell puts intro/result cards over the play area */
.mg-host { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 16px; background: #222; touch-action: none; user-select: none; -webkit-user-select: none; }
.mg-host canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mg-hud { position: absolute; left: 12px; right: 12px; top: 10px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; z-index: 2;
  font-size: 15px; color: #fff8ea; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.mg-bar { position: absolute; left: 12px; right: 12px; bottom: 10px; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .25); overflow: hidden; z-index: 2; pointer-events: none; }
.mg-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f3c26b, #e7a83e); border-radius: inherit; transition: width .1s linear; }
.mg-card { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 18px; background: rgba(30, 22, 14, .35); }
.mg-card .paper { max-width: 380px; width: 100%; padding: 18px 20px; text-align: center; }
.mg-card h3 { margin: 0 0 6px; font-size: 22px; }
.mg-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.mg-card img { width: 120px; height: 120px; object-fit: contain; margin: 0 auto 6px; display: block; }
.mg-float { position: absolute; z-index: 3; pointer-events: none; font-size: 18px; color: #fff8ea; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); transform: translate(-50%, -50%); animation: mgfloat 1s ease-out forwards; }
@keyframes mgfloat { to { transform: translate(-50%, -150%); opacity: 0; } }
