:root { --accent: #ffb52e; --accent2: #45b8ff; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; color: #eef4ff;
  background: radial-gradient(ellipse at 50% 15%, #1d4a86 0%, #0f2346 55%, #08142a 100%) #0f2346;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; }
body { display: flex; flex-direction: column; }

header {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 8px 4px; flex: none;
  padding-top: calc(8px + env(safe-area-inset-top));
  padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right));
}
.stat {
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 181, 46, .3); border-radius: 10px;
  padding: 3px 10px; min-width: 58px; text-align: center; box-shadow: 0 0 12px rgba(255, 181, 46, .08) inset;
}
.stat .label { display: block; font-size: 10px; opacity: .72; text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 16px; color: #ffd36b; text-shadow: 0 0 8px rgba(255, 181, 46, .5); font-variant-numeric: tabular-nums; }
.stat.troops { border-color: rgba(69, 184, 255, .4); }
.stat.troops b { color: #8fd3ff; text-shadow: 0 0 8px rgba(69, 184, 255, .6); }
header button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px; padding: 8px 10px; font-size: 14px;
}

#wrap {
  flex: 1; min-height: 0; position: relative;
  padding: 2px 4px calc(6px + env(safe-area-inset-bottom));
  padding-left: calc(4px + env(safe-area-inset-left)); padding-right: calc(4px + env(safe-area-inset-right));
}
#cv {
  display: block; width: 100%; height: 100%; border-radius: 12px; touch-action: none;
  box-shadow: 0 0 0 1px rgba(255, 181, 46, .35), 0 0 22px rgba(69, 184, 255, .18), 0 12px 40px rgba(0, 0, 0, .55);
}

.overlay {
  position: fixed; inset: 0; background: rgba(6, 14, 30, .6); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.panel {
  background: linear-gradient(180deg, rgba(22, 46, 88, .97), rgba(10, 22, 46, .97));
  border: 1px solid rgba(255, 181, 46, .4); border-radius: 16px; padding: 20px 22px;
  max-width: 460px; width: 100%; text-align: center; max-height: calc(100% - 8px); overflow-y: auto;
  box-shadow: 0 0 30px rgba(69, 184, 255, .2), 0 20px 60px rgba(0, 0, 0, .6);
}
.panel h1 {
  margin: 0 0 8px; font-size: 28px; color: #fff;
  text-shadow: 0 2px 0 #b5650a, 0 0 16px rgba(255, 181, 46, .8);
}
.panel p { line-height: 1.5; opacity: .93; margin: 8px 0; font-size: 15px; }
.panel kbd {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: inherit;
}
.tips { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; text-align: left; font-size: 13px; margin: 10px 0 2px; }
.tips span { display: flex; align-items: center; gap: 6px; opacity: .93; }
.tips em {
  font-style: normal; font-weight: 900; font-size: 12px; color: #fff; min-width: 34px; height: 20px; line-height: 20px;
  border-radius: 6px; text-align: center; flex: none;
}
.tips em.g { background: linear-gradient(180deg, #4fc0ff, #1f6fe0); box-shadow: 0 0 8px rgba(69, 184, 255, .7); }
.tips em.r { background: linear-gradient(180deg, #ff6a74, #d0263a); box-shadow: 0 0 8px rgba(255, 74, 90, .7); }
.tips em.y { background: linear-gradient(180deg, #ffd36b, #e08a10); box-shadow: 0 0 8px rgba(255, 181, 46, .7); color: #2a1600; }
#ov-stats { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.primary {
  background: linear-gradient(135deg, #ffb52e, #ff7a1a 50%, #ff4a5a); color: #fff; border: none; border-radius: 12px;
  padding: 12px 28px; font-size: 17px; font-weight: 800; margin-top: 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  box-shadow: 0 0 18px rgba(255, 140, 40, .5);
}
.primary:active { transform: translateY(1px); }
.hidden { display: none !important; }

@media (max-width: 380px) {
  .stat { min-width: 48px; padding: 3px 6px; }
  .stat b { font-size: 15px; }
  .panel h1 { font-size: 24px; }
  header { gap: 4px; }
  header button { padding: 7px 7px; }
}
