/* Baba Crochet Patterns: "fast & easy", pink and playful (from the Etsy cover).
 * Pink is for whatever can be pressed; yellow, mint and sky only for small joys.
 * Charts always sit on a neutral background so the yarn colors look true. */
:root {
  --pink: #ee3092;          /* the logo's pink */
  --pink-deep: #c81a75;
  --pink-text: #c4116d;      /* pink dark enough for small text on white */
  --blush: #fde4ef;
  --paper: #fff4f9;
  --card: #ffffff;
  --ink: #2b1d2e;
  --ink-soft: #6f5b72;
  --line: #f3c7dc;
  --line-soft: #f7dfea;
  --sun: #ffd23f;
  --sun-deep: #e3b71f;
  --mint: #3ddc97;
  --mint-pale: #d9f8e9;
  --sky: #4cc9f0;
  --sky-pale: #e2f6fd;
  --chart-bg: #f2efea;
  --danger: #d6334a;
  --focus: #4cc9f0;
  --radius: 20px;
  --shadow: 0 4px 0 var(--line-soft);
  --font-ui: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: Anton, Impact, "Arial Narrow", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font-ui);
}
h1 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; font-size: 2.3rem; margin: 0 0 .3em; }
h2 { font-family: var(--font-ui); font-weight: 900; font-size: 1.2rem; line-height: 1.25; margin: 0 0 .4em; }
h3 { font-weight: 900; }
.h-small { font-family: var(--font-ui); font-size: .78rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 1.2em 0 .6em; }
a { color: inherit; }
.muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: .85rem; margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--blush); }

/* White line doodles of crochet tools on blush, like the Etsy cover. */
.doodles {
  background-color: var(--blush);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='160' viewBox='0 0 220 160' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='34' cy='40' r='18'/%3E%3Cpath d='M20 30c10 4 18 14 22 26M18 44c10-2 22 2 30 10M30 22c6 8 8 20 6 34'/%3E%3Cpath d='M120 20l40 60M156 74c4 6 10 6 12 2'/%3E%3Ccircle cx='190' cy='120' r='12'/%3E%3Ccircle cx='186' cy='117' r='1.5'/%3E%3Ccircle cx='194' cy='117' r='1.5'/%3E%3Ccircle cx='186' cy='124' r='1.5'/%3E%3Ccircle cx='194' cy='124' r='1.5'/%3E%3Cpath d='M60 120c8-10 18-10 26 0M60 120l-6 18M86 120l6 18M54 138h10M82 138h10'/%3E%3Cpath d='M200 20v34M196 24a4 4 0 1 1 8 0'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { width: 38px; height: 38px; flex: none; display: block; border-radius: 50%; box-shadow: 0 3px 0 rgba(200,26,117,.25); }
.brand-logo { height: 52px; width: auto; display: block; transition: transform .15s; }
.brand:hover .brand-logo { transform: rotate(-3deg) scale(1.04); }
@media (max-width: 600px) { .brand-logo { height: 40px; } }
.brand-name { font-weight: 900; color: var(--pink-text); letter-spacing: .06em; text-transform: uppercase; font-size: .88rem; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar { position: relative; }

/* Main menu: pills on wide screens, a drop-down behind ☰ on narrow ones. */
.studio-nav, .site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.studio-nav a, .studio-nav button, .site-nav a {
  font: 800 .95rem var(--font-ui); color: var(--ink); text-decoration: none; background: rgba(255,255,255,.65);
  border: 0; border-radius: 99px; padding: 8px 14px; cursor: pointer; white-space: nowrap; transition: background .1s, transform .1s;
}
.studio-nav a:hover, .studio-nav button:hover, .site-nav a:hover { background: #fff; transform: translateY(-1px); }
.studio-nav a[aria-current], .site-nav a[aria-current] { background: var(--pink); color: #fff; box-shadow: 0 3px 0 var(--pink-deep); }
.studio-nav form { margin: 0; }
.nav-toggle { display: none; flex: none; width: 46px; height: 46px; border-radius: 14px; border: 0; background: #fff; box-shadow: 0 3px 0 var(--line); cursor: pointer; padding: 12px 11px; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 3px; border-radius: 3px; background: var(--ink); transition: transform .15s, opacity .15s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .studio-nav, .site-nav {
    display: none; position: absolute; right: 16px; top: calc(100% - 6px); z-index: 30; min-width: 230px;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; background: #fff; border-radius: 18px;
    box-shadow: 0 14px 34px rgba(43,29,46,.18);
  }
  .studio-nav.open, .site-nav.open { display: flex; }
  .studio-nav a, .studio-nav button, .site-nav a { text-align: left; width: 100%; background: transparent; padding: 11px 14px; }
}
.cover-box { height: 160px; border-radius: 14px; background: var(--chart-bg); display: grid; place-items: center; overflow: hidden; text-align: center; padding: 8px; }
.cover-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.page { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin-bottom: 12px; font-weight: 700; }
.crumbs a { color: var(--pink-text); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.inline-form { display: flex; gap: 8px; flex: 1; max-width: 560px; }
.inline-form input { flex: 1; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; font-weight: 800; color: var(--ink-soft); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
input, textarea, select {
  font: inherit; font-weight: 600; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0;
}
input:hover, textarea:hover, select:hover { border-color: #eaa9c8; }
input[type=checkbox] { accent-color: var(--pink); width: 18px; height: 18px; }
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, [role=button]:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 900; cursor: pointer; text-decoration: none;
  padding: 10px 18px; border-radius: 14px; border: 0;
  background: #fff; color: var(--ink); box-shadow: 0 3px 0 #ead2de;
  transition: transform .08s, box-shadow .08s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 0 #ead2de; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #ead2de; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-deep); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 5px 0 var(--pink-deep); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--pink-deep); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 0 #a8203a; }
.btn-ghost { background: rgba(255,255,255,.6); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: #fff; box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 12px; }

.flashes { max-width: 1100px; margin: 16px auto 0; padding: 0 24px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 800; }
.flash-ok::before { content: "🎉 "; }
.flash-error { background: #ffe1e6; color: #8a1730; }

.badge { display: inline-block; font-size: .76rem; font-weight: 900; padding: 3px 10px; border-radius: 99px; }
.badge-draft { background: #fff2c2; color: #7a5800; }
.badge-draft::before { content: "✎ "; }
.badge-published { background: var(--mint-pale); color: #0f6b42; }
.badge-published::before { content: "● "; }
.tag { display: inline-block; font-size: .76rem; font-weight: 900; padding: 3px 10px; border-radius: 99px; background: var(--blush); color: var(--pink-text); }
.tag-views { background: var(--sky-pale); color: #10617a; }

/* ---------- studio pages ---------- */
.login-page { min-height: 100vh; }
.login-page .page { max-width: 440px; padding-top: 8vh; }
.login-card { text-align: center; }
.login-logo { width: 200px; height: auto; display: block; margin: 4px auto 10px; }
.login-card form { text-align: left; margin-top: 18px; }

.welcome-page { min-height: 100vh; }
.welcome-page .page { max-width: 560px; padding-top: 6vh; }
.welcome-card { text-align: center; padding: 28px 28px 32px; }
.welcome-card h1 span { color: var(--pink); }
.welcome-message { white-space: pre-line; font-size: 1.12rem; font-weight: 700; line-height: 1.6; margin: 10px 0 8px; }
.welcome-form { text-align: left; margin-top: 22px; padding-top: 20px; border-top: 2px dashed var(--line); }
.welcome-form h2 { text-align: center; margin: 0; }
.welcome-form .hint { text-align: center; }
.hello h1 { margin: 0; }
.hello h1 span { color: var(--pink); }
.hello p { margin: 6px 0 0; font-weight: 800; color: var(--ink-soft); }

.pattern-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.pattern-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; height: 100%; padding: 14px; transition: transform .15s; }
.pattern-card:hover { transform: translateY(-3px) rotate(-.6deg); }
.pattern-card h2 { margin: 4px 4px 0; font-size: 1.08rem; }
.thumb { position: relative; display: block; height: 140px; border-radius: 14px; background: var(--chart-bg); overflow: hidden; }
.thumb img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; image-rendering: pixelated; }
.thumb-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.thumb-empty { color: var(--ink-soft); font-weight: 800; font-size: .85rem; text-align: center; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 4px; }
.new-card {
  display: grid; place-items: center; text-align: center; min-height: 230px; height: 100%;
  border: 3px dashed var(--line); border-radius: var(--radius); padding: 20px; color: var(--pink-text); font-weight: 900;
}
.new-card form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.new-card .plus {
  width: 56px; height: 56px; border-radius: 50%; background: var(--pink); color: #fff; margin: 0 auto 4px;
  display: grid; place-items: center; font-size: 2rem; line-height: 1; box-shadow: 0 4px 0 var(--pink-deep);
}
.empty { text-align: center; padding: 48px 24px; }

.chart-list { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 12px; }
.chart-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; }
.chart-row .thumb { width: 92px; height: 70px; flex: none; border-radius: 12px; }
.chart-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; text-decoration: none; }
.chart-open strong { font-size: 1.15rem; }
.chart-open:hover strong { color: var(--pink-text); }
.chart-open > span { display: flex; flex-direction: column; }
.chart-actions { display: flex; gap: 6px; align-items: center; }
.chart-actions form { display: flex; gap: 4px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; width: 290px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 30px rgba(43,29,46,.15); }
details > summary { cursor: pointer; }
.danger-zone summary { color: var(--danger); font-weight: 800; }
.danger-zone form { margin-top: 12px; }
.new-chart { max-width: 540px; }
.publish-card { border: 3px solid var(--blush); }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; font-size: .85rem; }

/* ---------- editor ---------- */
.editor-page { overflow: hidden; }
.editor-page .flashes { display: none; }
.editor {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 290px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "tools canvas side";
}
.editor-top {
  grid-area: top; display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 2px solid var(--line);
}
.editor-logo { height: 32px; width: auto; display: block; flex: none; }
.editor-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 900; }
.editor-title .size-pill { display: inline-block; margin-left: 6px; background: var(--pink); color: #fff; border-radius: 99px; padding: 1px 10px; font-size: .85rem; }
.editor-top-actions { display: flex; align-items: center; gap: 6px; }
.save-status { font-size: .85rem; font-weight: 800; min-width: 160px; text-align: right; color: var(--ink-soft); }
.save-status[data-kind="ok"] { color: #0f6b42; }
.save-status[data-kind="ok"]::before { content: "✓ "; }
.save-status[data-kind="error"] { color: var(--danger); }

.toolbar { grid-area: tools; background: var(--card); border-right: 2px solid var(--line-soft); padding: 10px 7px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.toolbar hr { border: 0; border-top: 2px solid var(--line-soft); margin: 6px 4px; width: auto; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; border-radius: 14px; padding: 7px 2px;
  font: 800 .68rem var(--font-ui); color: var(--ink-soft); cursor: pointer;
}
.tool svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--paper); color: var(--ink); }
.tool.active { background: var(--pink); color: #fff; box-shadow: 0 3px 0 var(--pink-deep); }

.canvas-wrap { grid-area: canvas; position: relative; overflow: hidden; --canvas-bg: #f2efea; background: var(--canvas-bg); touch-action: none; }
.canvas-wrap canvas { display: block; }
.canvas-wrap[data-cursor="pencil"] { cursor: crosshair; }
.canvas-wrap[data-cursor="fill"] { cursor: cell; }
.canvas-wrap[data-cursor="picker"] { cursor: copy; }
.canvas-wrap[data-cursor="grab"], .canvas-wrap[data-cursor="hand"] { cursor: grab; }
.canvas-wrap[data-cursor="grabbing"] { cursor: grabbing; }
.canvas-wrap[data-cursor="select"] { cursor: crosshair; }
.canvas-wrap[data-cursor="move"] { cursor: move; }
.cursor-info { position: absolute; left: 12px; bottom: 12px; font-size: .82rem; font-weight: 800; background: #fff; border-radius: 99px; padding: 3px 12px; pointer-events: none; box-shadow: 0 2px 0 var(--line-soft); }
.cursor-info:empty { display: none; }

.side-panel { grid-area: side; background: var(--card); border-left: 2px solid var(--line-soft); padding: 4px 16px 24px; overflow-y: auto; }
.side-panel section + section { border-top: 2px solid var(--line-soft); margin-top: 16px; }
.current-colors { display: flex; align-items: center; gap: 10px; padding-top: 14px; }
.swatch { display: inline-block; width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(0,0,0,.15); flex: none; position: relative; cursor: pointer; overflow: hidden; }
.swatch input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.swatch.big { width: 44px; height: 44px; border-radius: 12px; cursor: default; }
.swatch.big.secondary { width: 32px; height: 32px; margin-left: -20px; margin-top: 24px; box-shadow: 0 0 0 3px var(--card); }
.swatch.tiny { width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-left: 3px; cursor: default; }

.palette { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.palette-item { display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 14px; border: 2px solid transparent; }
.palette-item.is-primary { border-color: var(--pink); background: var(--paper); }
.palette-item.is-secondary { border-style: dashed; border-color: var(--ink-soft); }
.palette-item .pick { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.palette-item .name { border: 0; background: transparent; padding: 0 2px; font-weight: 800; font-size: .9rem; }
.palette-item .name:hover, .palette-item .name:focus { background: #fff; }
.palette-item .count { font-size: .76rem; font-weight: 700; color: var(--ink-soft); padding-left: 2px; }
.shortcuts p { margin: 0 0 6px; }
kbd { font: 800 .75rem var(--font-ui); background: var(--paper); border: 2px solid var(--line); border-radius: 6px; padding: 0 5px; }

.selection-panel { padding-bottom: 8px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.btn-grid .btn { justify-content: flex-start; }
.selection-panel label.check { font-size: .82rem; margin-bottom: 4px; }
.toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: .9rem; font-weight: 800;
  padding: 8px 16px; border-radius: 99px; pointer-events: none;
}

@media (max-width: 900px) {
  .editor { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top top" "tools canvas" "side side"; }
  .side-panel { max-height: 34vh; border-left: 0; border-top: 2px solid var(--line-soft); }
  .save-status { min-width: 0; }
}

/* ---------- import dialog ---------- */
.import-dialog {
  width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 0; border-radius: 24px; padding: 0; background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(43,29,46,.35);
}
.import-dialog::backdrop { background: rgba(43,29,46,.55); }
.import-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.import-form header { padding: 20px 24px 12px; }
.import-form header h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.7rem; }
.import-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; padding: 4px 24px 22px; overflow: auto; }
.import-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.import-view { width: 100%; height: min(60vh, 520px); border-radius: 14px; display: block; cursor: crosshair; touch-action: none; }
.import-preview { image-rendering: pixelated; width: 100%; max-height: 220px; object-fit: contain; background: var(--chart-bg); border-radius: 12px; display: block; }
.crop-fields { border: 2px solid var(--line-soft); border-radius: 14px; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.crop-fields legend { font-size: .8rem; font-weight: 800; color: var(--ink-soft); padding: 0 4px; }
@media (max-width: 800px) { .import-body { grid-template-columns: 1fr; } }

/* ---------- guide ---------- */
.guide { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
.guide-toc { position: sticky; top: 20px; background: #fff; border-radius: var(--radius); padding: 6px 18px 18px; box-shadow: var(--shadow); }
.guide-toc ol { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 5px; font-size: .92rem; font-weight: 700; }
.guide-toc a { text-decoration: none; color: var(--ink-soft); }
.guide-toc a:hover { color: var(--pink-text); }
.guide-body { max-width: 720px; }
.guide-body section { scroll-margin-top: 20px; padding-top: 14px; border-top: 2px solid var(--line-soft); margin-top: 30px; }
.guide-body h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.6rem; letter-spacing: .01em; color: var(--pink-text); }
.guide-body h3 { font-size: 1.02rem; margin: 1.2em 0 .3em; }
.guide-body li { margin-bottom: 4px; }
.lead { font-size: 1.12rem; color: var(--ink-soft); font-weight: 700; }
.steps li { margin-bottom: 8px; }
.steps li::marker { color: var(--pink); font-weight: 900; }
.tip { background: #fff8d6; border-radius: 14px; padding: 12px 16px; }
.tip::before { content: "💡 "; }
.guide-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .94rem; background: #fff; border-radius: 14px; overflow: hidden; }
.guide-table th, .guide-table td { text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--line-soft); vertical-align: top; }
.guide-table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.guide-table.keys td:first-child { white-space: nowrap; width: 1%; }
.guide-layout {
  display: grid; grid-template-columns: 50px 1fr 90px; grid-template-rows: 30px 120px;
  grid-template-areas: "t t t" "l c r"; gap: 4px; margin: 12px 0 16px; max-width: 460px;
  font-size: .76rem; font-weight: 800; text-align: center;
}
.guide-layout > div { border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 4px; }
.gl-top { grid-area: t; background: var(--blush); justify-content: flex-start !important; padding-left: 10px !important; }
.gl-tools { grid-area: l; background: #fff; }
.gl-canvas { grid-area: c; background: var(--chart-bg); }
.gl-side { grid-area: r; background: #fff; line-height: 1.6; }
@media (max-width: 860px) {
  .guide { grid-template-columns: 1fr; gap: 16px; }
  .guide-toc { position: static; }
}

/* ---------- confetti (publish, first visit) ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ---------- statistics ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: .8rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.tile strong { font-family: var(--font-display); font-weight: 400; font-size: 2.6rem; line-height: 1.05; }
.tile strong small { font-size: 1.4rem; }
.tile strong.tile-text { font-family: var(--font-ui); font-weight: 900; font-size: 1.15rem; line-height: 1.3; margin: 6px 0 4px; }
.tile-sub { font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.chart-card { margin-bottom: 28px; }
.daychart { position: relative; margin: 12px 0 0; padding-left: 30px; }
.daychart svg { width: 100%; height: 190px; display: block; overflow: visible; }
.axis-max { position: absolute; left: 0; top: -6px; font-size: .78rem; font-weight: 800; color: var(--ink-soft); }
.axis-x { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 800; color: var(--ink-soft); margin-top: 6px; }
svg .bar { fill: var(--pink); }
svg .bar-hit:hover .bar { fill: var(--pink-deep); }
svg .grid { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 4 4; }
svg .baseline { stroke: #d9c3cf; stroke-width: 1; }
.table-view { margin-top: 12px; font-weight: 700; }
.table-view summary { color: var(--pink-text); }
.empty-stats { font-weight: 800; color: var(--ink-soft); margin: 8px 0 0; }
.section-h { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.7rem; margin: 8px 0 14px; }
.stat-patterns { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-pattern header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat-pattern h3 { margin: 0; font-size: 1.1rem; }
.stat-pattern h3 a { text-decoration: none; }
.stat-pattern h3 a:hover { color: var(--pink-text); }
.stat-pattern.has-alert { box-shadow: 0 0 0 3px var(--sun), var(--shadow); }
.alert { background: #fff6cc; border-radius: 12px; padding: 10px 12px; font-size: .9rem; font-weight: 700; margin: 12px 0 0; }
.stat-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 10px; text-align: center; }
.stat-nums strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.stat-nums span { font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.spark { width: 100%; height: 44px; display: block; }
.hbars { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 8px; }
.hbars li { display: grid; grid-template-columns: 9.5em minmax(0, 1fr) auto; gap: 10px; align-items: center; font-weight: 700; font-size: .9rem; }
.hb-track { height: 12px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--pink); border-radius: 99px; min-width: 2px; }
.hb-value { font-weight: 900; min-width: 2.5em; text-align: right; }
.hb-value small { font-weight: 700; color: var(--ink-soft); }
.stat-bottom { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .stat-bottom { grid-template-columns: 1fr; } .hbars li { grid-template-columns: 7.5em minmax(0, 1fr) auto; } }
.notes-langs { border: 2px dashed var(--line); border-radius: 14px; padding: 10px 14px; }
.notes-langs summary { font-weight: 800; color: var(--pink-text); }
.notes-langs[open] { display: flex; flex-direction: column; gap: 10px; }
