* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #2a1a3e; font-family: system-ui, sans-serif; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

#overlay { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 10, 35, .68); backdrop-filter: blur(4px); pointer-events: auto;
  animation: fadein .25s ease; }
.hidden { display: none !important; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

.panel { background: linear-gradient(165deg, #fdf3dc, #f2ddb2); border-radius: 22px; padding: 30px 26px;
  width: min(85vw, 340px); text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.5), inset 0 0 0 3px #c8a05a;
  color: #4a2c14; max-height: calc(100dvh - 24px); overflow-y: auto; }
.panel.wide { width: min(92vw, 420px); max-height: 84vh; overflow-y: auto; }
.panel h1, .panel h2 { margin-bottom: 10px; }
.panel p { margin: 8px 0 16px; font-size: 14px; color: #7a5836; line-height: 1.6; }
.panel .tiny { font-size: 12px; opacity: .7; margin-top: 12px; margin-bottom: 0; }

.logo { font-size: 36px; letter-spacing: 0; line-height: 1.05; color: #5b2d8e;
  text-shadow: 0 2px 0 #f9e9c8, 0 4px 0 rgba(91,45,142,.25); margin-top: 6px; }
.slogan { font-size: 13px; }
.logo-gourd { width: 96px; height: 116px; margin: 0 auto; }
.logo-gourd canvas { width: 100%; height: 100%; }

.btn { display: block; width: 100%; margin: 10px 0; padding: 13px 8px; font-size: 16px; font-weight: 700;
  color: #4a2c14; background: linear-gradient(180deg, #ffe9ad, #f5c96b); border: none; border-radius: 14px;
  box-shadow: 0 4px 0 #c8973f, 0 6px 12px rgba(0,0,0,.18); cursor: pointer; transition: transform .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c8973f; }
.btn-main { background: linear-gradient(180deg, #b98ef0, #8b5cd6); color: #fff; box-shadow: 0 4px 0 #5d3a99, 0 6px 12px rgba(0,0,0,.25); }
.btn-main:active { box-shadow: 0 1px 0 #5d3a99; }

.stars { font-size: 40px; letter-spacing: 6px; margin: 6px 0; min-height: 48px; }
.stars .dim { opacity: .25; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 18px; }
.cell { background: rgba(255,255,255,.55); border-radius: 12px; padding: 8px 4px 6px; font-size: 11px; color: #6a4a26; }
.cell canvas { width: 52px; height: 52px; }
.cell.locked { filter: grayscale(1); opacity: .45; }
.cell .cnt { font-weight: 700; }
.cell.boss-cell { grid-column: span 2; background: rgba(120,80,200,.18); }
.vol-title { grid-column: 1 / -1; text-align: left; font-weight: 800; color: #5b2d8e;
  font-size: 15px; margin-top: 8px; border-bottom: 2px solid rgba(91,45,142,.25); padding-bottom: 4px; }
.cell.mystery { background: rgba(60,40,80,.28); color: #8a7a9a; filter: none; opacity: 1; }

#toast { position: fixed; left: 50%; top: 16%; transform: translateX(-50%); background: rgba(30,16,50,.88);
  color: #ffe9ad; padding: 10px 22px; border-radius: 30px; font-size: 15px; font-weight: 700; z-index: 30;
  pointer-events: none; width: max-content; max-width: min(90vw, 560px); text-align: center; line-height: 1.4;
  white-space: normal; box-shadow: 0 6px 20px rgba(0,0,0,.4); transition: opacity .3s; }

@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
