:root{
  --ink:#111;
  --paper:#fff4df;
  --paper2:#fffaf0;
  --acid:#b8ff1a;
  --hot:#ff4b66;
  --muted:#5b4f43;
  --shadow:7px 7px 0 #000;
  --line:3px solid #111;
  --radius:22px;
}
*{box-sizing:border-box}
html,body{
  margin:0;
  min-height:100%;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 10% 5%,rgba(184,255,26,.25),transparent 24%),
    radial-gradient(circle at 92% 8%,rgba(255,75,102,.28),transparent 28%),
    linear-gradient(135deg,#0b0b0b,#2a090f 72%,#050505);
}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
#app{min-height:100vh}
.boot{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}
.card,.topbar,.panel,.auth-card,.zine-card,.reader-bar{
  background:var(--paper);
  border:var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.boot-card{
  background:var(--paper);
  border:var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:26px;
  width:min(680px,100%);
}
.logo{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  background:var(--acid);
  border:var(--line);
  border-radius:15px;
  box-shadow:4px 4px 0 var(--hot);
  font-weight:1000;
}
.app{
  min-height:100vh;
  display:grid;
  grid-template-columns:210px minmax(0,1fr);
}
.sidebar{
  background:rgba(0,0,0,.83);
  color:#fff;
  border-right:4px solid var(--acid);
  padding:14px 10px;
  display:grid;
  align-content:start;
  gap:14px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-title{
  font-weight:1000;
  line-height:.95;
  font-size:1.22rem;
}
.brand-sub{
  color:#f3d7bf;
  font-weight:800;
  font-size:.82rem;
}
.nav,.account{display:grid;gap:9px}
.main{
  padding:16px 18px 22px;
  display:grid;
  align-content:start;
  gap:14px;
}
.topbar{
  min-height:74px;
  padding:12px 18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.topbar h1{
  margin:0;
  font-size:clamp(2rem,4vw,3.4rem);
  line-height:.9;
  letter-spacing:-.04em;
}
.topbar p{
  margin:5px 0 0;
  color:var(--muted);
  font-weight:850;
}
.btn,.primary,.secondary,.hot,.danger,.tab{
  border:var(--line);
  border-radius:14px;
  padding:9px 12px;
  box-shadow:3px 3px 0 #000;
  font-weight:1000;
  text-align:center;
}
.btn,.secondary,.tab{background:var(--paper2);color:var(--ink)}
.primary,.tab.active{background:var(--acid);color:var(--ink)}
.hot{background:var(--hot);color:#fff}
.danger{background:#cf1f3f;color:#fff}
.account-name{
  background:var(--acid);
  color:var(--ink);
  border:var(--line);
  border-radius:14px;
  padding:10px;
  font-weight:1000;
  text-align:center;
}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.landing{
  display:grid;
  gap:16px;
  max-width:1080px;
  margin:0 auto;
}
.landing .card{padding:28px}
.big-logo{
  width:76px;
  height:76px;
  font-size:1.8rem;
  margin-bottom:18px;
}
.chip{
  display:inline-flex;
  border:var(--line);
  border-radius:999px;
  padding:8px 12px;
  background:#fff;
  color:var(--hot);
  box-shadow:3px 3px 0 #000;
  font-weight:1000;
  margin-bottom:14px;
}
.landing h2{
  margin:0 0 16px;
  font-size:clamp(3rem,8vw,6rem);
  line-height:.85;
  letter-spacing:-.08em;
  text-transform:uppercase;
  white-space:pre-line;
}
.landing p{
  font-size:1.13rem;
  line-height:1.5;
  font-weight:850;
}
.auth-wrap{
  display:grid;
  place-items:center;
  min-height:55vh;
}
.auth-card{
  width:min(620px,100%);
  padding:24px;
  display:grid;
  gap:12px;
}
.auth-card h2{margin:0;font-size:2.3rem}
input,textarea,select{
  width:100%;
  border:var(--line);
  border-radius:13px;
  background:#eef3ff;
  color:var(--ink);
  padding:10px;
  font-weight:850;
}
textarea{resize:vertical}
.hub-toolbar{display:flex;justify-content:flex-end}
.search{max-width:440px;background:var(--paper)}
.hub-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,300px));
  gap:18px;
}
.zine-card{padding:14px}
.preview-wrap{
  height:240px;
  background:#111;
  border-radius:18px;
  padding:14px;
  display:grid;
  place-items:center;
}
.preview-page{
  width:130px;
  height:190px;
  background:var(--paper2);
  border:2px solid var(--ink);
  padding:15px;
  font-weight:1000;
  overflow:hidden;
}
.zine-card h2{margin:12px 0 8px;font-size:1.6rem}
.zine-card p{font-weight:850;margin:7px 0}
.zine-actions{display:grid;gap:8px}
.studio{
  display:grid;
  grid-template-columns:170px minmax(920px,1fr) 245px;
  gap:12px;
  align-items:start;
}
.panel{
  padding:12px;
  display:grid;
  gap:9px;
}
.tools,.inspector{
  position:sticky;
  top:12px;
  max-height:calc(100vh - 24px);
  overflow:auto;
}
.panel h2,.panel h3{margin:0}
.panel label{
  display:grid;
  gap:4px;
  font-weight:900;
  font-size:.86rem;
}
.panel button,.panel input,.panel select,.panel textarea{
  min-height:34px;
  padding:7px 9px;
  font-size:.86rem;
}
.divider{
  border-top:1px dashed rgba(0,0,0,.35);
  margin:5px 0;
}
.hint{
  color:var(--muted);
  font-size:.8rem;
  font-weight:800;
  line-height:1.3;
}
.stage{
  display:grid;
  gap:12px;
}
.stage-head{
  background:var(--paper);
  border:var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  min-height:64px;
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.stage-head h2{margin:0;font-size:1.45rem}
.stage-head p{margin:4px 0 0;color:var(--muted);font-weight:850}
.workbench{
  background:rgba(0,0,0,.64);
  border-radius:24px;
  min-height:calc(100vh - 205px);
  padding:16px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:18px;
  overflow:auto;
}
.page-block{
  display:grid;
  gap:8px;
  justify-items:center;
}
.page-label{
  width:100%;
  background:#101010;
  color:white;
  border:2px dashed rgba(255,255,255,.4);
  border-radius:9px;
  text-align:center;
  padding:4px 8px;
  font-weight:1000;
  font-size:.8rem;
  letter-spacing:.04em;
}
.canvas-outer{position:relative;flex:0 0 auto}
.canvas{
  position:absolute;
  left:0;
  top:0;
  border:var(--line);
  box-shadow:var(--shadow);
  transform-origin:top left;
  overflow:visible;
}
.margin{
  position:absolute;
  border:1.5px dashed rgba(0,0,0,.45);
  pointer-events:none;
  z-index:1;
}
.page-num{
  position:absolute;
  right:12px;
  bottom:12px;
  width:25px;
  height:25px;
  border-radius:50%;
  background:#111;
  color:#fff;
  display:grid;
  place-items:center;
  font-weight:1000;
  z-index:50;
}
.el{
  position:absolute;
  z-index:10;
  overflow:visible;
  padding:4px;
  cursor:pointer;
  user-select:none;
}
.text-el{line-height:1.05}
.editable{
  width:100%;
  height:100%;
  outline:none;
  overflow:hidden;
}
.img-el{overflow:hidden}
.img-el img{
  width:100%;
  height:100%;
  display:block;
  pointer-events:none;
  transform-origin:center center;
}
.el.selected{
  outline:2px dashed var(--hot);
  background:rgba(255,75,102,.06);
  z-index:80;
}
.move{
  position:absolute;
  left:-12px;
  top:-12px;
  width:24px;
  height:24px;
  border:2px solid #111;
  border-radius:50%;
  background:var(--acid);
  box-shadow:2px 2px 0 #000;
  display:grid;
  place-items:center;
  font-weight:1000;
  z-index:90;
  cursor:grab;
  padding:0;
  touch-action:none;
}
.resize{
  position:absolute;
  right:-12px;
  bottom:-12px;
  width:24px;
  height:24px;
  border:2px solid #111;
  border-radius:50%;
  background:var(--hot);
  box-shadow:2px 2px 0 #000;
  z-index:90;
  cursor:nwse-resize;
  padding:0;
  touch-action:none;
}
.tabs{
  background:var(--paper);
  border:var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:9px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  position:sticky;
  bottom:8px;
  z-index:40;
}
.page-nav{
  display:grid;
  grid-template-columns:36px 1fr 36px;
  gap:6px;
}
.two{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.reader{
  display:grid;
  gap:14px;
}
.reader-bar{
  padding:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.reader-bar h2{margin:0}
.reader-book{
  background:rgba(0,0,0,.64);
  border-radius:24px;
  min-height:calc(100vh - 220px);
  padding:18px;
  display:grid;
  grid-template-columns:56px 1fr 56px;
  gap:14px;
  align-items:center;
}
.reader-arrow{
  border:var(--line);
  border-radius:14px;
  background:var(--paper);
  font-size:2rem;
  font-weight:1000;
  padding:8px;
}
.reader-spread{
  display:flex;
  justify-content:center;
  gap:18px;
}
.reader-page{
  width:530px;
  aspect-ratio:612/792;
  background:var(--paper2);
  border:var(--line);
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}
.reader-scale{
  position:relative;
  transform-origin:top left;
}
pre{white-space:pre-wrap;overflow:auto}
@media(max-width:1350px){
  .studio{grid-template-columns:1fr}
  .tools,.inspector{position:relative;top:0;max-height:none}
  .workbench{justify-content:flex-start}
}
@media(max-width:850px){
  .app{grid-template-columns:1fr}
  .sidebar{border-right:none;border-bottom:4px solid var(--acid)}
  .reader-book{grid-template-columns:1fr}
  .reader-spread{flex-direction:column;align-items:center}
  .reader-page{width:92vw}
}

/* PATCH page blocks / booklet order */
.page-label {
  min-height: 28px;
}

.page-block .page-label {
  text-transform: uppercase;
}

.reserve-page-note {
  background: #fff1b8;
  border: 2px solid #111;
  border-radius: 12px;
  padding: 8px;
  font-weight: 900;
}

.tools .primary {
  background: var(--acid);
}


/* PATCH sidebar distribution + support page */
.sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-height: 100vh;
}

.nav {
  background: rgba(255,255,255,.03);
  border: 1px dashed rgba(255,255,255,.25);
  border-radius: 14px;
  padding: 8px;
}

.account-card {
  border: 1px dashed rgba(255,255,255,.35);
  border-radius: 14px;
  padding: 8px;
  margin-top: auto;
}

.account-card .btn,
.account-card .primary,
.account-card .danger {
  width: 100%;
}

.support-btn {
  border: var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 3px 3px 0 #000;
  font-weight: 1000;
  text-align: center;
  background: #ffe88a;
  color: var(--ink);
}

.support-page {
  display: grid;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.support-hero {
  padding: 28px;
}

.support-hero h2 {
  margin: 0 0 16px;
  font-size: clamp(3rem, 7vw, 5.6rem);
  line-height: .85;
  letter-spacing: -.08em;
  white-space: pre-line;
  text-transform: uppercase;
}

.support-hero p {
  font-size: 1.1rem;
  line-height: 1.45;
  font-weight: 850;
  max-width: 820px;
}

.support-status {
  margin-top: 14px;
  background: #111;
  color: var(--acid);
  border: 3px solid #111;
  border-radius: 16px;
  padding: 12px;
  font-weight: 1000;
  box-shadow: 4px 4px 0 var(--hot);
}

.support-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.support-item {
  background: var(--paper2);
  border: 3px solid #111;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 4px 4px 0 #111;
}

.support-item h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.support-item p {
  margin: 0;
  line-height: 1.35;
  font-weight: 800;
}

.support-note {
  padding: 20px;
}

.support-note h2 {
  margin-top: 0;
}

.support-note p {
  font-weight: 850;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .support-grid {
    grid-template-columns: 1fr;
  }
}


/* PATCH real compute provider consent */
.support-consent {
  margin: 14px 0;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  background: #fffaf0;
  border: 3px solid #111;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 4px 4px 0 #111;
  font-weight: 900;
  line-height: 1.35;
}

.support-consent input {
  width: 20px;
  height: 20px;
  margin-top: 3px;
}

.support-throttle {
  margin: 10px 0 14px;
  display: grid;
  gap: 6px;
  max-width: 420px;
  font-weight: 1000;
}

.support-throttle select {
  border: 3px solid #111;
  border-radius: 14px;
  padding: 9px 10px;
  background: #eef3ff;
  font-weight: 900;
}

.support-mini {
  margin-top: 10px;
  background: #fffaf0;
  color: #111;
  border: 2px dashed #111;
  border-radius: 14px;
  padding: 10px;
  font-weight: 900;
  font-size: .9rem;
}


/* PATCH simple text editor + modern fonts + booklet print */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Bebas+Neue&family=Bricolage+Grotesque:wght@400;600;800&family=IBM+Plex+Mono:wght@400;700&family=Inter:wght@400;700;900&family=Space+Grotesk:wght@400;700&family=Syne:wght@700;800&display=swap');

body,
button,
input,
textarea,
select {
  font-family: "Bricolage Grotesque", "Inter", Arial, sans-serif;
}

.editable {
  cursor: text;
  user-select: text;
  white-space: pre-wrap;
}

.text-el {
  user-select: text;
}

.img-el {
  overflow: hidden;
}

.canvas,
.canvas-outer,
.page-block,
.workbench {
  overflow: visible;
}

.el.selected {
  outline: 2px dashed var(--hot);
  background: rgba(255, 75, 102, .06);
}

.tools button,
.inspector button {
  letter-spacing: .01em;
}

.inspector textarea {
  min-height: 120px;
  font-family: "Inter", Arial, sans-serif;
  line-height: 1.35;
}

.inspector select {
  font-family: "Bricolage Grotesque", "Inter", Arial, sans-serif;
}

.primary {
  background: var(--acid);
}

.stage-head {
  z-index: 40;
}

.workbench {
  isolation: isolate;
}

.canvas {
  z-index: 10;
}

.page-block:hover .canvas {
  z-index: 20;
}


/* PATCH fluid text autosave */
.save-status {
  margin-top: 4px !important;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .01em;
}

.save-status.ok {
  color: #1f6b00;
}

.save-status.warn {
  color: #b00020;
}

.save-status.dirty {
  color: #7a4a00;
}

.editable {
  min-height: 100%;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  white-space: pre-wrap;
}

.text-el {
  user-select: text;
  -webkit-user-select: text;
}

.text-el.selected {
  cursor: text;
}

.inspector textarea {
  min-height: 140px;
  line-height: 1.35;
}

.tools .danger {
  background: #cf1f3f;
  color: #fff;
}


/* PATCH direct canvas text editing */
.text-el {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.text-el .editable {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  min-height: 100%;
  outline: none;
  white-space: pre-wrap;
  caret-color: #111;
}

.text-el.selected .editable {
  outline: none;
}

.text-el.selected {
  background: rgba(255, 75, 102, .035);
}

.editable:focus {
  outline: none;
}

.inspector textarea[data-inspector-text-id] {
  min-height: 120px;
}

.move,
.resize {
  user-select: none;
  -webkit-user-select: none;
}
