/* Readmefy editor: a dark app in Discord's colours. Blurple carries every action,
   surfaces step from #1e1f22 (chrome) to #313338 (stage), and the preview floats on the stage. */
:root {
  --bg-0: #1e1f22;
  --bg-1: #2b2d31;
  --bg-2: #313338;
  --bg-3: #383a40;
  --bg-4: #404249;
  --field: #1e1f22;
  --text: #f2f3f5;
  --text-2: #b5bac1;
  --text-3: #949ba4;
  --line: #3f4147;
  --line-soft: rgb(255 255 255 / 0.06);
  --blurple: #5865f2;
  --blurple-deep: #4752c4;
  --fuchsia: #eb459e;
  --green: #23a55a;
  --danger: #f23f43;
  --grad: linear-gradient(135deg, var(--blurple), var(--fuchsia));
  --r: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-2);
  color: var(--text);
  font: 400 14px/1.45 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blurple);
}

::selection {
  background: color-mix(in srgb, var(--blurple) 55%, transparent);
  color: #fff;
}

a {
  color: #00a8fc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid #00a8fc;
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-0);
  border: 2px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Controls */
button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  background: var(--bg-4);
  border: 0;
  border-radius: var(--r);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

button:hover {
  background: #4e5058;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

button:disabled:hover {
  background: var(--bg-4);
}

button.primary {
  background: var(--blurple);
  color: #fff;
}

button.primary:hover {
  background: var(--blurple-deep);
}

button.quiet {
  background: transparent;
  color: var(--text-2);
}

button.quiet:hover {
  color: var(--text);
  background: var(--bg-3);
}

button.icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: var(--text-2);
}

button.icon:hover {
  color: var(--text);
  background: var(--bg-3);
}

button.icon:disabled:hover {
  background: transparent;
}

button.danger,
button.icon.danger:hover {
  color: var(--danger);
}

button.danger:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.ui-i {
  flex: none;
}

input,
select,
textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 8px 10px;
  min-height: 36px;
  font-size: 14px;
  transition: border-color 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #111214;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blurple);
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

select option {
  background: var(--bg-1);
  color: var(--text);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
}

.hidden {
  display: none !important;
}

.hint {
  color: var(--text-3);
  font-size: 12.5px;
  margin: 0 0 12px;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-0);
  padding: 1px 6px;
  border-radius: 4px;
}

.spacer {
  flex: 1;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 14px 0 16px;
  background: var(--bg-0);
  border-bottom: 1px solid #111214;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  margin-right: 8px;
}

.brand:hover {
  text-decoration: none;
}

.brand .word {
  font-family: Unbounded, Figtree, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

/* Logo: a gradient tile with two lines of text, a README in 32px */
.mark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--grad);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--blurple) 80%, transparent);
}

.mark i {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: #fff;
}

.mark i:last-child {
  width: 60%;
  opacity: 0.75;
}

.topbar select {
  width: auto;
  max-width: 220px;
  background-color: var(--bg-1);
}

.user {
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--bg-1);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding-left: 12px;
  position: relative;
  transition: border-color 0.15s;
}

.user .at {
  color: var(--text-3);
  font-size: 13.5px;
}

.user input {
  width: 150px;
  border: 0;
  min-height: 0;
  padding: 0 4px;
  background: transparent;
  font-weight: 600;
}

.user:focus-within {
  border-color: var(--blurple);
}

.user button {
  height: 36px;
  margin-right: -1px;
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--blurple);
  color: #fff;
}

.user button:hover {
  background: var(--blurple-deep);
}

.status {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.tool-group {
  display: flex;
}

#undo,
#redo {
  width: 34px;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(330px, 384px) 1fr;
  height: calc(100% - 60px);
}

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-1);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 12px 12px 0;
  padding: 4px;
  background: var(--bg-0);
  border-radius: 10px;
}

.tabs button {
  min-height: 34px;
  background: none;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 13.5px;
}

.tabs button:hover {
  color: var(--text);
  background: var(--bg-3);
}

.tabs button.on {
  color: var(--text);
  background: var(--bg-4);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}

.pane {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 40px;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form + .form {
  margin-top: 14px;
}

.form-group {
  margin: 26px 0 10px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.pane > .form-group:first-child,
.form > .form-group:first-child {
  margin-top: 4px;
}

.form-info {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.field.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 24px;
  background: #80848e;
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s var(--ease);
}

.toggle input:checked + .switch {
  background: var(--green);
}

.toggle input:checked + .switch::after {
  transform: translateX(16px);
}

.toggle input:focus-visible + .switch {
  outline: 2px solid #00a8fc;
  outline-offset: 2px;
}

.field.toggle .field-label {
  color: var(--text);
  font-weight: 500;
}

.range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range input {
  padding: 0;
  min-height: 20px;
  border: 0;
  background: none;
  accent-color: var(--blurple);
}

.range output {
  min-width: 44px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-0);
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
}

.color {
  display: flex;
  gap: 6px;
}

.color input[type="color"] {
  flex: none;
  width: 40px;
  padding: 3px;
  cursor: pointer;
}

.color .hex {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.icon-btn {
  justify-content: flex-start;
  width: 100%;
  background: var(--field);
  font-weight: 500;
}

.icon-btn:hover {
  background: var(--bg-3);
}

.icon-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
  font-size: 13px;
}

.ico {
  flex: none;
  object-fit: contain;
}

.ico-empty {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px dashed var(--text-3);
  border-radius: 4px;
}

/* Nested lists */
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.list-head .count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--bg-0);
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.list-item {
  border-radius: var(--r);
  background: var(--bg-2);
  margin-bottom: 6px;
}

.list-item > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  min-height: 40px;
  border-radius: var(--r);
  cursor: pointer;
  list-style: none;
}

.list-item > summary:hover {
  background: var(--bg-3);
}

.list-item > summary::-webkit-details-marker {
  display: none;
}

.list-item[open] > summary {
  border-radius: var(--r) var(--r) 0 0;
  border-bottom: 1px solid var(--line-soft);
}

.list-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.list-tools {
  display: flex;
}

.list-tools button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  background: none;
  color: var(--text-3);
}

.list-tools button:hover {
  color: var(--text);
  background: var(--bg-4);
}

.list-tools button.danger:hover {
  color: var(--danger);
}

.list-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.list .add {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--bg-4);
  color: var(--text-2);
}

.list .add:hover {
  color: var(--text);
  border-color: var(--blurple);
  background: color-mix(in srgb, var(--blurple) 10%, transparent);
}

/* Block list: rows like Discord channels */
.blocks {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.blocks li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 0;
  border-radius: var(--r);
  transition: background 0.12s;
}

.blocks li:hover {
  background: var(--bg-3);
}

.blocks li.off .name {
  opacity: 0.45;
}

.blocks li.dragging {
  opacity: 0.4;
}

.blocks li.over {
  box-shadow: inset 0 2px 0 var(--blurple);
  background: color-mix(in srgb, var(--blurple) 14%, transparent);
}

.grip {
  display: grid;
  place-items: center;
  width: 20px;
  height: 32px;
  color: var(--text-3);
  cursor: grab;
}

.grip svg {
  stroke-width: 3;
}

.blocks .name {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-height: 42px;
  padding: 2px 4px;
  background: none;
  text-align: left;
}

.blocks .name strong {
  font-size: 14px;
}

.blocks .name small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-3);
}

.blocks li > button.icon {
  opacity: 0;
}

.blocks li:hover > button.icon,
.blocks li > button.icon:focus-visible {
  opacity: 1;
}

.add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.add-card {
  justify-content: flex-start;
  min-height: 42px;
  background: var(--bg-2);
  font-weight: 500;
  font-size: 13px;
}

.add-card:hover {
  background: var(--bg-3);
}

.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.editor-head > div {
  display: flex;
  flex-direction: column;
}

.editor-head .del {
  margin-left: auto;
}

.editor-head strong {
  font-family: Unbounded, Figtree, sans-serif;
  font-weight: 600;
  font-size: 15px;
}

.editor-head small {
  color: var(--text-3);
  font-size: 11.5px;
}

/* Palettes */
.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.preset {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 0;
  padding: 10px;
  background: var(--bg-2);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  min-width: 0;
}

.preset > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset:hover {
  background: var(--bg-3);
}

.preset.on {
  border-color: var(--blurple);
  background: color-mix(in srgb, var(--blurple) 12%, var(--bg-2));
}

.sw {
  display: flex;
  gap: 3px;
}

.sw i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  outline: 1px solid rgb(255 255 255 / 0.12);
  outline-offset: -1px;
}

.colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 12px 0 4px;
}

.colors .field-label {
  font-size: 12px;
}

.colors .color input[type="color"] {
  width: 32px;
}

.colors .hex {
  padding: 4px 6px;
  font-size: 11.5px;
}

.col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.fold {
  margin: 12px 0 4px;
  padding: 0 12px;
  border-radius: var(--r);
  background: var(--bg-2);
}

.fold > summary {
  padding: 11px 0;
  font-weight: 600;
  cursor: pointer;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Stage */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg-0);
}

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-0);
  border-radius: 10px;
}

.seg button {
  min-height: 30px;
  padding: 0 11px;
  background: transparent;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-3);
}

.seg button:hover {
  color: var(--text);
  background: var(--bg-3);
}

.seg button.on {
  background: var(--bg-4);
  color: var(--text);
}

.view {
  flex: 1;
  overflow: auto;
  padding: 24px 24px 48px;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.045) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg-2);
}

/* Preview: palette strip, then the GitHub page */
.sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 896px;
  margin: 0 auto;
  transition: max-width 0.35s var(--ease);
}

.sheet:has(.frame[data-device="mobile"]) {
  max-width: 400px;
}

.inkbar {
  align-self: flex-start;
  display: flex;
  gap: 14px;
  min-height: 0;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-1);
  border-radius: 16px;
  font-weight: 500;
}

.inkbar:hover {
  background: var(--bg-3);
}

.ink {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ink i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  outline: 1px solid rgb(255 255 255 / 0.18);
  outline-offset: -1px;
}

.ink small {
  font-size: 11.5px;
  color: var(--text-3);
}

/* GitHub-like frame */
.frame {
  --gh-bg: #ffffff;
  --gh-fg: #1f2328;
  --gh-line: #d0d7de;
  --gh-muted: #59636e;
  width: 100%;
  background: var(--gh-bg);
  color: var(--gh-fg);
  border: 1px solid var(--gh-line);
  border-radius: 12px;
  box-shadow: 0 18px 50px -18px rgb(0 0 0 / 0.6);
  overflow: hidden;
  transition: background 0.3s;
}

.frame[data-theme="dark"] {
  --gh-bg: #0d1117;
  --gh-fg: #e6edf3;
  --gh-line: #30363d;
  --gh-muted: #9198a1;
}

.frame-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font: 12px -apple-system, "Segoe UI", sans-serif;
  color: var(--gh-muted);
  border-bottom: 1px solid var(--gh-line);
}

.frame-head b {
  color: var(--gh-fg);
}

.mode-warn {
  margin: 12px 24px 0;
  font-size: 12px;
  color: var(--gh-muted);
}

.md {
  padding: 24px;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  word-wrap: break-word;
}

.md.center {
  text-align: center;
}

.md p {
  margin: 0 0 16px;
}

.md img {
  max-width: 100%;
  vertical-align: middle;
  border: 0;
}

.md a {
  color: #0969da;
}

.frame[data-theme="dark"] .md a {
  color: #4493f8;
}

.md .raw {
  text-align: inherit;
}

.md .raw :first-child {
  margin-top: 0;
}

.md .raw :last-child {
  margin-bottom: 16px;
}

.md .raw h1,
.md .raw h2 {
  border-bottom: 1px solid var(--gh-line);
  padding-bottom: 0.3em;
}

.md .raw pre,
.md .raw code {
  background: color-mix(in srgb, var(--gh-fg) 8%, transparent);
  border-radius: 6px;
}

.md .raw pre {
  padding: 16px;
  text-align: left;
  overflow: auto;
}

.part {
  position: relative;
  border-radius: 10px;
  outline: 2px solid transparent;
  outline-offset: 4px;
  cursor: pointer;
  transition: outline-color 0.15s;
}

.part:hover {
  outline-color: color-mix(in srgb, var(--blurple) 50%, transparent);
}

.part.sel {
  outline-color: var(--blurple);
}

.part-tag {
  position: absolute;
  top: -14px;
  left: 10px;
  z-index: 2;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--blurple);
  color: #fff;
  font: 600 11.5px Figtree, sans-serif;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.2s var(--ease);
  pointer-events: none;
}

.part:hover .part-tag,
.part.sel .part-tag {
  opacity: 1;
  transform: none;
}

/* Code + files */
.code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--text-2);
  font-weight: 600;
}

#readme-code {
  height: calc(100% - 46px);
  min-height: 400px;
  background: var(--bg-0);
}

.files {
  list-style: none;
  max-width: 820px;
  margin: 0 auto 12px;
  padding: 0;
  background: var(--bg-1);
  border-radius: 10px;
  overflow: hidden;
}

.files li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}

.files li:last-child {
  border-bottom: 0;
}

.files li.head {
  font-family: Figtree, sans-serif;
  font-weight: 700;
  background: var(--bg-0);
}

#view-files .hint {
  max-width: 820px;
  margin: 0 auto;
}

.muted {
  color: var(--text-3);
}

/* Dialogs */
.modal {
  width: min(760px, 94vw);
  padding: 20px 22px 22px;
  background: var(--bg-2);
  color: var(--text);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 70px -12px rgb(0 0 0 / 0.7);
}

.modal[open] {
  animation: rise 0.3s var(--ease);
}

.modal::backdrop {
  background: rgb(0 0 0 / 0.7);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-head h3 {
  margin: 0;
  font-family: Unbounded, Figtree, sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.picker[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--bg-1);
  font-weight: 500;
  font-size: 12.5px;
}

.chip.on {
  background: var(--blurple);
  color: #fff;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px;
}

.icon-grid button {
  height: 52px;
  padding: 0;
  background: var(--bg-1);
}

.icon-grid button:hover {
  background: var(--bg-3);
}

.icon-grid button.on {
  box-shadow: inset 0 0 0 2px var(--blurple);
}

.picker-status {
  color: var(--text-3);
  font-size: 12px;
}

.picker-foot {
  display: flex;
  gap: 8px;
}

.picker-foot input {
  flex: 1;
}

.export h4 {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
}

.export p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.ex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ex-grid section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-1);
  border-radius: 10px;
}

.log {
  margin-top: 14px;
  max-height: 170px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg-0);
  border-radius: var(--r);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}

.log:empty {
  display: none;
}

.log div {
  padding: 2px 0;
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  background: var(--bg-0);
  color: var(--text);
  border-radius: var(--r);
  box-shadow: 0 10px 28px -8px rgb(0 0 0 / 0.6);
  animation: rise 0.3s var(--ease);
  transition: opacity 0.4s, transform 0.4s;
}

.toast.out {
  opacity: 0;
  transform: translateY(8px);
}

/* Language picker: a globe in front of a compact select */
.lang-pick {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text-2);
}

.lang-pick > svg {
  position: absolute;
  left: 10px;
  pointer-events: none;
}

.topbar .lang-pick select {
  padding-left: 32px;
  max-width: 140px;
}

/* First visit: a bubble that points at the username field */
.welcome-tip {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 290px;
  padding: 12px 10px 12px 14px;
  background: var(--blurple);
  color: #fff;
  border-radius: var(--r);
  box-shadow: 0 14px 34px -10px rgb(0 0 0 / 0.7);
  font-size: 13px;
  line-height: 1.45;
  animation: rise 0.35s var(--ease);
}

.welcome-tip[hidden] {
  display: none;
}

.welcome-tip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 28px;
  width: 12px;
  height: 12px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 2px;
}

.welcome-tip b {
  font-size: 14px;
}

.welcome-tip span {
  grid-column: 1;
  color: rgb(255 255 255 / 0.88);
}

.welcome-tip .icon {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: start;
  width: 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #fff;
}

.welcome-tip .icon:hover {
  background: rgb(255 255 255 / 0.16);
}

.user:has(.welcome-tip:not([hidden])) {
  border-color: var(--blurple);
}

/* Sample data notice above the preview */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: var(--bg-1);
  border: 1px solid color-mix(in srgb, var(--blurple) 45%, transparent);
  border-radius: 12px;
}

.demo-banner[hidden] {
  display: none;
}

.demo-banner p {
  flex: 1;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}

.demo-banner b {
  color: var(--text);
}

.demo-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blurple) 22%, transparent);
}

.demo-banner button {
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .side {
    max-height: 62vh;
    border-bottom: 1px solid var(--bg-0);
  }

  .status {
    display: none;
  }

  .view {
    padding: 16px 12px 32px;
  }

  .ink small {
    display: none;
  }

  .ex-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .brand .word {
    display: none;
  }

  /* Only the globe shows; the list still opens with the language names */
  .topbar .lang-pick select {
    width: 40px;
    padding: 0 0 0 40px;
    background-image: none;
    color: transparent;
  }

  .lang-pick option {
    color: var(--text);
  }

  .lang-pick > svg {
    left: 12px;
  }

  .user {
    order: 10;
    flex: 1 1 100%;
  }

  .user input {
    flex: 1;
    width: auto;
  }

  #templates {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  #share {
    font-size: 0;
    gap: 0;
  }
}
