:root{
  --bg:#f7f8fb;
  --surface:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:rgba(15,23,42,.10);
  --line2:rgba(15,23,42,.08);

  --shadow: 0 12px 38px rgba(15,23,42,.08);
  --shadow2: 0 6px 18px rgba(15,23,42,.06);

  --r20:20px;
  --r16:16px;
  --r14:14px;

  --tap:48px;

  --accent:#2563eb;
  --accent2:#06b6d4;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,.08), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(6,182,212,.08), transparent 55%),
    var(--bg);
  color:var(--text);
}

.wrap{ max-width: 980px; margin: 0 auto; padding: 14px 14px 98px; }

.top{
  position: sticky; top:0; z-index: 10;
  background: rgba(247,248,251,.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topInner{
  max-width:980px;
  margin:0 auto;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  gap:12px;
}

.brandTap{
  display:flex; align-items:center; gap:12px;
  font-weight: 950;
  letter-spacing:-.02em;
  user-select:none;
  cursor:pointer;
}

.appLogo{
  width:44px; height:44px;
  border-radius: 16px;
  border:1px solid var(--line);
  background: linear-gradient(180deg,#fff, #f3f6ff);
  display:grid; place-items:center;
  font-weight: 950;
  overflow:hidden;
  box-shadow: var(--shadow2);
}
.appLogo img{ width:100%; height:100%; object-fit:cover; }

.title{ font-size:16px; line-height:1.1; }
.subtitle{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .01em;
  margin-top: 2px;
}

.spacer{ flex:1; }

.pillTiny{
  font-size: 12px;
  color: var(--muted);
  border:1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,.8);
  box-shadow: var(--shadow2);
}

.section{ display:none; }
.section.active{ display:block; }

.card{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  border-radius: var(--r20);
  box-shadow: var(--shadow);
  padding: 14px;
}

.row2{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px){ .row2{ grid-template-columns: 1fr; } }

.label{
  font-size: 11px;
  color: var(--muted);
  font-weight: 950;
  letter-spacing:.10em;
  text-transform: uppercase;
  margin: 2px 2px 8px;
}

.fakeSelect{ position: relative; }

.fakeBtn{
  width:100%;
  height: var(--tap);
  border:1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg,#fff, #fbfcff);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 6px 10px;
  cursor:pointer;
  gap:12px;
  box-shadow: var(--shadow2);
}

.fakeLeft{ display:flex; align-items:center; gap:10px; min-width:0; }

.logoRect{
  width: 190px;
  max-width: 65vw;
  height: 36px;
  border-radius: 14px;
  border:1px solid var(--line2);
  background:
    linear-gradient(135deg, rgba(37,99,235,.10), rgba(6,182,212,.10)),
    #ffffff;
  display:grid;
  place-items:center;
  font-weight: 950;
  letter-spacing:.10em;
  color:#0b1220;
  flex: 0 0 auto;
  overflow:hidden;
  padding: 0 10px;
  white-space:nowrap;
}
.logoRect img{ width:100%; height:100%; object-fit:cover; }

.caret{
  width: 34px; height: 34px;
  border-radius: 14px;
  border:1px solid var(--line2);
  background:#fff;
  display:grid;
  place-items:center;
  color: var(--muted);
  font-size: 16px;
}

.menu{
  position:absolute;
  left:0; right:0;
  top: calc(100% + 10px);
  background:#fff;
  border:1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(15,23,42,.18);
  padding: 8px;
  max-height: 340px;
  overflow:auto;
  display:none;
  z-index: 50;
}
.menu.open{ display:block; }

.menuItem{
  width:100%;
  border:1px solid transparent;
  background:#fff;
  border-radius: 16px;
  padding: 9px 10px;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:10px;
}
.menuItem:hover{
  background: #f6f8ff;
  border-color: rgba(37,99,235,.14);
}
.menuItem .logoRect{ width: 210px; height: 34px; }
.menuItem .nameMini{
  margin-left:auto;
  font-size: 12px;
  color: var(--muted);
  border:1px solid var(--line2);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
  background: rgba(255,255,255,.8);
}

select, input{
  width:100%;
  height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 900;
  background: #fff;
  outline:none;
  box-shadow: var(--shadow2);
}
select:focus, input:focus{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10), var(--shadow2);
}
input::placeholder{ color:#94a3b8; font-weight:800; }

.list{ display:flex; flex-direction:column; gap:10px; margin-top: 12px; }

.item{
  border:1px solid var(--line);
  border-radius: var(--r20);
  background:#fff;
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  display:grid;
  grid-template-columns: 52px 1fr 74px;
  gap: 10px;
  align-items:center;
  transition: transform .08s ease;
}
.item:active{ transform: scale(.995); }

.micro{
  width:52px; height:52px;
  border-radius: 18px;
  border:1px solid var(--line2);
  background: linear-gradient(180deg,#fff,#fbfcff);
  display:grid;
  place-items:center;
  font-weight: 950;
  letter-spacing:.04em;
  overflow:hidden;
}
.micro img{ width:100%; height:100%; object-fit:cover; border-radius: 18px; }

.mid{ min-width:0; display:flex; flex-direction:column; gap:4px; }
.lensLine{ display:flex; align-items:center; gap:10px; min-width:0; }

.subLogo{
  width: 28px; height: 28px;
  border-radius: 12px;
  border:1px solid var(--line2);
  background:#fff;
  display:grid;
  place-items:center;
  font-size: 14px;
  flex: 0 0 auto;
  overflow:hidden;
  box-shadow: 0 4px 12px rgba(15,23,42,.06);
}
.subLogo img{ width:100%; height:100%; object-fit:cover; border-radius: 12px; }

.lensName{
  font-size: 15px;
  font-weight: 950;
  letter-spacing:-.02em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.brandName{
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.engrave{
  width:74px; height:52px;
  border-radius: 18px;
  border:1px solid var(--line2);
  background: linear-gradient(180deg,#fff,#fbfcff);
  display:grid;
  place-items:center;
  font-size: 20px;
  overflow:hidden;
  box-shadow: 0 6px 16px rgba(15,23,42,.06);
}
.engrave img{ width:100%; height:100%; object-fit:cover; border-radius: 18px; }

.empty{
  border:1px dashed rgba(15,23,42,.18);
  border-radius: var(--r20);
  padding: 16px 12px;
  color: var(--muted);
  text-align:center;
  background: rgba(255,255,255,.75);
  margin-top: 12px;
}

.out{
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r20);
  background:#fff;
  box-shadow: var(--shadow2);
  padding: 12px;
  font-weight: 950;
  letter-spacing:-.02em;
  font-size: 16px;
}
.out small{ display:block; margin-top: 6px; font-weight: 850; color: var(--muted); font-size: 12px; letter-spacing:0; }

.drawWrap{
  border:1px solid var(--line);
  border-radius: var(--r20);
  overflow:hidden;
  box-shadow: var(--shadow2);
  background:#fff;
}
canvas{ width:100%; height: 260px; display:block; touch-action:none; background:#fff; }
.drawBar{ display:flex; gap:10px; padding:10px; border-top:1px solid var(--line); }

.btn{
  height: 44px;
  padding: 0 14px;
  border-radius: 16px;
  border:1px solid var(--line);
  background: linear-gradient(180deg,#fff,#fbfcff);
  font-weight: 950;
  cursor:pointer;
  color: var(--text);
  box-shadow: var(--shadow2);
}
.btn:active{ transform: scale(.99); }

.hint{ font-size: 12px; color: var(--muted); margin-top: 10px; padding: 0 2px; }

.tabs{
  position: fixed;
  left:0; right:0; bottom:0;
  background: rgba(247,248,251,.78);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tabsInner{
  max-width: 980px;
  margin:0 auto;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.tabBtn{
  height: var(--tap);
  border:1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow2);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight: 950;
  color: var(--muted);
  cursor:pointer;
  user-select:none;
}
.tabBtn.active{
  color: var(--text);
  border-color: rgba(37,99,235,.22);
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(6,182,212,.10));
  box-shadow: 0 0 0 4px rgba(37,99,235,.08), var(--shadow2);
}

.dialogBackdrop{
  position: fixed; inset:0;
  background: rgba(15,23,42,.36);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 14px;
  z-index: 100;
}
.dialogBackdrop.open{ display:flex; }
.dialog{
  width: min(560px, 100%);
  border-radius: 20px;
  background:#fff;
  border:1px solid var(--line);
  box-shadow: 0 40px 140px rgba(15,23,42,.28);
  overflow:hidden;
}
.dialogHeader{ padding: 12px 14px; border-bottom:1px solid var(--line); font-weight: 950; }
.dialogBody{ padding: 12px 14px; display:flex; flex-direction:column; gap:10px; }
.dialogActions{ padding: 12px 14px; border-top:1px solid var(--line); display:flex; gap:10px; justify-content:flex-end; }
.small{ font-size: 12px; color: var(--muted); font-weight: 850; }
hr{ border:none; border-top:1px solid var(--line); margin: 8px 0; }
