/* --- Base --- */
* { box-sizing: border-box; }
:root{
  --bg: radial-gradient(1200px 800px at 20% -10%, rgba(14,165,233,0.12), transparent 60%),
        radial-gradient(900px 600px at 120% 10%, rgba(99,102,241,0.12), transparent 60%),
        radial-gradient(800px 500px at 50% 120%, rgba(16,185,129,0.12), transparent 60%),
        #0b1020;
  --card: rgba(255,255,255,0.08);
  --card-border: rgba(255,255,255,0.18);
  --text: #eaf2ff;
  --muted: #b8c2d6;
  --accent: #0ea5e9;
  --accent-2: #6366f1;
  --shadow: 0 20px 40px rgba(0,0,0,0.35);
}

html, body { height: 100%; }
body{
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
}

/* Decorative scattered glyphs background */
body::before{
  content: "A9%@#Z&*q7!{=}m$L?^+>~ 0xFF 1010 <> [] () @#! xyz XYZ";
  position: fixed;
  inset: 0;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-size: 10rem;
  opacity: 0.05;
  line-height: 0.9;
  word-break: break-word;
  pointer-events: none;
  filter: blur(1px);
}

/* Layout */
.site-header{
  padding: 32px 24px 8px;
  display: flex;
  justify-content: center;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo{
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title{
  margin: 0;
  font-size: 28px;
}
.subtitle{
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.wrapper{
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.card{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  box-shadow: var(--shadow);
}

.result-row{
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.result{
  width: 100%;
  font-size: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}
.btn{
  border: 1px solid rgba(255,255,255,0.25);
  background: linear-gradient(135deg, rgba(14,165,233,0.25), rgba(99,102,241,0.25));
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .06s ease, filter .2s ease, background .2s ease;
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover{ filter: brightness(1.15); }
.btn:active{ transform: translateY(1px) scale(0.99); }
.btn.icon{ width: 48px; height: 48px; display: grid; place-items: center; font-size: 20px; }
.btn.primary{ width: 100%; margin-top: 8px; font-weight: 600; }

.controls{
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.control label{ display: inline-block; font-weight: 600; }
.length-inputs{
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
#length{ width: 100%; }
#lengthNumber{
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}

.control.grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.check{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
}
.check input{ transform: scale(1.1); }

.msg{
  min-height: 1.2em;
  color: #c7f9cc;
  font-size: 14px;
  text-align: center;
}

.info{
  margin-top: 24px;
  color: var(--muted);
}
.info h2, .info h3{ color: var(--text); }
.tips{ padding-left: 18px; }

.site-footer{
  color: var(--muted);
  text-align: center;
  padding: 24px;
  max-width: 980px;
  margin: 0 auto;
}

/* A11y */
.sr-only{
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
/* Responsive */
@media (max-width: 560px){
  .result-row{ grid-template-columns: 1fr auto; }
  #refresh{ display:none; }
  .control.grid{ grid-template-columns: 1fr; }
}