:root {
  --luna-beige: #ece9d8;
  --luna-blue1: #0058e6;
  --luna-blue2: #3f8cf3;
  --btn-face: #ece9d8;
  --btn-shadow: #7f7f6f;
  --green: #3a9e34;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Tahoma, Verdana, Geneva, sans-serif;
  min-height: 100vh;
  color: #1a1a1a;
}

/* Bliss background: green hills + blue sky */
.bliss-bg {
  min-height: 100vh;
  padding: 24px 12px 48px;
  background:
    linear-gradient(to bottom, #4a91e2 0%, #7bb7f0 30%, #a7d3f5 45%, #cfe8ac 46%, #7cb342 60%, #558b2f 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* XP window frame */
.xp-window {
  width: 100%;
  max-width: 820px;
  border: 1px solid #0530a5;
  border-radius: 8px 8px 3px 3px;
  overflow: hidden;
  background: var(--luna-beige);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  animation: winpop 0.4s ease;
}

@keyframes winpop {
  from { transform: scale(0.96) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.xp-titlebar {
  height: 30px;
  background: linear-gradient(to bottom, #3f8cf3 0%, #0058e6 55%, #0846c9 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 6px;
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}
.tb-left { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.tb-logo { font-size: 15px; }
.tb-title { font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-buttons { display: flex; gap: 3px; flex-shrink: 0; }
.tb-sysbtn {
  width: 21px; height: 21px;
  border: 1px solid #1d54c4;
  border-radius: 3px;
  color: #fff; font-size: 10px; font-weight: 700;
  cursor: pointer;
  background: linear-gradient(to bottom, #6aa8f5, #2f76e6);
}
.tb-sysbtn.close { background: linear-gradient(to bottom, #f28f6a, #e0492c); border-color: #b4331b; }

.xp-body { display: flex; min-height: 380px; }

.xp-sidebar {
  width: 150px;
  flex-shrink: 0;
  background: linear-gradient(to bottom, #1642a8 0%, #0b2e7a 40%, #0a2467 100%);
  color: #fff;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
}
.side-wordmark { line-height: 1; }
.side-win { display: block; font-weight: 700; font-size: 22px; color: #ff8f00; letter-spacing: -0.5px; }
.side-xp { display: block; font-style: italic; font-weight: 700; font-size: 30px; color: #fff; margin-top: -4px; }
.side-tagline { margin-top: 6px; font-size: 12px; opacity: 0.8; letter-spacing: 3px; }

.xp-content { flex: 1; padding: 16px 20px; background: #fff; }
.content-h1 { margin: 0 0 4px; font-size: 18px; color: #0b3a91; }
.content-sub { margin: 0 0 16px; font-size: 12px; color: #555; line-height: 1.5; }

.prompt-text { font-weight: 700; font-size: 13px; margin: 0 0 8px; }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.key-box {
  width: 62px;
  padding: 5px 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  border: 2px inset #b7b7a8;
  background: #fefef8;
}
.key-box:focus { outline: 2px solid #3f8cf3; }
.dash { font-weight: 700; color: #888; }

.btn-row { margin-top: 14px; display: flex; gap: 8px; }

/* XP 3D buttons */
.xp-btn {
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  padding: 5px 14px;
  border: 1px solid #7f7f6f;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fefefe, #ece9d8 45%, #d6d2bd);
  cursor: pointer;
  color: #222;
  box-shadow: inset 1px 1px 0 #fff;
}
.xp-btn:hover { background: linear-gradient(to bottom, #fffdf0, #f0edd8 45%, #ded9c2); border-color: #f5a623; }
.xp-btn:active { box-shadow: inset 1px 1px 3px rgba(0,0,0,0.3); transform: translateY(1px); }
.xp-btn.primary { border-color: #2b5eb8; font-weight: 700; }
.xp-btn.green {
  background: linear-gradient(to bottom, #8ed07f, #5aa84e 45%, #3a8e30);
  color: #fff; border-color: #2f7a26; text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
  font-weight: 700;
}
.xp-btn.green:hover { background: linear-gradient(to bottom, #9fd88e, #66b459 45%, #43992f); }
.xp-copy { padding: 3px 8px; font-size: 11px; }

/* Generator */
.gen-section { margin-top: 22px; padding-top: 16px; border-top: 1px dashed #ccc; }
.gen-readout { margin-top: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.gen-key {
  font-family: "IBM Plex Mono", monospace;
  font-size: 16px; font-weight: 600;
  background: #08206e; color: #cfe3ff;
  padding: 8px 12px; border-radius: 4px; letter-spacing: 1px;
}
.gen-status { flex-basis: 100%; font-size: 11px; color: #444; }
.pid-code { font-family: "IBM Plex Mono", monospace; color: #0b3a91; font-weight: 600; }

.bink-select {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; font-size: 12px; font-weight: 700; color: #0b3a91;
}
.bink-select select {
  font-family: Tahoma, sans-serif; font-size: 12px;
  padding: 4px 6px; border: 2px inset #b7b7a8; background: #fefef8;
}
.xp-btn:disabled { opacity: 0.55; cursor: default; }

.hist { margin-top: 14px; }
.hist-title { font-size: 11px; font-weight: 700; color: #777; margin-bottom: 4px; }
.hist-item { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 2px 0; }
.hist-item code { font-family: "IBM Plex Mono", monospace; color: #333; }

/* Collapsibles */
.collapsible { margin-top: 18px; border: 1px solid #d8d4c0; border-radius: 4px; overflow: hidden; }
.collapse-head {
  width: 100%; text-align: left;
  background: linear-gradient(to bottom, #f5f3e6, #e6e2ce);
  border: none; border-bottom: 1px solid #d8d4c0;
  padding: 8px 12px; font-size: 12px; font-weight: 700; color: #0b3a91;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.chev { font-size: 9px; color: #666; }
.collapse-body { padding: 10px 12px; background: #fbfaf3; }

.param-grid { font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.param-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 3px;
}
.param-row.odd { background: #efece0; }
.param-label { font-family: Tahoma, sans-serif; font-weight: 700; color: #555; font-size: 11px; }
.param-val { color: #0b4f9e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.math-console {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  background: #0b1020; color: #7dd3fc;
  padding: 10px; border-radius: 4px;
  max-height: 200px; overflow: auto;
}
.math-line { display: flex; gap: 8px; padding: 1px 0; word-break: break-all; }
.math-key { color: #f0a500; flex-shrink: 0; }
.math-v { color: #a5f3c0; }
.math-empty { color: #6b7280; }

.disclaimer { margin-top: 18px; font-size: 10px; color: #999; line-height: 1.5; }

/* status bar */
.xp-statusbar {
  height: 22px;
  background: var(--luna-beige);
  border-top: 1px solid #b7b7a8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; font-size: 11px; color: #444;
}
.status-progress { width: 120px; height: 12px; border: 1px inset #b7b7a8; background: #fff; overflow: hidden; }
.status-fill {
  height: 100%; width: 40%;
  background: repeating-linear-gradient(to right, #3a9e34 0 8px, #4fb849 8px 10px);
  animation: slide 2.5s linear infinite;
}
@keyframes slide { from { transform: translateX(-100%);} to { transform: translateX(300%);} }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 12px;
}
.xp-msgbox {
  width: 360px; max-width: 100%;
  background: var(--luna-beige);
  border: 1px solid #0530a5;
  border-radius: 8px 8px 3px 3px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  animation: winpop 0.25s ease;
}
.msg-titlebar {
  height: 28px;
  background: linear-gradient(to bottom, #3f8cf3, #0058e6);
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 0 8px;
}
.tb-close {
  width: 20px; height: 20px; border: 1px solid #b4331b; border-radius: 3px;
  background: linear-gradient(to bottom, #f28f6a, #e0492c); color: #fff; cursor: pointer; font-size: 10px;
}
.msg-body { display: flex; gap: 12px; padding: 18px 16px; }
.msg-icon { font-size: 36px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-4px);} }
.msg-text { flex: 1; }
.verdict-label { font-weight: 700; font-size: 15px; }
.verdict-label.genuine { color: #2f7a26; }
.verdict-label.questionable { color: #b8860b; }
.verdict-label.invalid { color: #c1272d; }
.verdict-label.easter { color: #7a2fb8; }
.verdict-reason { font-size: 12px; margin-top: 4px; line-height: 1.4; }
.verdict-score { font-size: 11px; color: #777; margin-top: 6px; font-family: "IBM Plex Mono", monospace; }
.msg-buttons { padding: 8px 16px 14px; text-align: right; }

.remix { margin-top: 16px; }
.remix a {
  color: #fff; font-size: 12px; text-decoration: none;
  background: rgba(0,0,0,0.35); padding: 5px 14px; border-radius: 14px;
  backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.3);
}
.remix a:hover { background: rgba(0,0,0,0.55); }

@media (max-width: 560px) {
  .xp-body { flex-direction: column; }
  .xp-sidebar { width: 100%; flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; }
  .side-xp { font-size: 24px; margin-top: 0; }
  .side-tagline { margin-top: 0; }
  .param-row { grid-template-columns: 1fr; gap: 2px; }
  .key-box { width: 54px; }
}