*{box-sizing:border-box}
:root{
  --bg:#070b1c;
  --bg2:#0a0e28;
  --surface:rgba(14,20,47,.88);
  --surface-solid:#101630;
  --surface-soft:rgba(15,22,48,.78);
  --text:#f7f8ff;
  --text-soft:#adb5ce;
  --muted:#7f89a5;
  --line:rgba(139,148,190,.18);
  --field:#090f24;
  --field-line:#5968dc;
  --violet:#8256f4;
  --violet2:#a744eb;
  --green:#48d9a4;
  --header:rgba(7,12,31,.78);
  --shadow:0 34px 110px rgba(0,0,0,.44);
}
html[data-theme="light"]{
  --bg:#f6f8ff;
  --bg2:#f7f4ff;
  --surface:rgba(255,255,255,.91);
  --surface-solid:#fff;
  --surface-soft:rgba(248,249,255,.90);
  --text:#161c35;
  --text-soft:#637089;
  --muted:#8590a7;
  --line:rgba(110,107,159,.15);
  --field:#f6f8fd;
  --field-line:#7378df;
  --violet:#6c57eb;
  --violet2:#9146e7;
  --green:#17a878;
  --header:rgba(255,255,255,.72);
  --shadow:0 30px 90px rgba(83,76,151,.15);
}
html,body{
  margin:0;min-height:100%;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif
}
html{background:var(--bg);color:var(--text);color-scheme:dark}
html[data-theme="light"]{color-scheme:light}
body.permit-public-page{
  min-height:100dvh;overflow-x:hidden;color:var(--text);
  background:
    radial-gradient(circle at 14% 51%,rgba(36,127,221,.18),transparent 35%),
    radial-gradient(circle at 82% 28%,rgba(128,58,222,.24),transparent 35%),
    radial-gradient(circle at 53% 55%,rgba(116,73,220,.12),transparent 26%),
    linear-gradient(135deg,var(--bg),var(--bg2));
  transition:background .22s ease,color .22s ease;
}
html[data-theme="light"] body.permit-public-page{
  background:
    radial-gradient(circle at 15% 53%,rgba(157,215,255,.34),transparent 36%),
    radial-gradient(circle at 82% 25%,rgba(183,158,255,.29),transparent 34%),
    radial-gradient(circle at 53% 55%,rgba(210,187,255,.17),transparent 26%),
    linear-gradient(135deg,#f5f8ff,#fbfaff 50%,#f4f0ff)
}
button,input{font:inherit}
button{-webkit-tap-highlight-color:transparent}

/* Header */
.permit-header{
  position:relative;z-index:25;
  width:min(1180px,calc(100% - 32px));height:78px;margin:0 auto;
  padding:0 24px;display:flex;align-items:center;justify-content:space-between;gap:20px;
  background:var(--header);border-bottom:1px solid var(--line);
  box-shadow:0 10px 34px rgba(0,0,0,.08);
  backdrop-filter:blur(20px) saturate(125%);
  -webkit-backdrop-filter:blur(20px) saturate(125%)
}
.permit-brand{display:flex;align-items:center;gap:12px;color:var(--text);text-decoration:none;font-size:20px;font-weight:900;letter-spacing:-.03em}
.permit-brand b{color:#8062ff}
.permit-brand-lock,.mini-lock{
  display:grid;place-items:center;color:#fff;
  background:linear-gradient(145deg,#526dff,#7544f2 56%,#bd3eea);
  box-shadow:0 8px 24px rgba(111,70,237,.26),inset 0 1px 0 rgba(255,255,255,.25)
}
.permit-brand-lock{width:42px;height:42px;border-radius:13px}
.permit-brand-lock svg,.mini-lock svg,.permit-login svg,.theme-switch svg,.generate-button svg,.paste-button svg,.privacy-note svg{
  fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round
}
.permit-brand-lock svg{width:20px;height:20px}
.permit-header-actions{display:flex;align-items:center;gap:10px}
.theme-switch{
  display:flex;gap:3px;padding:4px;border:1px solid var(--line);border-radius:13px;background:rgba(128,128,180,.07)
}
.theme-switch button{
  min-width:82px;height:38px;padding:0 12px;border:0;border-radius:9px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;gap:7px;
  background:transparent;color:var(--text-soft);font-size:11px;font-weight:800
}
.theme-switch button.active{
  color:#fff;background:linear-gradient(105deg,#514de3,#7c48e9);
  box-shadow:0 5px 16px rgba(91,73,218,.20)
}
html[data-theme="light"] .theme-switch button[data-theme-choice="light"].active{
  color:#5c4ad3;background:#fff;box-shadow:0 4px 15px rgba(77,69,141,.12)
}
.theme-switch svg{width:15px;height:15px}
.permit-login{
  min-height:46px;padding:0 18px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border-radius:12px;color:#fff;text-decoration:none;background:linear-gradient(105deg,#5664ed,#7d45ef);
  box-shadow:0 10px 24px rgba(96,72,225,.24);font-size:12px;font-weight:850;
  transition:transform .16s ease,box-shadow .16s ease
}
.permit-login:hover{transform:translateY(-1px);box-shadow:0 13px 30px rgba(96,72,225,.32)}
.permit-login svg{width:16px;height:16px}

/* Scene */
.permit-stage{position:relative;z-index:3;min-height:calc(100dvh - 78px);display:grid;place-items:center;padding:42px 18px 54px}
.generator-scene{position:relative;width:min(980px,100%);min-height:650px;display:grid;place-items:center}
.scene-glow{position:absolute;border-radius:50%;filter:blur(45px);pointer-events:none;opacity:.58;animation:glowBreathe 5.5s ease-in-out infinite}
.glow-a{width:340px;height:220px;left:12%;top:35%;background:rgba(36,146,255,.14)}
.glow-b{width:360px;height:240px;right:10%;top:30%;background:rgba(148,58,255,.18);animation-delay:-2.2s}
html[data-theme="light"] .glow-a{background:rgba(78,172,255,.18)}
html[data-theme="light"] .glow-b{background:rgba(162,107,255,.17)}
@keyframes glowBreathe{50%{opacity:.86;transform:scale(1.09)}}
.scene-orbit{position:absolute;left:50%;top:54%;transform:translate(-50%,-50%);border:1px solid rgba(101,91,239,.25);border-radius:50%;pointer-events:none}
.orbit-one{width:min(760px,86vw);height:150px;animation:orbitPulse 7s ease-in-out infinite}
.orbit-two{width:min(600px,70vw);height:100px;box-shadow:0 0 42px rgba(111,74,229,.08) inset;animation:orbitPulse 7s ease-in-out infinite reverse}
@keyframes orbitPulse{50%{transform:translate(-50%,-50%) scale(1.035);opacity:.58}}

/* Card — bigger & friendlier */
.generator-card{
  position:relative;z-index:9;width:min(620px,calc(100vw - 32px));padding:32px 34px 27px;
  border:1px solid rgba(130,112,231,.26);border-radius:26px;background:var(--surface);
  box-shadow:var(--shadow),0 0 55px rgba(111,75,232,.12);
  backdrop-filter:blur(22px) saturate(125%);-webkit-backdrop-filter:blur(22px) saturate(125%);
  transition:background .22s ease,border-color .22s ease,box-shadow .22s ease
}
html[data-theme="dark"] .generator-card{box-shadow:var(--shadow),0 0 0 1px rgba(255,255,255,.025) inset,0 0 70px rgba(104,72,225,.11)}
.generator-topline,.generator-heading-row,.field-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.generator-topline{margin-bottom:20px}
.generator-title{display:flex;align-items:center;gap:10px;color:var(--text);font-size:12px;letter-spacing:.055em}
.mini-lock{width:38px;height:38px;border-radius:11px}.mini-lock svg{width:18px;height:18px}
.protected-pill{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border:1px solid rgba(52,211,153,.28);border-radius:999px;background:rgba(52,211,153,.08);color:var(--green);font-size:10px;font-weight:850}
.protected-pill i,.realtime i{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 9px rgba(52,211,153,.38)}
.generator-heading-row{margin-bottom:18px}.generator-heading-row h1{margin:0;color:var(--text);font-size:32px;line-height:1.08;letter-spacing:-.035em}
.realtime{display:inline-flex;align-items:center;gap:7px;color:var(--green);font-size:10px;font-weight:900;letter-spacing:.045em}
.field-label-row{margin-bottom:8px}.field-label-row label,.pin-wrap label{color:var(--text-soft);font-size:11px;font-weight:900;letter-spacing:.045em}
.paste-button{border:0;background:transparent;padding:6px 2px;cursor:pointer;display:inline-flex;align-items:center;gap:5px;color:#8b6cff;font-size:11px;font-weight:850}
.paste-button svg{width:14px;height:14px}

/* Large field */
.access-shell{position:relative}
.access-shell input{
  width:100%;height:64px;padding:0 96px 0 17px;border:1px solid var(--field-line);border-radius:15px;outline:0;
  background:var(--field);color:var(--text);
  box-shadow:0 0 0 2px rgba(101,92,225,.08),inset 0 1px 2px rgba(0,0,0,.06);
  font:750 15px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.035em;
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease
}
.access-shell input::placeholder{color:var(--muted);opacity:.83}
.access-shell input:focus{border-color:#8e61fa;box-shadow:0 0 0 4px rgba(132,82,241,.11),0 8px 28px rgba(92,70,201,.09)}
.access-shell input.access-format-valid{border-color:rgba(49,211,155,.68);box-shadow:0 0 0 3px rgba(49,211,155,.08),0 0 26px rgba(49,211,155,.06)}
.bit-badge{position:absolute;right:13px;top:50%;transform:translateY(-50%);padding:7px 10px;border-radius:9px;border:1px solid rgba(130,81,228,.30);background:rgba(123,77,224,.12);color:#a98cff;font-size:9px;font-weight:900}
html[data-theme="light"] .bit-badge{background:#fff;color:#6e56df}

.pin-wrap{margin-top:13px}.pin-wrap input{
  width:100%;height:58px;padding:0 16px;margin-top:7px;border:1px solid var(--field-line);border-radius:14px;outline:0;background:var(--field);color:var(--text);font-size:17px;letter-spacing:.14em
}
.generate-button{
  width:100%;min-height:62px;margin-top:15px;border:0;border-radius:15px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;gap:10px;color:#fff;font-size:14px;font-weight:900;
  background:linear-gradient(100deg,#4f5ff0,#7350ef 54%,#a33deb);
  box-shadow:0 15px 35px rgba(102,72,230,.28);transition:transform .16s ease,box-shadow .16s ease,filter .16s ease
}
.generate-button:hover{transform:translateY(-1px);box-shadow:0 18px 42px rgba(102,72,230,.36);filter:saturate(1.08)}
.generate-button:active{transform:translateY(0) scale(.995)}.generate-button:disabled{opacity:.62;cursor:wait;transform:none}
.generate-button svg{width:20px;height:20px}
.privacy-note{margin-top:19px;display:flex;align-items:center;justify-content:center;gap:7px;color:var(--green);font-size:10px;line-height:1.5}
.privacy-note svg{width:14px;height:14px}
.error-box{margin-top:12px;padding:11px 13px;border:1px solid rgba(244,63,94,.22);border-radius:11px;background:rgba(244,63,94,.08);color:#ff8296;font-size:11px}

/* Results */
.result-card{margin-top:15px;padding:17px 18px;border:1px solid var(--line);border-radius:15px;background:var(--surface-soft)}
.identity{text-align:center}.identity small,.identity b,.identity span{display:block}.identity small{color:#8f76ff;font-size:8px;font-weight:900;letter-spacing:.13em}
.identity b{margin:4px 0 2px;font-size:17px}.identity span{color:var(--muted);font-size:10px}
.totp{width:100%;border:0;background:transparent;margin:8px 0 12px;padding:0;text-align:center;cursor:pointer;color:#9d79ff;font-size:clamp(42px,7vw,66px);font-weight:950;letter-spacing:.105em;text-shadow:0 5px 26px rgba(110,79,222,.17)}
.timer-row{display:grid;grid-template-columns:70px 1fr;gap:13px;align-items:center}
.ring{--p:100%;width:68px;height:68px;border-radius:50%;display:grid;place-items:center;position:relative;background:conic-gradient(#8269ff var(--p),rgba(130,105,255,.12) 0)}
.ring:after{content:"";position:absolute;inset:7px;border-radius:50%;background:var(--surface-solid)}
.ring b,.ring small{position:relative;z-index:2}.ring b{font-size:18px}.ring small{position:absolute;bottom:13px;font-size:7px;color:var(--muted)}
.timer-info strong{font-size:11px}.timer-info small{display:block;margin-top:5px;color:var(--muted);font-size:8px}
.track{height:9px;margin-top:6px;border-radius:999px;background:rgba(129,103,240,.12);overflow:hidden}.track i{display:block;width:100%;height:100%;border-radius:inherit;background:linear-gradient(90deg,#4fc8ee,#7165ef,#cb4ce9);transition:width .35s linear}

/* Animated ornaments */
.float-token{
  position:absolute;z-index:6;display:grid;place-items:center;border:1px solid var(--line);border-radius:17px;
  background:var(--surface-soft);color:#7763ff;box-shadow:0 18px 45px rgba(0,0,0,.12);backdrop-filter:blur(12px);
  will-change:transform;animation:permitFloat 5.2s ease-in-out infinite
}
.token-vault{width:78px;height:92px;left:7%;top:20%;transform:rotate(-5deg)}.token-vault .token-icon{font-size:31px}.token-vault small{position:absolute;bottom:9px;font-size:7px;color:var(--muted);font-weight:850}
.token-node{width:70px;height:74px;right:7%;top:23%;color:#43c8ff;font-size:27px;transform:rotate(5deg);animation-delay:-1.6s}
.token-cube{width:76px;height:76px;left:9%;bottom:19%;font-size:28px;animation-delay:-3s}
.float-dot{position:absolute;z-index:5;border-radius:50%;filter:blur(.2px);box-shadow:0 0 26px currentColor;animation:dotDrift 4.6s ease-in-out infinite}
.dot-one{width:20px;height:20px;right:14%;bottom:24%;color:#377dff;background:#377dff}
.dot-two{width:13px;height:13px;left:17%;top:30%;color:#8d4bff;background:#8d4bff;animation-delay:-2.1s}
@keyframes permitFloat{
  0%,100%{translate:0 0;rotate:-2deg}
  50%{translate:0 -17px;rotate:3deg}
}
@keyframes dotDrift{50%{translate:11px -13px;transform:scale(1.18)}}

/* Canvases + toast */
#ambient,#party{position:fixed;inset:0;width:100vw;height:100dvh;pointer-events:none}
#ambient{z-index:1}#party{z-index:60}
.toast{position:fixed;left:50%;bottom:26px;z-index:75;transform:translate(-50%,12px);opacity:0;padding:12px 16px;border:1px solid rgba(52,211,153,.27);border-radius:12px;background:rgba(10,17,36,.95);color:#dbfff2;font-size:11px;font-weight:850;box-shadow:0 20px 60px rgba(0,0,0,.35);transition:.2s}
html[data-theme="light"] .toast{background:rgba(255,255,255,.96);color:#147557;box-shadow:0 16px 48px rgba(73,67,122,.15)}
.toast.show{opacity:1;transform:translate(-50%,0)}
.hidden{display:none!important}.not-configured{text-align:center;padding:32px 5px}.not-configured h2{font-size:20px}.not-configured p{color:var(--text-soft);font-size:11px}
.not-configured a{display:inline-flex;margin-top:8px;padding:11px 14px;border-radius:10px;background:#7257ec;color:#fff;text-decoration:none;font-size:10px;font-weight:850}

/* Setup */
.setup-body{min-height:100dvh;display:grid;place-items:center;padding:22px;background:radial-gradient(circle at 20% 25%,#172255,transparent 35%),radial-gradient(circle at 85% 75%,#32145d,transparent 35%),#070b19;color:#f8fafc}
.setup-card{width:min(650px,100%);padding:32px;border:1px solid rgba(148,163,184,.20);border-radius:24px;background:rgba(13,20,42,.95);box-shadow:0 35px 100px rgba(0,0,0,.45)}
.setup-brand{display:flex;align-items:center;gap:12px}.setup-brand>span{width:50px;height:50px;border-radius:14px;display:grid;place-items:center;background:linear-gradient(135deg,#3b82f6,#7c3aed,#d946ef)}
.setup-brand b,.setup-brand small{display:block}.setup-brand em{font-style:normal;color:#9582ff}.setup-brand small{font-size:10px;color:#8c9ab3}
.setup-card h1{font-size:32px;margin:25px 0 6px}.setup-card>p{color:#a1aec4;line-height:1.65;font-size:13px}
.setup-card form{display:grid;gap:8px;margin-top:20px}.setup-card label{font-size:11px;font-weight:800}.setup-card input{height:50px;border:1px solid #435174;border-radius:12px;background:#080e20;color:#fff;padding:0 13px;outline:none;font-size:14px}
.setup-card input:focus{border-color:#7b65ff;box-shadow:0 0 0 3px rgba(123,101,255,.12)}
.setup-card button{height:52px;margin-top:10px;border:0;border-radius:12px;background:linear-gradient(90deg,#4d65eb,#7149ef,#af3fe9);color:#fff;font-weight:850;cursor:pointer}
.check-row{display:flex;align-items:center;gap:8px;margin-top:5px}.check-row input{width:17px;height:17px}.setup-security{display:flex;flex-wrap:wrap;gap:7px;margin-top:20px}.setup-security span{padding:8px 10px;border:1px solid rgba(52,211,153,.18);border-radius:999px;color:#73e2bb;font-size:9px}
.notice{padding:12px;border-radius:11px;margin:11px 0;font-size:12px}.notice.error{background:#3b1621;color:#ff93a4}.notice.success{background:#0c352b;color:#6ee7b7}

/* Tablet */
@media(max-width:900px){
  .permit-header{width:100%;height:72px;padding:0 18px}
  .permit-stage{min-height:calc(100dvh - 72px);padding:30px 14px 40px}
  .generator-scene{min-height:620px}
  .generator-card{width:min(600px,calc(100vw - 28px))}
  .token-vault{left:2%}.token-node{right:2%}.token-cube{left:4%}
}

/* Phones */
@media(max-width:640px){
  .permit-header{height:66px;padding:0 12px}
  .permit-brand{font-size:16px;gap:8px}.permit-brand-lock{width:35px;height:35px;border-radius:11px}.permit-brand-lock svg{width:17px;height:17px}
  .permit-header-actions{gap:7px}
  .theme-switch{padding:3px}.theme-switch button{min-width:40px;width:40px;height:36px;padding:0}.theme-switch button span{display:none}
  .permit-login{min-height:40px;padding:0 12px;font-size:11px}.permit-login span{display:none}.permit-login svg{width:17px;height:17px}
  .permit-stage{min-height:calc(100dvh - 66px);padding:20px 10px 30px}
  .generator-scene{min-height:565px}
  .generator-card{width:100%;padding:23px 17px 21px;border-radius:21px}
  .generator-title{font-size:10px}.mini-lock{width:33px;height:33px}.protected-pill{font-size:8px;padding:6px 8px}
  .generator-heading-row h1{font-size:25px}.realtime{font-size:8px}
  .field-label-row label,.pin-wrap label{font-size:9px}
  .access-shell input{height:58px;padding-left:13px;padding-right:78px;font-size:12px}
  .bit-badge{right:8px;padding:6px 7px;font-size:8px}
  .generate-button{min-height:58px;font-size:12px}
  .privacy-note{font-size:8.5px}
  .float-token,.float-dot{display:none}
  .scene-orbit{max-width:95vw}.orbit-one{height:95px}.orbit-two{height:62px}
  .totp{font-size:44px}
}

/* Very small phones */
@media(max-width:380px){
  .generator-card{padding-left:14px;padding-right:14px}
  .generator-heading-row h1{font-size:22px}
  .protected-pill{max-width:92px}
  .access-shell input{font-size:10.5px}
}

/* Landscape / low-height screens */
@media(max-height:650px) and (min-width:641px){
  .permit-header{height:64px}
  .permit-stage{min-height:calc(100dvh - 64px);padding:12px 15px 18px}
  .generator-scene{min-height:510px}
  .generator-card{padding-top:22px;padding-bottom:20px}
  .generator-topline{margin-bottom:12px}.generator-heading-row{margin-bottom:12px}
  .access-shell input{height:55px}.generate-button{min-height:54px}
  .privacy-note{margin-top:12px}
}

/* Respect accessibility settings, but keep a static visual scene. */
@media(prefers-reduced-motion:reduce){
  .float-token,.float-dot,.scene-glow,.scene-orbit{animation:none!important}
  .permit-login,.generate-button{transition:none!important}
}
