:root{
  --radius: 18px;
  --radius-sm: 14px;
  --gap: 10px;

  --kb-design-w: 1700px;
  --kb-design-h: 560px;
  --kb-scale: 1;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* base */
*{ box-sizing:border-box; }
html,body{
  min-height:100%;
  height:100%;
  background:#06070b;
}

#app{
  min-height:100vh;
  min-height:100dvh;
  height:auto;
  display:flex;
  flex-direction:column;
}

/* ===== Luxury themes via variables ===== */
#app.theme-night{
  --bg0:#06070b;
  --bg1:#0b101a;
  --bg2:#071a20;

  --panel: rgba(255,255,255,0.06);
  --panel-2: rgba(255,255,255,0.04);
  --panel-border: rgba(255,255,255,0.10);

  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);

  --pill-bg: rgba(255,255,255,0.07);
  --pill-bd: rgba(255,255,255,0.12);
  --pill-hover: rgba(255,255,255,0.10);

  --key-bg: rgba(255,255,255,0.08);
  --key-bd: rgba(255,255,255,0.14);
  --key-text: rgba(255,255,255,0.92);

  /* luxury accents */
  --gold: #d7b35b;
  --gold-2: #f5d98b;
  --accent: var(--gold);
  --accent-2: #9b7bff;

  --overlay: rgba(0,0,0,0.55);
}

#app.theme-day{
  --bg0:#f2f3f6;
  --bg1:#eef0f5;
  --bg2:#f7f2e8;

  --panel: rgba(25,30,40,0.06);
  --panel-2: rgba(25,30,40,0.04);
  --panel-border: rgba(25,30,40,0.12);

  --text: rgba(12,18,28,0.92);
  --muted: rgba(12,18,28,0.62);

  --pill-bg: rgba(255,255,255,0.72);
  --pill-bd: rgba(25,30,40,0.14);
  --pill-hover: rgba(255,255,255,0.92);

  --key-bg: rgba(255,255,255,0.78);
  --key-bd: rgba(25,30,40,0.14);
  --key-text: rgba(12,18,28,0.92);

  --gold: #b98a2a;
  --gold-2: #e7c976;
  --accent: var(--gold);
  --accent-2: #6d28d9;

  --overlay: rgba(20,30,45,0.18);
}

/* body is neutral; app defines actual visuals */
body{
  margin:0;
  font-family: var(--font);
  overflow-x:hidden;
  overflow-y:auto;
  user-select:none;
  background:#06070b;
}

#app{
  /* subtle "luxury" glow + depth */
  background:
    radial-gradient(1000px 700px at 18% 0%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 62%),
    radial-gradient(900px 600px at 85% 20%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 62%),
    radial-gradient(1200px 900px at 55% 120%, rgba(0,0,0,0.35), transparent 55%),
    linear-gradient(135deg, var(--bg0), var(--bg1) 45%, var(--bg2));
  color: var(--text);
}

/* ===== Topbar ===== */
.topbar{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 16px;
  gap: 12px;
  flex: 0 0 auto;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 285px;
  color: var(--text);
  text-decoration: none;
  border-radius: 16px;
  outline: none;
}
.brand:hover .title{ color: color-mix(in srgb, var(--gold) 86%, var(--text)); }
.brand:focus-visible{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
.logo{
  width:46px; height:46px;
  border-radius: 15px;
  display:grid; place-items:center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 18%, rgba(255,255,255,0.18), transparent 26%),
    linear-gradient(145deg, #171f2c 0%, #0a0f17 100%);
  border: 1px solid color-mix(in srgb, var(--gold) 44%, var(--pill-bd));
  box-shadow:
    0 16px 38px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 0 1px rgba(255,255,255,0.03);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.brand:hover .logo{
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--gold) 70%, var(--pill-bd));
  box-shadow:
    0 18px 46px rgba(0,0,0,0.36),
    inset 0 1px 0 rgba(255,255,255,0.14),
    0 0 0 3px color-mix(in srgb, var(--gold) 14%, transparent);
}
.logoIcon{
  width:30px;
  height:30px;
  border-radius: 9px;
  display:grid;
  place-items:center;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)),
    linear-gradient(145deg, #111827, #070b12);
  border: 1.7px solid rgba(255,255,255,0.82);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    0 0 0 2px color-mix(in srgb, var(--gold) 16%, transparent);
}
.logoIcon::before{
  content:"K";
  font-weight: 950;
  font-size: 19px;
  line-height: 1;
  letter-spacing: -0.7px;
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.logoIcon::after{
  content:"";
  position:absolute;
  width:13px;
  height:13px;
  right:-5px;
  bottom:-5px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f5d98b, #c49735);
  border: 2px solid #0b1018;
  box-shadow: 0 6px 16px rgba(0,0,0,0.32);
}
.logo::after{
  content:"";
  position:absolute;
  width:8px;
  height:4px;
  right:7px;
  bottom:9px;
  border-left: 2px solid #0b1018;
  border-bottom: 2px solid #0b1018;
  transform: rotate(-45deg);
  z-index: 2;
}
.title{
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.15px;
  line-height: 1.05;
  transition: color .12s ease;
}
.tagline{
  margin-top: 3px;
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  letter-spacing: .18px;
}

.controls{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content:flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.controls::-webkit-scrollbar{ height: 10px; }
.controls::-webkit-scrollbar-thumb{
  background: color-mix(in srgb, var(--pill-bd) 75%, transparent);
  border-radius: 999px;
}
.controls > *{ flex: 0 0 auto; }

.pill{
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--pill-bd);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--pill-bg) 92%, rgba(255,255,255,0.12)),
      var(--pill-bg)
    );
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap: 10px;
  cursor:pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.pill:hover{
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--pill-hover) 90%, rgba(255,255,255,0.14)),
      var(--pill-hover)
    );
}
.pill:active{ transform: translateY(1px); }

.pill.primary{
  border-color: color-mix(in srgb, var(--gold) 35%, var(--pill-bd));
  box-shadow:
    0 16px 36px rgba(0,0,0,0.16),
    0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.14);
}
.pill.active{
  border-color: color-mix(in srgb, var(--gold) 50%, var(--pill-bd));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.status .dot{
  width:10px; height:10px;
  border-radius:999px;
  background: #25d366;
  box-shadow: 0 0 0 3px rgba(37,211,102,0.18);
}

/* ===== Stage ===== */
.stage{
  flex:1;
  min-height: 0;
  padding: 10px 16px 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  outline: none;
}

/* ===== HUD BAR (doesn't cover keyboard) ===== */
.hudBar{
  flex: 0 0 auto;
  width: 100%;
  display:grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 12px;
  align-items:center;
  padding: 12px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.hudLeft{
  display:flex;
  align-items:center;
  gap: 12px;
}
.hudKey{
  width: 84px;
  height: 54px;
  display:grid;
  place-items:center;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--gold) 18%, var(--key-bd));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--panel-2) 60%, transparent),
      color-mix(in srgb, var(--key-bg) 88%, transparent)
    );
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 18px 44px rgba(0,0,0,0.18);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.3px;
}
.hudHint{
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.hudMid{
  display:grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}
.hudRow{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--pill-bg) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-bd) 70%, transparent);
  font-size: 12px;
  color: var(--muted);
}
.hudRow span:last-child{
  color: var(--text);
  font-weight: 800;
}
.hudRight{
  display:flex;
  justify-content:flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.hudChip{
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--pill-bd) 70%, transparent);
  background: color-mix(in srgb, var(--pill-bg) 70%, transparent);
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1100px){
  .hudBar{ grid-template-columns: 220px 1fr; }
  .hudRight{ justify-content:flex-start; }
}
@media (max-width: 820px){
  .hudBar{ grid-template-columns: 1fr; }
  .hudMid{ grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

/* ===== Keyboard wrap ===== */
.keyboardWrap{
  flex: 1 1 auto;
  min-height: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 6px;
}

/* ===== Keyboard container ===== */
.keyboard{
  width: var(--kb-design-w);
  height: var(--kb-design-h);
  transform: scale(var(--kb-scale));
  transform-origin: center center;

  display:grid;
  grid-template-columns: repeat(92, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;

  padding: 18px;
  border-radius: 30px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--panel) 75%, transparent),
      color-mix(in srgb, var(--panel-2) 55%, transparent)
    );
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  box-shadow:
    0 34px 90px rgba(0,0,0,0.24),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

/* ===== Key ===== */
.key{
  border-radius: 16px;
  border: 1px solid var(--key-bd);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--key-bg) 72%, rgba(255,255,255,0.24)),
      var(--key-bg)
    );
  color: var(--key-text);

  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;

  font-weight: 800;
  letter-spacing: 0.15px;
  line-height: 1;

  padding: 8px;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 16px 34px rgba(0,0,0,0.18);

  transition:
    transform .08s ease,
    border-color .12s ease,
    box-shadow .12s ease,
    filter .12s ease;
  cursor: default;
}
.key:hover{
  border-color: color-mix(in srgb, var(--gold) 20%, var(--key-bd));
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 18px 42px rgba(0,0,0,0.20);
}
.key.small{ font-size: 14px; }
.key.med{ font-size: 16px; }
.key.big{ font-size: 18px; }

.key.is-down,
.key.is-latched{
  border-color: color-mix(in srgb, var(--gold) 62%, var(--key-bd));
  transform: translateY(1.5px) scale(0.995);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent),
    0 22px 46px rgba(0,0,0,0.22);
}
.key.is-pulse{
  border-color: color-mix(in srgb, var(--gold) 62%, var(--key-bd));
  transform: translateY(1.5px) scale(0.995);
  animation: keyPulse .26s ease-out both;
}
@keyframes keyPulse{
  0%{
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.22),
      0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent),
      0 22px 46px rgba(0,0,0,0.22);
    filter: brightness(1.04);
  }
  100%{
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.22),
      0 0 0 0 color-mix(in srgb, var(--gold) 0%, transparent),
      0 16px 34px rgba(0,0,0,0.18);
    filter: brightness(1);
  }
}

/* ===== Modal ===== */
.modalRoot{
  position:fixed;
  inset:0;
  z-index: 100;
}
.modalOverlay{
  position:absolute;
  inset:0;
  background: var(--overlay);
  backdrop-filter: blur(10px);
}
.modalPanel{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  width: min(760px, calc(100vw - 24px));
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 70%, rgba(255,255,255,0.08));
  border: 1px solid var(--panel-border);
  box-shadow: 0 30px 90px rgba(0,0,0,0.30);
  backdrop-filter: blur(14px);
  padding: 18px 18px 14px;
}
.modalX{
  position:absolute;
  right: 12px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--pill-bd);
  background: var(--pill-bg);
  color: var(--text);
  cursor:pointer;
}
.modalTitle{
  font-size: 20px;
  font-weight: 900;
  margin: 4px 0 12px;
  letter-spacing: .2px;
}
.modalBody{
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
.modalBody ul{
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}
.modalBody b{ color: var(--text); }

.modalActions{
  margin-top: 14px;
  display:flex;
  justify-content:flex-end;
}


/* footer */
.footer{
  margin-top: auto;
  padding: 16px 18px 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.footerLinks{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  margin-bottom: 8px;
}
.footerLinks a{
  color: var(--text);
  text-decoration:none;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill-bg) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-bd) 72%, transparent);
}
.footerLinks a:hover{
  background: var(--pill-hover);
}
.footerLinks .sep{
  opacity: 0.5;
}
.footerText{
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
  opacity: 0.75;
}


/* Content pages */
.contentPage{
  flex: 1 0 auto;
  padding: clamp(28px, 6vw, 70px) 18px 36px;
  max-width:1100px;
  width:100%;
  margin:0 auto;
  user-select:text;
}
.contentHero{
  display:grid;
  grid-template-columns: minmax(0,1fr);
  gap: 20px;
}
.contentCard{
  position:relative;
  overflow:hidden;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background:
    radial-gradient(620px 260px at 8% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 62%),
    radial-gradient(560px 260px at 92% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 90%, rgba(255,255,255,0.06)), color-mix(in srgb, var(--panel-2) 82%, transparent));
  box-shadow:
    0 30px 90px rgba(0,0,0,0.24),
    inset 0 1px 0 rgba(255,255,255,0.10);
  backdrop-filter: blur(14px);
  padding: clamp(26px, 4vw, 46px);
}
.kicker{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, var(--pill-bd));
  background: color-mix(in srgb, var(--pill-bg) 70%, transparent);
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.contentPage h1{
  margin:0 0 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.03;
  letter-spacing: -0.04em;
}
.contentPage h2{
  margin:28px 0 12px;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.02em;
}
.contentPage h3{
  margin:0 0 8px;
  font-size: 17px;
}
.contentPage p,
.contentPage li{
  line-height:1.7;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
  font-size: 16px;
}
.contentPage p.lead{
  max-width: 760px;
  font-size: clamp(17px, 1.8vw, 20px);
  color: var(--muted);
}
.contentPage a{ color: var(--gold-2); }
.featureGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
  margin-top: 22px;
}
.infoBox{
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--panel-border) 75%, transparent);
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  padding: 18px;
}
.infoBox p{ margin:0; font-size:14px; }
.cleanList{
  margin: 14px 0 0;
  padding-left: 20px;
}
.metaLine{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 18px;
}
.metaChip{
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--pill-bd) 70%, transparent);
  background: color-mix(in srgb, var(--pill-bg) 70%, transparent);
  color: var(--muted);
  font-size: 13px;
}
.emailBox{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--pill-bg) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 24%, var(--pill-bd));
  font-weight: 800;
}
.backLink::before{ content:'←'; margin-right: 7px; }
@media (max-width: 760px){
  .topbar{ height:auto; align-items:flex-start; }
  .brand{ min-width:0; }
  .featureGrid{ grid-template-columns: 1fr; }
  .contentCard{ border-radius: 22px; }
}

@media (max-width: 980px){
  body.tester-page .stage{ min-height:auto; }
  .keyboardWrap{
    justify-content:flex-start;
    overflow-x:auto;
    padding-bottom: 12px;
  }
  .keyboard{
    transform-origin: left center;
  }
}
@media (display-mode: fullscreen){
  body{ background:#06070b; }
  #app{ min-height:100vh; }
}
