* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 50% 20%, #f3e9d3 0%, #dfcda9 70%, #cfb88f 100%);
  color: #3b2a1c; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
#app { height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
header { display: flex; align-items: center; gap: 10px; }
.card { background: #fbf6ea; padding: 3px; border-radius: 5px; box-shadow: 0 2px 6px rgba(60,40,20,.25); transform: rotate(-3deg); transition: transform .25s; }
.card canvas { display: block; width: 36px; height: 42px; image-rendering: pixelated; }
.card.big { transform: scale(3) translate(14px, 18px); position: relative; z-index: 5; }
.card.none { visibility: hidden; }
.title { flex: 1; text-align: left; padding: 2px 4px; border-radius: 8px; }
.title:active { background: rgba(255,250,238,.5); }
.sub { font-size: 12px; opacity: .6; }
#name { font-size: 18px; font-weight: 600; }
#remain { margin-left: 8px; font-size: 13px; opacity: .65; white-space: nowrap; }
#remain b { font-size: 15px; }
.tools { display: flex; gap: 3px; }
.tool { width: 33px; height: 34px; border-radius: 10px; background: rgba(255,250,238,.75); box-shadow: 0 1px 3px rgba(60,40,20,.2); font-size: 18px; }
.tool:disabled { opacity: .35; }
#stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
#cv { display: block; touch-action: none; }
#tip { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 13px; opacity: .55; pointer-events: none; white-space: nowrap; }
#bottles { display: flex; justify-content: center; gap: 14px; min-height: 92px; align-items: flex-end; padding-top: 6px; }
.bottle { position: relative; width: 54px; height: 78px; transition: transform .18s; }
.bottle .neck { position: absolute; left: 50%; top: 0; width: 16px; height: 14px; transform: translateX(-50%); background: #8a5a32; border-radius: 3px 3px 0 0; }
.bottle .body { position: absolute; inset: 12px 0 0 0; border-radius: 15px 15px 11px 11px; background: rgba(255,255,255,.5); border: 2px solid rgba(80,55,30,.45); overflow: hidden; }
.bottle .liquid { position: absolute; left: 0; right: 0; bottom: 0; }
.bottle .vol { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; color: #fff; font-weight: 700; font-size: 15px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.bottle.sel { transform: translateY(-12px); }
.bottle.sel .body { border-color: #3b2a1c; box-shadow: 0 0 0 3px rgba(255,248,220,.9); }
.bottle.used { opacity: .25; }
/* 封口瓶：瓶口扎着红纸，只能倒一次；倒过以后盖上「封」字 */
.bottle.once .neck { background: #c8372d; height: 16px; border-radius: 4px 4px 0 0; box-shadow: 0 2px 0 #8e1f18; }
.bottle .seal { position: absolute; left: 50%; top: 26px; transform: translateX(-50%) rotate(-12deg); width: 26px; height: 26px; line-height: 24px; text-align: center; font-size: 15px; font-weight: 700; color: #fff; background: #c8372d; border: 2px solid #8e1f18; border-radius: 4px; opacity: 0; transition: opacity .2s; }
.bottle.once.used { opacity: .55; }
.bottle .onceTag { position: absolute; left: 50%; top: -15px; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #c8372d; white-space: nowrap; }
.bottle.once.used .onceTag { display: none; }
#tip.warn { opacity: 1; color: #b3261e; font-weight: 700; }
.bottle.once.used .seal { opacity: 1; }
.overlay { position: fixed; inset: 0; display: grid; place-items: end center; padding-bottom: 24px; background: rgba(40,28,16,.2); z-index: 10; }
.hidden { display: none; }
.panel { background: #fbf6ea; border-radius: 18px; padding: 18px 20px; min-width: 260px; text-align: center; box-shadow: 0 10px 30px rgba(40,28,16,.35); animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
#win { place-items: center; background: rgba(40,28,16,.45); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.ptitle { font-size: 19px; font-weight: 600; margin: 4px 0 12px; }
.row { display: flex; gap: 10px; justify-content: center; }
.big { padding: 11px 16px; border-radius: 12px; background: #eadcc0; font-size: 16px; }
.big.primary { background: #284f8f; color: #fff; }
#product { width: 120px; display: block; margin: 0 auto 8px; border-radius: 3px; box-shadow: 0 4px 12px rgba(60,40,20,.3); transform: rotate(-2deg); }
.saying { font-size: 13px; opacity: .6; margin-bottom: 12px; }

.tool.prop { position: relative; font-size: 17px; }
.badge { position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #b5432f; color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.badge.video { background: #3b2a1c; }
.big.video { background: #3b2a1c; color: #fff; }
.link { display: block; margin: 10px auto 0; opacity: .65; font-size: 14px; padding: 6px 10px; }
.stars { font-size: 32px; letter-spacing: 6px; color: #d9a62e; text-shadow: 0 2px 0 rgba(60,40,20,.2); margin-bottom: 6px; }
.stars .off { color: rgba(60,40,20,.2); }
#picker, #ad { place-items: center; background: rgba(40,28,16,.45); }
.bar { height: 8px; border-radius: 4px; background: #eadcc0; overflow: hidden; margin-top: 6px; }
#adBar { height: 100%; width: 0; background: #284f8f; }
#pickerRow .bottle { transform: none; }

/* 选关 */
#menu { place-items: center; background: rgba(40,28,16,.45); }
.panel.menu { width: min(92vw, 420px); max-height: 86vh; overflow-y: auto; }
#grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lv { background: #eadcc0; border-radius: 12px; padding: 6px 4px 4px; }
.lv .pic { position: relative; width: 60%; margin: 0 auto 3px; aspect-ratio: 6 / 7; background: #fbf6ea; border-radius: 3px; box-shadow: 0 1px 3px rgba(60,40,20,.25); display: grid; place-items: center; }
.lv .pic canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; opacity: .3; border-radius: 3px; }
.lv .pic.done canvas { opacity: 1; }
.lv .pic .lock { font-size: 18px; }
.lv .no { position: absolute; left: -6px; top: -5px; min-width: 20px; height: 20px; line-height: 20px; padding: 0 4px; border-radius: 10px; background: #3b2a1c; color: #fbf6ea; font-size: 12px; font-weight: 700; }
.lv .nm { font-size: 11px; opacity: .7; height: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lv .st { font-size: 12px; color: #d9a62e; letter-spacing: 1px; }
.lv .st .off { color: rgba(60,40,20,.2); }
.lv.cur { box-shadow: 0 0 0 2px #3b2a1c; }
.lv.locked { opacity: .4; }
