:root { --accent: #7cc4ff; --accent2: #c27bff; --gold: #ffd36b; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0b0d33; color: #eef0ff;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; }
body { display: flex; flex-direction: column; }

/* canvas phủ toàn màn hình, nằm dưới header; #wrap chỉ để đo vùng chơi */
#board { position: fixed; inset: 0; display: block; z-index: 0; touch-action: none; }

header {
  position: relative; z-index: 2; flex: none;
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  padding-top: calc(6px + env(safe-area-inset-top));
  padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right));
  pointer-events: none;
}
header > * { pointer-events: auto; }
.brand { flex: 1; font-weight: 900; font-size: 17px; letter-spacing: .4px; white-space: nowrap; pointer-events: none; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
header button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px; padding: 7px 10px; font-size: 14px; line-height: 1;
}
header button:hover { background: rgba(255, 255, 255, .15); }

#wrap {
  flex: 1; min-height: 0; pointer-events: none;
  margin: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.overlay {
  position: fixed; inset: 0; background: rgba(6, 6, 30, .62); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.panel {
  background: linear-gradient(160deg, rgba(34, 30, 92, .96), rgba(14, 12, 44, .96));
  border: 1px solid rgba(170, 160, 255, .22); border-radius: 18px; padding: 22px 24px;
  max-width: 440px; width: 100%; max-height: 100%; overflow: auto; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 40px rgba(150, 110, 255, .18);
}
.panel h1 {
  margin: 0 0 8px; font-size: 28px;
  background: linear-gradient(90deg, #8fd3ff, #d59bff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gnx-btn {
  display: inline-block; margin-top: 10px; background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 700;
}
#ov-text { line-height: 1.5; opacity: .93; margin: 8px 0; font-size: 15px; }
#ov-text p { margin: 6px 0; }
.panel kbd {
  display: inline-block; min-width: 22px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25);
  border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; line-height: 18px; font-family: inherit;
}
.keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; text-align: left; font-size: 13px; margin: 10px auto 2px; max-width: 320px; }
.keys > span:nth-child(odd) { text-align: right; white-space: nowrap; }
.keys > span:nth-child(even) { opacity: .85; }
.rec { color: var(--gold); font-weight: 800; }
#ov-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
#ov-stats:empty { display: none; }
.stat { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 4px 12px; min-width: 72px; text-align: center; }
.stat .label { display: block; font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.stat b { font-size: 16px; color: var(--accent); }
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #120a36; border: none; border-radius: 12px;
  padding: 12px 30px; font-size: 17px; font-weight: 800; margin-top: 6px; box-shadow: 0 6px 20px rgba(140, 120, 255, .38);
}
.primary:hover { filter: brightness(1.08); }
.linkbtn {
  background: none; border: none; color: #b9c4ff; text-decoration: underline; font-size: 14px; padding: 4px 8px; opacity: .85;
}
.linkbtn:hover { opacity: 1; color: #fff; }
.hidden { display: none !important; }
