/* Evernest Design Studio (/studio) and the shared design page (/d/<code>). Builds on site.css. */
[hidden] { display: none !important; }
.err { color: var(--coral-d); font-weight: 900; min-height: 1em; margin: 6px 0; }
.studio { padding-top: 28px; padding-bottom: 20px; }
.studio-head { text-align: center; margin-bottom: 22px; }
.studio-head .lead { max-width: 720px; margin: 14px auto 0; color: var(--ink2); font-size: clamp(16px, 2vw, 19px); }
.st-h { font-family: Fredoka, sans-serif; color: var(--head); font-size: 24px; margin: 0 0 12px; }
.st-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.st-grid + .frost, .frost + .st-grid, .st-templates { margin-top: 20px; }
.st-side { display: grid; gap: 20px; min-width: 0; }
.st-editor, .st-account { min-width: 0; }
.st-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.st-end { justify-content: flex-end; }
.st-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; color: var(--ink2); }

.studio input[type=text], .studio input[type=password], .studio input:not([type]), .studio select, .st-dialog input, .dz-report textarea {
  font: inherit; font-weight: 800; color: var(--ink); background: #fff; border: 2px solid #e6ecf7; border-radius: 14px; padding: 9px 12px; min-width: 0; }
.studio input:focus, .studio select:focus, .st-dialog input:focus, .dz-report textarea:focus { outline: none; border-color: var(--sky); }
.studio input:focus-visible, .studio select:focus-visible, .studio button:focus-visible, .st-dialog input:focus-visible { outline: 3px solid var(--sky-d); outline-offset: 2px; }
.studio input[type=color] { width: 44px; height: 36px; padding: 2px; border: 2px solid #e6ecf7; border-radius: 12px; background: #fff; cursor: pointer; }

/* small buttons */
.sb { font: inherit; font-family: Fredoka, sans-serif; font-weight: 500; font-size: 15px; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer;
  background: #fff; color: var(--head); box-shadow: 0 3px 0 rgba(120,140,200,.3); white-space: nowrap; }
.sb:hover { filter: brightness(.98); }
.sb:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120,140,200,.3); }
.sb:disabled, .btn:disabled, .tb:disabled { opacity: .45; cursor: default; }
.sb.danger { color: var(--coral-d); }
.btn.danger { background: linear-gradient(180deg, #f79a8e, var(--coral)); box-shadow: 0 4px 0 var(--coral-d); }

/* name + type */
.st-top { align-items: flex-end; }
.st-name { display: grid; gap: 4px; font-size: 13px; font-weight: 900; color: var(--ink2); flex: 1 1 200px; }
.st-types { display: flex; flex-wrap: wrap; gap: 6px; }
.ty { font: inherit; font-family: Fredoka, sans-serif; font-weight: 500; font-size: 15px; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(120,140,200,.25); }
.ty[aria-checked=true] { background: linear-gradient(180deg, #9cd6ff, var(--sky)); color: #fff; box-shadow: 0 3px 0 var(--sky-d); }
.st-type-hint { margin: 8px 0 12px; }

/* toolbar */
.st-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.st-group { display: flex; gap: 4px; background: rgba(255,255,255,.7); border-radius: 16px; padding: 4px; box-shadow: inset 0 0 0 2px rgba(230,236,247,.9); }
.tb { font: inherit; font-size: 18px; line-height: 1; border: 0; border-radius: 12px; min-width: 44px; height: 44px; padding: 3px 6px; cursor: pointer; background: transparent; color: var(--ink);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tb span { font-size: 10px; font-weight: 900; letter-spacing: .3px; color: var(--ink2); }
.tb:hover:not(:disabled) { background: #fff; }
.tb[aria-pressed=true] { background: linear-gradient(180deg, #ffb3cd, var(--pink)); color: #fff; box-shadow: 0 2px 0 var(--pink-d); }
.tb[aria-pressed=true] span { color: #fff; }
.st-shift .tb { min-width: 36px; font-weight: 900; }
.st-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; color: var(--ink2); }
.st-zoom select { padding: 6px 8px; border-radius: 12px; }

/* the drawing area */
.st-stage { width: 100%; overflow: auto; text-align: center; border-radius: 16px; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 2px rgba(230,236,247,.9); padding: 0; line-height: 0; max-height: 80vh; }
.st-canvas { touch-action: none; cursor: crosshair; image-rendering: pixelated; border-radius: 6px; box-shadow: 0 0 0 2px rgba(120,140,200,.45); margin: 1px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.st-pos { margin: 4px 2px 8px; }

/* palette */
.st-palette { display: grid; gap: 10px; }
.st-pal-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.st-pal-head b { font-family: Fredoka, sans-serif; font-size: 18px; color: var(--head); margin-right: auto; }
.st-swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; max-width: 460px; }
.sw { aspect-ratio: 1; min-height: 34px; border: 0; border-radius: 12px; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px rgba(60,70,110,.2), 0 2px 0 rgba(120,140,200,.25); }
.sw.clear { background: #fff linear-gradient(45deg, #dfe5f0 25%, transparent 25%, transparent 75%, #dfe5f0 75%), linear-gradient(45deg, #dfe5f0 25%, transparent 25%, transparent 75%, #dfe5f0 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px; }
.sw[aria-checked=true] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--pink-d); transform: scale(.9); }

/* preview */
.st-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { font: inherit; font-family: Fredoka, sans-serif; font-weight: 500; font-size: 15px; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; background: #fff; color: var(--ink);
  box-shadow: 0 3px 0 rgba(120,140,200,.25); }
.tab[aria-selected=true] { background: linear-gradient(180deg, #8fe6d2, var(--mint)); color: #fff; box-shadow: 0 3px 0 var(--mint-d); }
.st-preview-canvas { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; border-radius: 18px;
  background: linear-gradient(180deg, #eef7ff, #fdf1f7); box-shadow: inset 0 0 0 2px rgba(255,255,255,.9); }
.st-preview p { margin: 8px 0 0; text-align: center; }

/* save */
.st-save { display: grid; gap: 10px; }
.st-save-state { font-weight: 900; color: var(--ink2); }
.st-save p { margin: 0; }
.st-file { position: relative; overflow: hidden; display: inline-block; }
.st-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; width: 100%; height: 100%; }
.st-file:focus-within { outline: 3px solid var(--sky-d); outline-offset: 2px; }

/* templates */
.st-template-list { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.tpl { flex: 0 0 auto; width: 96px; border: 0; background: #fff; border-radius: 16px; padding: 8px 6px 6px; cursor: pointer; box-shadow: 0 3px 0 rgba(120,140,200,.25);
  display: grid; gap: 4px; justify-items: center; font: inherit; font-size: 12px; font-weight: 900; color: var(--ink2); }
.tpl:hover { transform: translateY(-1px); }
.tpl canvas { width: 64px; height: 64px; image-rendering: pixelated; border-radius: 8px; box-shadow: 0 0 0 2px #eef2fa; }

/* account + my designs */
.st-lower { margin-top: 20px; }
.st-login { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.st-login label { display: grid; gap: 4px; font-size: 13px; font-weight: 900; color: var(--ink2); flex: 1 1 150px; }
.st-who { margin-bottom: 12px; }
.st-upload-state { margin-bottom: 12px; }
.st-mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.mine-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px; background: #fff; border-radius: 18px; padding: 12px; box-shadow: 0 3px 0 rgba(120,140,200,.2); }
.mine-card .thumb { width: 72px; height: 72px; image-rendering: pixelated; border-radius: 10px; box-shadow: 0 0 0 2px #eef2fa; }
.mine-card .meta { min-width: 0; display: grid; gap: 3px; align-content: start; }
.mine-card .meta b { font-family: Fredoka, sans-serif; font-size: 18px; color: var(--head); overflow-wrap: anywhere; line-height: 1.15; }
.mine-card .meta p { margin: 2px 0 0; color: var(--coral-d); }
.mine-card .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.mine-card .acts .sb { box-shadow: 0 2px 0 rgba(120,140,200,.3), inset 0 0 0 2px #eef2fa; font-size: 14px; padding: 5px 12px; }
.mine-card.hidden-design .thumb { filter: grayscale(.8); opacity: .7; }

/* share */
.st-share-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.st-qr, .dz-qr { width: 160px; height: 160px; image-rendering: pixelated; border-radius: 12px; background: #fff; box-shadow: 0 3px 0 rgba(120,140,200,.25); }
.st-code { font-family: Fredoka, ui-monospace, monospace; font-size: clamp(22px, 3vw, 30px); font-weight: 600; letter-spacing: 2px; color: var(--head); margin-bottom: 8px; user-select: all; }
.st-share p { margin: 8px 0 0; overflow-wrap: anywhere; }
.st-rules ul { margin: 0 0 8px; padding-left: 1.2em; }
.st-rules li { margin: 6px 0; }
.st-rules p { margin: 0; }

/* dialog + toast */
.st-dialog { border: 0; border-radius: 22px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 70px rgba(30,40,70,.35); color: var(--ink); font-family: Nunito, system-ui, sans-serif; font-weight: 700; }
.st-dialog::backdrop { background: rgba(30,40,70,.45); }
.st-dialog form { padding: 22px; display: grid; gap: 12px; }
.st-dialog h2 { font-family: Fredoka, sans-serif; color: var(--head); font-size: 22px; margin: 0; overflow-wrap: anywhere; }
.st-dialog p { margin: 0; }
.st-dialog label { display: grid; gap: 4px; font-size: 13px; font-weight: 900; color: var(--ink2); }
.st-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(140px); background: #2a3147; color: #fff; padding: 12px 18px; border-radius: 14px;
  font-weight: 800; transition: transform .25s, opacity .25s; z-index: 100; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; text-align: center; }
.st-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.st-toast.bad { background: var(--coral-d); }

/* ---------- /d/<code>: one shared design ---------- */
.dz { max-width: 980px; padding-top: 30px; }
.dz-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dz-preview canvas { display: block; width: 100%; height: auto; border-radius: 18px; background: linear-gradient(180deg, #eef7ff, #fdf1f7); box-shadow: inset 0 0 0 2px rgba(255,255,255,.9); }
.dz-flat { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.dz-flat canvas { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 10px; box-shadow: 0 0 0 2px #eef2fa; background: none; }
.dz-info { display: grid; gap: 16px; min-width: 0; }
.dz-info h1 { overflow-wrap: anywhere; }
.dz-by { margin: 8px 0 0; font-size: 17px; }
.dz-info ol { margin: 0; padding-left: 1.3em; }
.dz-info li { margin: 6px 0; }
.dz-report fieldset { border: 0; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.dz-report legend { font-weight: 900; color: var(--ink2); padding: 0; margin-bottom: 6px; }
.dz-report label { display: flex; gap: 8px; align-items: center; }
.dz-report textarea { width: 100%; min-height: 70px; resize: vertical; }
.dz-gone { text-align: center; padding: 50px 20px; }
.dz-gone h1 { margin-bottom: 14px; }

@media (max-width: 900px) {
  .st-grid, .dz-grid { grid-template-columns: minmax(0, 1fr); }
  .st-swatches { max-width: none; }
}
@media (max-width: 520px) {
  .studio.wrap { padding-left: 10px; padding-right: 10px; }
  .studio .frost { padding: 14px; }
  .tb span { display: none; }
  .tb { min-width: 40px; height: 40px; }
  .st-share-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .st-share-grid .st-row { justify-content: center; }
  .st-mine { grid-template-columns: minmax(0, 1fr); }
}
