* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; color: #2A2F5A; background: #A7B3C6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; }
.hide { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(ellipse at 50% 35%, #DCE2EB 0%, #B9C4D4 55%, #9DABC0 100%); }
button { font: inherit; border: 0; cursor: pointer; }

/* 首页 */
#home { align-items: center; justify-content: space-evenly; gap: 22px; }
.hero { text-align: center; }
.logo { margin: 0; font-size: 60px; font-weight: 900; letter-spacing: 4px; color: #262B5C;
  text-shadow: 0 2px 0 #fff, 0 6px 10px rgba(30,40,90,.3); }
.slogan { margin: 10px 0 0; font-size: 18px; color: #4A5172; letter-spacing: 3px; }
.pick { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.dbtn { position: relative; height: 72px; border-radius: 36px; display: flex; align-items: center; justify-content: center;
  padding: 0 24px; font-size: 22px; font-weight: 800;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), inset 0 -4px 0 rgba(0,0,0,.12), 0 6px 14px rgba(40,50,90,.25); }
.dbtn:active { transform: translateY(2px) scale(.99); }
.dbtn .dl b { margin-right: 22px; }
.dbtn em { position: absolute; right: 18px; bottom: 6px; font-style: normal; font-size: 11px; font-weight: 600; opacity: .8; }
.dbtn.easy { color: #fff; background: linear-gradient(90deg, #6EA6E2, #A57DEB); border: 3px solid #8FB5EA;
  text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.dbtn.medium { color: #2A2F5A; background: linear-gradient(90deg, #F8DC86, #F3C95E); border: 3px solid #F9E3A0; }
.dbtn.hard { color: #3A2B4A; background: linear-gradient(90deg, #DC4545, #F1903D); border: 3px solid #EE7A60; }
.howto { position: relative; width: 100%; max-width: 420px; margin-top: 14px; padding: 22px 26px; border-radius: 22px;
  background: rgba(236,240,246,.72); border: 2px solid rgba(255,255,255,.8); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); box-shadow: 0 8px 20px rgba(40,50,90,.15); display: flex; flex-direction: column; gap: 18px; }
.howto::before { content: ''; position: absolute; top: -16px; left: 50%; margin-left: -16px; border: 16px solid transparent;
  border-top: 0; border-bottom-color: rgba(255,255,255,.85); }
.howto .row { display: flex; align-items: center; gap: 18px; font-size: 19px; font-weight: 600; color: #2A2F45; }
.ico { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; flex: none; box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 3px 6px rgba(0,0,0,.15); }
.ico.blue { background: #BCDDF6; color: #6C9CC8; }
.ico.yellow { background: #F6D35A; color: #3A3320; }
.ico.red { background: #E2464A; color: #fff; }

/* 游戏页 */
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 34px; min-height: 64px;
  background: linear-gradient(180deg, #E4E9F0, #C9D2DE); border: 2px solid rgba(255,255,255,.75);
  box-shadow: 0 4px 12px rgba(40,50,90,.2); }
.stat { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 26px; font-weight: 800; color: #1E2232; }
.stat .mp-icon { font-size: 30px; color: #555E70; }
.redflag { width: 22px; height: 26px; position: relative; display: inline-block; }
.redflag::before { content: ''; position: absolute; left: 2px; top: 0; width: 3px; height: 26px; background: #C9A23A; border-radius: 2px; }
.redflag::after { content: ''; position: absolute; left: 5px; top: 1px; width: 17px; height: 13px; background: #E32B2B;
  clip-path: polygon(0 0, 100% 50%, 0 100%); }
.round { width: 48px; height: 48px; border-radius: 50%; flex: none; background: linear-gradient(180deg, #F2F4F8, #D3D9E3);
  border: 2px solid #fff; color: #222; font-size: 15px; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.2); padding: 0; }
.round .mp-icon { font-size: 24px; }
.round:active { transform: scale(.94); }
.boardwrap { flex: 1; overflow: auto; display: flex; margin: 16px 0; -webkit-overflow-scrolling: touch; }
#board { display: grid; gap: 4px; margin: auto; padding: 10px; background: #DDE2E9; border-radius: 12px;
  border: 3px solid #F2F4F7; box-shadow: 0 6px 16px rgba(40,50,90,.25), inset 0 0 0 1px #BFC7D2; touch-action: manipulation; }
.c { position: relative; border-radius: 6px; background: linear-gradient(180deg, #FBF8F0, #EFEADC);
  box-shadow: inset 0 2px 0 #fff, inset 0 -2px 0 rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.18);
  display: flex; align-items: center; justify-content: center; font-weight: 800; user-select: none; -webkit-user-select: none; line-height: 1; }
.c.open { background: linear-gradient(180deg, #DADFE6, #CED4DD); box-shadow: inset 0 1px 2px rgba(0,0,0,.12); }
.c.flag::before { content: ''; position: absolute; left: 32%; top: 18%; width: 8%; height: 66%; background: #B88A20; border-radius: 2px; }
.c.flag::after { content: ''; position: absolute; left: 38%; top: 20%; width: 40%; height: 34%;
  background: linear-gradient(180deg, #FFE066, #F2C21E); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.c.mine { background: #6B7385; box-shadow: none; }
.c.mine::after { content: ''; width: 46%; height: 46%; background: #1E2232; border-radius: 50%; box-shadow: 0 0 0 3px rgba(30,34,50,.3); }
.c.mine::before { display: none; }
.c.boom { background: #E2464A; }
.c.wrong { background: #B3A79A; }
.n1 { color: #1F63D6; } .n2 { color: #3FA33A; } .n3 { color: #D9332B; } .n4 { color: #5E35B1; }
.n5 { color: #8D3B1A; } .n6 { color: #00897B; } .n7 { color: #333; } .n8 { color: #777; }
.hint { flex: none; min-height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #2A2F45; letter-spacing: 2px;
  background: linear-gradient(180deg, #E6EAF0, #D4DAE3); border: 2px solid rgba(255,255,255,.8); box-shadow: 0 4px 10px rgba(40,50,90,.15); }
.shake { animation: sh .3s; } @keyframes sh { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* 结算 */
#modal { position: fixed; inset: 0; background: rgba(30,36,60,.5); display: flex; align-items: center; justify-content: center; padding: 24px; }
.box { width: 100%; max-width: 320px; background: #EEF1F6; border-radius: 26px; padding: 26px 22px 22px; text-align: center;
  display: flex; flex-direction: column; gap: 10px; border: 2px solid #fff; box-shadow: 0 12px 30px rgba(20,30,60,.35); }
.box h2 { margin: 0; font-size: 28px; color: #262B5C; }
.box p { margin: 0; font-size: 17px; color: #4A5172; } .box p b { font-size: 22px; color: #262B5C; }
.pbtn { min-height: 52px; border-radius: 26px; font-size: 18px; font-weight: 800; color: #fff; margin-top: 6px;
  background: linear-gradient(90deg, #6EA6E2, #A57DEB); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 4px 10px rgba(40,50,90,.25); }
.pbtn.alt { background: #fff; color: #4A5172; }
.pbtn:active { transform: translateY(2px); }
#result-stars { display: flex; justify-content: center; gap: 6px; }
#result-stars .mp-icon { font-size: 44px; color: #F3C21E; } #result-stars .off { color: #C9CFD9; }
