/* ── QR Studio ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080808;
  --panel: #0d0d0f;
  --white: #ffffff;
  --white-10: rgba(255, 255, 255, 0.10);
  --white-06: rgba(255, 255, 255, 0.06);
  --white-20: rgba(255, 255, 255, 0.20);
  --white-40: rgba(255, 255, 255, 0.40); --text-dim: rgba(255, 255, 255, 0.55);
  --white-60: rgba(255, 255, 255, 0.60);
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: 'General Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Back to home (top right, matching the other tools) ── */
.qr-back {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  background: rgba(14, 14, 16, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--white-10);
  border-radius: 11px;
  color: #fff;
  text-decoration: none;
  font-family: 'Clash Display', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color 0.2s ease;
}

@media(hover:hover){.qr-back:hover{ border-color: var(--white-40); }}

/* ── Layout ── */
.qr-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .qr-layout { grid-template-columns: 1fr; }
}

/* ── Control panel ── */
.qr-panel {
  background: var(--panel);
  border-right: 1px solid var(--white-10);
  padding: 26px 22px 60px;
  overflow-y: auto;
  max-height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: var(--white-20) transparent;
}

@media (max-width: 860px) {
  .qr-panel { max-height: none; border-right: none; border-bottom: 1px solid var(--white-10); }
}

.qr-panel::-webkit-scrollbar { width: 8px; }
.qr-panel::-webkit-scrollbar-thumb { background: var(--white-20); border-radius: 8px; }

.qr-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Clash Display', system-ui, sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.qr-brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.qr-sub {
  margin: 10px 0 26px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.qr-group {
  padding: 20px 0;
  border-top: 1px solid var(--white-10);
}

.qr-group h4 {
  font-family: 'Clash Display', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white-60);
  margin-bottom: 14px;
}

.qr-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 14px 0 8px;
}

.qr-label:first-of-type { margin-top: 0; }

.qr-hint {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--white-20);
  letter-spacing: 0.02em;
}

textarea#qr-data {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--white-20);
  border-radius: 9px;
  color: #fff;
  font-family: 'General Sans', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

textarea#qr-data:focus { border-color: #fff; }

/* ── Chips ── */
.qr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qr-chips button {
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--white-10);
  border-radius: 8px;
  color: var(--white-60);
  font-family: 'General Sans', system-ui, sans-serif;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

@media(hover:hover){.qr-chips button:hover{ color: #fff; border-color: var(--white-40); }}

.qr-chips button.is-active {
  background: #fff;
  border-color: #fff;
  color: #000;
  font-weight: 600;
}

/* `hidden` has to beat the display rules below, or hidden rows still show */
[hidden] { display: none !important; }

/* ── Rows / inputs ── */
.qr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.qr-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--white-60);
}

.qr-inline.qr-full { width: 100%; margin-top: 12px; }
.qr-inline.qr-full input[type=range] { flex: 1; }

input[type=color] {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--white-20);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}

input[type=range] {
  accent-color: #fff;
  cursor: pointer;
  width: 108px;
}

select {
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--white-20);
  border-radius: 8px;
  color: #fff;
  font-family: 'General Sans', system-ui, sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}

select option { background: #141416; }

.qr-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--white-60);
  cursor: pointer;
}

.qr-check input { accent-color: #fff; width: 15px; height: 15px; cursor: pointer; }

/* ── Buttons ── */
.qr-btn {
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--white-20);
  border-radius: 9px;
  color: #fff;
  font-family: 'Clash Display', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

@media(hover:hover){.qr-btn:hover{ background: rgba(255, 255, 255, 0.1); border-color: var(--white-40); }}

.qr-btn-primary {
  flex: 1;
  background: #fff;
  border-color: #fff;
  color: #000;
  font-weight: 700;
}

@media(hover:hover){.qr-btn-primary:hover{ background: rgba(255, 255, 255, 0.86); }}

.qr-mini-btn {
  padding: 6px 11px;
  background: none;
  border: 1px solid var(--white-20);
  border-radius: 7px;
  color: var(--white-60);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

@media(hover:hover){.qr-mini-btn:hover{ color: #fff; border-color: var(--white-40); }}

.qr-filebtn {
  display: block;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--white-20);
  border-radius: 9px;
  color: var(--white-60);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

@media(hover:hover){.qr-filebtn:hover{ border-color: var(--white-40); color: #fff; }}

input[type=file] { display: none; }

/* ── Preview stage ── */
.qr-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 24px 60px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(255, 255, 255, 0.045) 0%, transparent 70%),
    var(--bg);
}

.qr-preview-card {
  padding: 26px;
  border: 1px solid var(--white-10);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  /* Light checkerboard: QR codes are dark-on-light by default, so a dark
     preview surface made a black transparent-background code invisible.
     The checker still communicates "this area is transparent". */
  background-color: #d8d8d8;
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.07) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
}

#qr-preview canvas,
#qr-preview svg {
  display: block;
  border-radius: 6px;
}

.qr-scan-hint {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

body { user-select: none; -webkit-user-select: none; }
textarea, input { user-select: text; -webkit-user-select: text; }

.qr-stage .credit-line {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 0;
  margin: 0;
  font-family: 'General Sans', system-ui, sans-serif;
}
.qr-stage .credit-line a { color: var(--white-60); text-decoration: none; }
@media(hover:hover){.qr-stage .credit-line a:hover{ color: var(--white); }}

.ctx-menu {
  position: fixed; z-index: 9999; background: var(--panel); border: 1px solid var(--white-20);
  border-radius: 10px; padding: 4px; min-width: 180px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
  font-family: 'General Sans', system-ui, sans-serif; font-size: 11px; animation: ctxIn .12s ease; display: none;
}
.ctx-menu.show { display: block; }
.ctx-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px;
  border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  color: var(--white); font-family: inherit; font-size: 11px; transition: background .1s;
}
@media(hover:hover){.ctx-menu button:hover{ background: var(--white-06); }}
.ctx-menu button svg { flex: 0 0 auto; opacity: .6; }
@keyframes ctxIn { from { opacity: 0; transform: scale(.96); } }

/* Readable minimum on phones */
@media (max-width: 768px), (pointer: coarse) {
  .qr-hint { font-size: 11px; }
}

/* Keeps the live preview inside the screen on phones. */
@media (max-width: 860px) {
  .qr-layout { grid-template-columns: minmax(0, 1fr); }
  .qr-panel, .qr-stage { min-width: 0; }
  .qr-stage { padding-inline: 16px; }
  .qr-preview-card { max-width: 100%; padding: 16px; }
  #qr-preview, #qr-preview canvas, #qr-preview svg { max-width: 100%; }
  #qr-preview canvas, #qr-preview svg { width: 100% !important; height: auto !important; }
}

.qr-hint { color: var(--text-dim); }

/* ── Minimal look: no frames, big plain type, pills ── */
html, body { font-family: 'General Sans', system-ui, sans-serif; }
.qr-layout { grid-template-columns: 380px 1fr; }
.qr-panel { background: transparent; border: 0; padding: 22px 22px 40px 26px; }
.qr-brand { font-family: 'Clash Display', system-ui, sans-serif; font-weight: 600; font-size: 34px; line-height: 1; letter-spacing: -.02em; gap: 0; }
.qr-brand-dot { display: none; }
.qr-sub { font-size: 14px; line-height: 1.5; margin-top: 10px; }
.qr-group { border: 0; padding-top: 0; margin-top: 26px; }
.qr-group h4 { font-family: 'Clash Display', system-ui, sans-serif; font-size: 18px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: #f2fdff; margin-bottom: 12px; }
.qr-label, .qr-inline, .qr-check { font-family: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; color: rgba(242, 253, 255, .64); }
.qr-hint { font-size: 12.5px; }
textarea#qr-data { background: #0f1116; border: 1.5px solid transparent; border-radius: 16px; padding: 14px 16px; font-family: inherit; font-size: 15px; }
textarea#qr-data:focus { border-color: #7bbbff; }
.qr-chips { gap: 6px; }
.qr-chips button { height: 36px; padding: 0 14px; border: 0; border-radius: 99px; background: #0f1116; font-family: inherit; font-size: 13.5px; color: rgba(242, 253, 255, .64); }
body[data-tool="qr-studio"] .qr-chips button.is-active { background: #f2fdff; color: #060607; }
.as-shell select { height: 44px; border-radius: 12px; border: 1.5px solid transparent; background: #0f1116; font-family: inherit; font-size: 14px; padding: 0 12px; }
.qr-check input { width: 17px; height: 17px; }
.qr-btn { height: 44px; border: 0; border-radius: 99px; background: #0f1116; font-family: inherit; font-size: 14px; font-weight: 500; padding: 0 18px; }
.qr-btn-primary { height: 52px; font-size: 16px; font-weight: 600; }
.qr-mini-btn { border: 0; border-radius: 99px; background: #0f1116; font-family: inherit; font-size: 13px; padding: 0 14px; height: 32px; }
.qr-filebtn { border: 0; border-radius: 16px; background: #0f1116; padding: 18px 14px; font-family: inherit; font-size: 14px; color: #f2fdff; transition: box-shadow .15s; }
@media(hover:hover){ .qr-filebtn:hover { box-shadow: inset 0 0 0 2px #7bbbff; } }
.qr-stage { margin: 14px 14px 14px 0; border-radius: 20px; background: #0f1116; }
.qr-preview-card { border: 0; border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); }
.qr-scan-hint { font-family: inherit; font-size: 14px; letter-spacing: 0; text-transform: none; }
.ctx-menu { font-family: inherit; border-radius: 16px; }
@media (max-width: 860px) {
  .qr-layout { grid-template-columns: 1fr; }
  .qr-panel { padding: 18px 16px 28px; }
  .qr-stage { margin: 64px 12px 0; }
  .qr-brand { font-size: 28px; }
}

/* ── Layout: code on the left, one card of controls, groups as a row of pills ── */
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.qr-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; padding: 0 16px; }
.qr-stage { grid-column: 1; grid-row: 1; margin: 0; padding: 24px; }
.qr-panel { grid-column: 2; grid-row: 1; align-self: start; max-height: 100%; background: #0f1116; border-radius: 20px; padding: 16px 20px 20px; }
.qr-panel .qr-brand, .qr-panel .qr-sub { display: none; }
.qr-panel .qr-group { margin-top: 0; padding: 0; }
.qr-panel textarea#qr-data, .qr-panel .qr-chips button, .qr-panel .qr-btn:not(.qr-btn-primary), .qr-panel .qr-mini-btn, .qr-panel .qr-filebtn, .as-shell .qr-panel select { background: #060607; }
body[data-tool="qr-studio"] .qr-panel .qr-chips button.is-active { background: #f2fdff; }
body > .as-tabs { position: static; transform: none; align-self: center; flex: none; margin: 12px auto; }
#qr-preview canvas, #qr-preview svg { max-width: min(100%, 52vh); height: auto; }
@media (max-width: 860px) {
  body { height: auto; overflow: auto; }
  .qr-layout { grid-template-columns: 1fr; padding: 0 12px; }
  .qr-stage { margin: 0; min-height: 46vh; }
  .qr-panel { grid-column: 1; grid-row: 2; max-height: none; padding: 16px; }
  body > .as-tabs { position: sticky; bottom: 10px; z-index: 60; order: 3; }
}
@media (max-width: 860px) { .qr-stage .credit-line { position: static; transform: none; margin-top: 4px; } }
