:root{
  --bg0:#050612;
  --bg1:#07081a;
  --panel: rgba(14,16,30,.62);
  --panel2: rgba(10,12,22,.78);
  --line: rgba(255,255,255,.09);
  --text:#eaf0ff;
  --muted:#a7b0d6;

  --accent:#6b78ff;
  --accent2:#56c0ff;
  --danger:#ff4d6d;
  --good:#36d399;

  --shadow: 0 18px 70px rgba(0,0,0,.45);
  --shadow2: 0 12px 44px rgba(0,0,0,.35);
  --r: 18px;
}

*{ box-sizing:border-box; }

html, body { height:100%; }
html, body { min-height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:
    radial-gradient(900px 520px at 55% 0%, rgba(107,120,255,.25), transparent 62%),
    radial-gradient(900px 520px at 20% 12%, rgba(86,192,255,.18), transparent 60%),
    radial-gradient(1200px 720px at 90% 40%, rgba(255,77,109,.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  color:var(--text);
  overflow-x:hidden;
}

.hidden{ display:none !important; }
.muted{ color:var(--muted); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.btn, button{
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(14,16,30,.78);
  color:var(--text);
  cursor:pointer;
  transition: transform .08s ease, border-color .15s ease, background .15s ease, filter .15s ease;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover, button:hover{
  border-color: rgba(107,120,255,.42);
  filter: brightness(1.05);
}
.btn:active, button:active{
  transform: translateY(1px);
}

.btn.primary{
  border-color: rgba(107,120,255,.65);
  background: linear-gradient(180deg, rgba(107,120,255,.28), rgba(107,120,255,.16));
  box-shadow: 0 0 0 6px rgba(107,120,255,.08);
}
.btn.danger{
  border-color: rgba(255,77,109,.65);
  background: linear-gradient(180deg, rgba(255,77,109,.22), rgba(255,77,109,.12));
}
.btn.ghost{
  background: transparent;
}

.btn:disabled, button:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
  filter:none;
}

input{
  border:1px solid var(--line);
  background: rgba(10,12,22,.72);
  color:var(--text);
  border-radius:14px;
  outline:none;
  padding:10px 12px;
}
input:focus{
  border-color: rgba(107,120,255,.45);
  box-shadow: 0 0 0 6px rgba(107,120,255,.08);
}
.search{
  width:100%;
}

@font-face{
  font-family: "Coffee";
  src: url("/fonts/font.ttf") format("truetype");
  font-display: swap;
}
@font-face{
  font-family: "Bubble";
  src: local("Bubblegum Sans"),
       url("/fonts/Bubblegum.otf") format("opentype");
  font-display: swap;
}

.loginView{
  min-height: 100vh;
  display:flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.loginCard{
  width: min(980px, 100%);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 26px;
  background:
    radial-gradient(700px 380px at 20% 0%, rgba(86,192,255,.18), transparent 55%),
    radial-gradient(700px 380px at 80% 10%, rgba(107,120,255,.22), transparent 55%),
    rgba(10,12,22,.55);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  overflow:hidden;
  position: relative;
}

.loginBrand{
  display:flex;
  gap:12px;
  align-items:center;
  padding: 18px 18px 0;
}

.dot{
  width:12px; height:12px; border-radius:999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 18px rgba(107,120,255,.55);
}

.loginTitle{
  font-weight: 950;
  letter-spacing:.2px;
  font-size: 18px;
}
.loginSub{
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.loginHero{
  padding: 22px 22px 26px;
  display:grid;
  gap: 14px;
}

.heroTitle{
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 950;
  letter-spacing:.2px;
  line-height: 1.05;
}

.heroText{
  color: var(--muted);
  font-size: 14px;
  max-width: 62ch;
  line-height: 1.5;
}

.heroBullets{
  display:grid;
  gap: 6px;
  color: rgba(234,240,255,.85);
  font-size: 13px;
}
.heroBullets .b{
  padding-left: 2px;
}

.ctaBtn{
  margin-top: 6px;
  width: min(420px, 100%);
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(107,120,255,.68);
  background:
    radial-gradient(700px 200px at 50% 0%, rgba(86,192,255,.28), transparent 60%),
    linear-gradient(180deg, rgba(107,120,255,.34), rgba(107,120,255,.18));
  box-shadow:
    0 18px 60px rgba(107,120,255,.20),
    0 0 0 8px rgba(107,120,255,.08);
  font-weight: 950;
  font-size: 15px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.ctaBtn:hover{ filter: brightness(1.08); transform: translateY(-1px); }
.ctaBtn:active{ transform: translateY(0px); }

.ctaIcon{
  display:inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  align-items:center;
  justify-content:center;
  background: rgba(86,192,255,.18);
  border: 1px solid rgba(86,192,255,.30);
  box-shadow: 0 0 0 6px rgba(86,192,255,.07);
}

.loginFine{
  color: rgba(167,176,214,.95);
  font-size: 12px;
}

.loginFooter{
  margin-top: 14px;
  color: rgba(167,176,214,.75);
  font-size: 12px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 18px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  background: rgba(7,8,18,.55);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand{ display:flex; gap:12px; align-items:center; }
.title{ font-weight:950; letter-spacing:.2px; }
.subtitle{ font-size:12px; color:var(--muted); margin-top:2px; }

.topbarRight{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.pill{
  padding:10px 12px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  background: rgba(16,18,32,.55);
  color: var(--text);
  font-size: 12.5px;
  white-space: nowrap;
}

.page{ padding: 16px; }

.pageAlbums{
  max-width: 1200px;
  margin: 0 auto;
}

.albumsHeader{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-end;
  margin: 10px 0 14px;
  flex-wrap:wrap;
}

.hTitle{
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 950;
  letter-spacing:.2px;
}
.hSub{ color: var(--muted); margin-top: 6px; }

.albumsActions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.segmented{
  display:flex;
  gap:8px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(16,18,32,.40);
  backdrop-filter: blur(10px);
}
.segBtn{
  padding:10px 14px;
  border-radius: 999px;
  border:1px solid transparent;
  background: transparent;
  font-weight: 950;
}
.segBtn.active{
  border-color: rgba(107,120,255,.55);
  background: rgba(107,120,255,.16);
}

.dashPanel{ margin-top: 10px; }

.albumsGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
  margin-top: 12px;
}
@media (max-width: 900px){
  .albumsGrid{ grid-template-columns: 1fr; }
}

.albumCard{
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(16,18,32,.48);
  border-radius: 22px;
  padding:14px;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(12px);
}

.albumHead{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}

.albumName{ font-weight:950; font-size: 18px; }
.albumMeta{ color: var(--muted); font-size: 12px; margin-top: 4px; }
.albumActions{ display:flex; gap:8px; flex-wrap: wrap; }

.albumPreview{
  margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 10px;
}
.previewLine{
  font-size: 12px;
  color: rgba(167,176,214,.92);
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.previewLine:last-child{ border-bottom: none; }

.emptyState{
  grid-column: 1 / -1;
  border:1px dashed rgba(255,255,255,0.16);
  border-radius: 22px;
  padding: 18px;
  background: rgba(12,14,26,.46);
}
.emptyTitle{ font-weight: 950; font-size: 18px; }
.emptySub{ color: var(--muted); margin-top: 6px; }

.bgBrowserHeader{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 10px;
}
.bgBrowserGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
@media (max-width: 900px){
  .bgBrowserGrid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px){
  .bgBrowserGrid{ grid-template-columns: 1fr; }
}

.bgBrowserCard{
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(16,18,32,.48);
  border-radius: 22px;
  padding: 12px;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(12px);
}
.bgBrowserThumb{
  width:100%;
  height: 150px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}
.bgBrowserName{
  margin-top: 10px;
  font-weight: 950;
}
.bgBrowserMeta{
  margin-top: 6px;
  color: rgba(167,176,214,.92);
  font-size: 12px;
  line-height: 1.4;
}
.badge{
  display:inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(12,14,26,.55);
  font-size: 12px;
  font-weight: 950;
}
.badge.owned{
  border-color: rgba(86,192,255,.35);
  background: rgba(86,192,255,.14);
}

.bgBrowserPagination{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin-top:14px;
}

.pageEditor{
  padding: 12px 14px 18px;
  max-width: 1400px;
  margin: 0 auto;
}

.editorHeader{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  margin: 12px 0 12px;
}

.editorMeta{ flex:1; min-width: 220px; }
.editorTitle{ font-weight: 950; font-size: 18px; }
.editorSub{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.editorRight{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
}
.pagePicker{
  display:flex;
  gap:8px;
  align-items:center;
  padding: 6px;
  border-radius: 18px;
  background: rgba(16,18,32,.40);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
}
#pageInput{
  width: 110px;
  height: 44px;
  font-size: 16px;
  text-align: center;
}

.editorLayout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 1020px){
  .editorLayout{ grid-template-columns: 1fr; }
}

.dock{
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 22px;
  background: rgba(16,18,32,.48);
  overflow:hidden;
  position: sticky;
  top: 84px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow2);
}
@media (max-width: 1020px){
  .dock{ position: relative; top: 0; }
}

.dockTabs{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,10,20,.40);
}

.tabBtn{
  padding:12px 10px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(12,14,26,.55);
  color: var(--text);
  font-weight: 950;
}
.tabBtn.active{
  border-color: rgba(107,120,255,.55);
  background: rgba(107,120,255,.16);
}

.dockPanels{ padding: 12px; }

.panelDock{ display:none; }
.panelDock.show{ display:block; }

.panelTitle{
  font-weight: 950;
  margin-bottom: 10px;
}

.row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 8px;
}

.chk{
  color: var(--muted);
  font-size: 13px;
  display:flex;
  gap:8px;
  align-items:center;
}

.smallNote{
  margin-top:10px;
  color: rgba(167,176,214,.92);
  font-size: 12px;
  line-height: 1.4;
}

.box{
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  background: rgba(10,12,22,.60);
  padding: 12px;
}
.boxTitle{
  font-weight: 950;
  margin-bottom: 10px;
}

.nudgeGrid{
  display:grid;
  grid-template-columns: 46px 46px 46px;
  grid-template-rows: 46px 46px;
  gap: 10px;
}
.nudgeBtn{
  padding: 10px;
  border-radius: 16px;
  font-weight: 950;
}

.albumItemsList{
  display:flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow:auto;
  padding-right: 4px;
}
.albumItemRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(10,12,22,.78);
  padding: 12px;
}
.albumItemLeft{ display:flex; flex-direction: column; gap: 2px; }
.albumItemCode{ font-weight: 950; }
.albumItemMeta{ color: rgba(167,176,214,.92); font-size: 12px; }
.albumItemActions{ display:flex; gap:8px; flex-wrap: wrap; }

.cardsList{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  max-height: 380px;
  overflow:auto;
  padding-right: 4px;
}
@media (max-width: 650px){
  .cardsList{ grid-template-columns: 1fr; max-height: 300px; }
}
.cardTile{
  border:1px solid rgba(255,255,255,0.10);
  border-radius:18px;
  background: rgba(10,12,22,.76);
  padding:12px;
  cursor: grab;
  user-select:none;
  display:flex;
  gap:12px;
  align-items:center;
  touch-action: manipulation;
}
.cardTile:active{ cursor: grabbing; }
.cardTile .thumb{
  width:46px; height:46px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.12);
  object-fit: cover;
  background: rgba(255,255,255,0.06);
}
.cardTile .code{ font-weight: 950; }
.cardTile .meta{ color: rgba(167,176,214,.92); font-size: 12px; margin-top: 4px; }

.selectedInfo{
  color: rgba(167,176,214,.95);
  font-size: 13px;
}

.bgShop{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  max-height: 440px;
  overflow:auto;
  padding-right: 4px;
}
@media (max-width: 600px){
  .bgShop{ grid-template-columns: 1fr; }
}
.bgCard{
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(10,12,22,.76);
  border-radius: 18px;
  padding: 12px;
  overflow:hidden;
}
.bgThumb{
  width:100%;
  height: 120px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}
.bgName{ font-weight: 950; margin-top: 10px; }
.bgMeta{ color: rgba(167,176,214,.92); font-size: 12px; margin-top: 6px; line-height: 1.35; }
.bgActions{ display:flex; gap:10px; margin-top: 12px; }
.bgActions button{ flex:1; }

.canvasWrap{
  border:1px solid rgba(255,255,255,0.10);
  border-radius: 22px;
  padding: 14px;
  background: rgba(16,18,32,.45);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.canvasTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom: 12px;
}
.hint{ color: rgba(167,176,214,.95); font-size: 13px; }
.hint2{ color: rgba(167,176,214,.85); font-size: 12px; }

.canvasOuter{
  width: 100%;
  overflow:auto;
  border-radius: 18px;
}

.canvas{
  position: relative;
  width: 1160px;
  height: 830px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background:
    radial-gradient(700px 340px at 50% 20%, rgba(107,120,255,.12), transparent),
    rgba(8,10,20,.65);
  overflow: hidden;
  outline:none;
}

.bgLayer{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit: cover;
  opacity: 0.96;
  z-index: 0;
  pointer-events:none;
}

.canvas .grid{
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events:none;
  opacity: 0.24;
  z-index: 1;
}

.canvas .symmetry{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index: 50;
  opacity: 0;
  transition: opacity .12s ease;
}
.canvas.symmetryOn .symmetry{ opacity: 1; }

.canvas .symmetry::before,
.canvas .symmetry::after{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(to right, rgba(86,192,255,0.35) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(86,192,255,0.35) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .75;
}
.canvas .symmetry::after{
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 580px 415px;
  opacity: .45;
}
.canvas .symmetryCenter{
  position:absolute;
  left:50%;
  top:0;
  width:1px;
  height:100%;
  background: rgba(255,255,255,0.18);
}
.canvas .symmetryCenter2{
  position:absolute;
  top:50%;
  left:0;
  height:1px;
  width:100%;
  background: rgba(255,255,255,0.18);
}

.item{
  position:absolute;
  width:290px;
  height:415px;
  border-radius:16px;
  user-select:none;
  cursor:move;
  box-shadow: 0 18px 64px rgba(0,0,0,0.55);
  z-index: 5;
  transform-origin: center center;
  touch-action: none;
}
.item.selected{
  outline: 2px solid rgba(86,192,255,0.85);
  box-shadow:
    0 0 0 8px rgba(86,192,255,0.14),
    0 18px 64px rgba(0,0,0,0.55);
}
.item .char{
  position:absolute;
  left:32px;
  top:33px;
  width:225px;
  height:350px;
  object-fit:cover;
  border-radius:12px;
}
.item .frame{
  position:absolute;
  inset:0;
  width:290px;
  height:415px;
  object-fit:contain;
  pointer-events:none;
}

.item .name{
  position:absolute;
  left:35px;
  top:330px;
  width:220px;
  height:64px;
  font-family:"Coffee", system-ui, sans-serif;
  font-size:24px;
  line-height:1.15;
  font-weight:400;
  color:#fff;
  text-align:center;
  overflow:hidden;
  display:flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 6px 4px;
  pointer-events:none;
  text-shadow:
    1px 1px 0 #000,
   -1px 1px 0 #000,
    1px -1px 0 #000,
   -1px -1px 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000,
    1px 0 0 #000,
   -1px 0 0 #000;
}

.item .print{
  position:absolute;
  left:225px;
  top:298px;
  transform: translate(-50%, -50%);
  font-family:"Bubble", system-ui, sans-serif;
  font-size:22px;
  font-weight:400;
  color:#fff;
  pointer-events:none;
  text-shadow:
    1px 1px 0 #000,
   -1px 1px 0 #000,
    1px -1px 0 #000,
   -1px -1px 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000,
    1px 0 0 #000,
   -1px 0 0 #000;
}

#saveBtn{
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 800;
}

@media (max-width: 520px){
  .topbarRight{ gap: 8px; width:100%; }
  .pill{ width: 100%; }
  .ctaBtn{ width: 100%; }
  .albumsHeader{ align-items:flex-start; }
  .albumsActions{ width:100%; justify-content:flex-start; }
  .segmented{ width:100%; justify-content:space-between; }
  .segBtn{ width:100%; }
  .editorRight{ width:100%; justify-content:space-between; }
  .pagePicker{ width:100%; justify-content:space-between; }
  #pageInput{ width: 90px; }
}

@media (max-width: 420px){
  .dockTabs{ grid-template-columns: 1fr; }
  .nudgeGrid{ grid-template-columns: 1fr 1fr 1fr; }
}

::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.20);
}
::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
}