/* ---------------------------------------------------------------
   Two visual languages live here:
     .mc-*  imitates the game's dialog screen
     everything else is the builder wrapped around it
   --------------------------------------------------------------- */

/* Mojangles, the font the game uses for nearly everything. Bold and italic
   faces are deliberately not loaded: the game synthesises both (bold by
   drawing the glyph twice, italic by shearing it), and the browser does the
   same when only a regular face exists. */
@font-face {
  font-family: "MC Default";
  src: url("fonts/MinecraftDefault-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #14161a;
  --bg-panel: #1b1e24;
  --bg-raise: #23272f;
  --line: #2f343d;
  --line-soft: #262a32;
  --text: #dfe3ea;
  --text-dim: #98a0ad;
  --accent: #63b3ff;
  --accent-dim: #2b6ca3;
  --ok: #6dd58c;
  --warn: #e8c268;
  --error: #ef7a72;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --mc-font: "MC Default", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  height: 100%;
}

body { display: flex; flex-direction: column; min-height: 100vh; }
body.is-resizing { cursor: ns-resize; user-select: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---- top bar ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 17px; letter-spacing: -0.01em; }
.brand-sub { color: var(--text-dim); font-size: 12px; }

.topbar-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.inline { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }

/* ---- generic controls ---- */

.btn {
  background: var(--bg-raise);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent-dim); }
.btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: #3480bd; border-color: #3480bd; }

.btn-text {
  background: none; border: none; color: var(--accent);
  font: inherit; font-size: 12px; padding: 4px 0; cursor: pointer; text-align: left;
}
.btn-text:hover { text-decoration: underline; }

.btn-icon {
  background: var(--bg-raise); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 5px; width: 28px; height: 28px; flex: 0 0 auto; cursor: pointer; font-size: 12px;
}
.btn-icon:hover { color: var(--error); border-color: var(--error); }

.btn-add {
  background: none; border: 1px dashed var(--line); color: var(--text-dim);
  border-radius: 6px; padding: 7px 10px; width: 100%;
  font: inherit; font-size: 12px; cursor: pointer; margin-top: 6px;
}
.btn-add:hover { border-color: var(--accent-dim); color: var(--accent); }

select, input[type="text"], input[type="number"], textarea {
  background: #12141896; color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font: inherit; font-size: 13px; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent-dim); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.5; }

/* ---- layout ---- */

.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 250px;
  flex: 1 1 auto;
  min-height: 0;
}

.panel { background: var(--bg-panel); overflow-y: auto; padding: 14px; }
.panel-left { border-right: 1px solid var(--line); }
.panel-right { border-left: 1px solid var(--line); }

/* No bottom padding here — .stage-foot provides it, so the foot can sit
   flush against the bottom of the scrollport when it sticks. */
.stage-wrap {
  display: flex; flex-direction: column; min-width: 0;
  overflow: auto; padding: 16px 16px 0; gap: 14px;
}

.stage-hint p {
  margin: 0; color: var(--text-dim); font-size: 12px; line-height: 1.6; max-width: 78ch;
}

/* Grows to fill the space but never shrinks: a tall dialog has to push the
   panel into scrolling rather than spilling over whatever sits below it. */
.stage {
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
}

/* Stays put while a tall dialog scrolls past behind it. The negative side
   margins let the opaque background bleed into the panel's own padding, so
   nothing shows through at the edges. */
.stage-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -16px;
  padding: 12px 16px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}

/* A square Minecraft button holding one glyph. Shared by the game's warning
   button inside the dialog and our own info button below it. */
.mc-icon-button {
  flex: 0 0 auto;
  background: #6c6c6c;
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 #ffffff33, inset 0 -2px 0 #00000055;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: help; padding: 0;
}
.mc-icon-button:hover { background: #7f8ba0; }
.mc-icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mc-icon-button svg { image-rendering: pixelated; display: block; }

/* ---- inspector ---- */

.panel-head { margin-bottom: 14px; }
.panel-title { font-size: 15px; }
.panel-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 12px; }

.panel-section { margin-bottom: 20px; }
.panel-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; margin-bottom: 5px; color: var(--text); }
.field-hint { margin: 5px 0 0; font-size: 11px; line-height: 1.55; color: var(--text-dim); }

.toggle {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; margin-bottom: 10px; cursor: pointer;
}
.toggle input { margin: 1px 0 0; accent-color: var(--accent); }

.row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }

.subcard {
  border: 1px solid var(--line-soft); border-radius: 7px;
  padding: 10px; margin-bottom: 8px; background: #00000026;
}

.callout {
  border-left: 3px solid var(--warn); background: #e8c2680f;
  padding: 8px 10px; border-radius: 0 6px 6px 0;
}
.callout p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--text-dim); }

/* ---- palette ---- */

.palette-group { margin-bottom: 20px; }

.palette-item {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 10px; margin-bottom: 7px;
  background: var(--bg-raise); cursor: grab; user-select: none;
}
.palette-item:hover { border-color: var(--accent-dim); }
.palette-item:active { cursor: grabbing; }
.palette-item strong { font-size: 13px; font-weight: 600; }
.palette-blurb { font-size: 11px; color: var(--text-dim); line-height: 1.45; }

.palette-item.is-disabled { opacity: 0.4; cursor: not-allowed; }
.palette-item.is-disabled:hover { border-color: var(--line); }

.palette-note { margin: 4px 0 0; font-size: 11px; line-height: 1.55; color: var(--text-dim); }

/* ---------------------------------------------------------------
   The dialog screen.

   Modelled on the real thing: a dark band at the top holding the title
   and the warning button, the blurred world showing straight through
   the middle, and a dark band at the bottom for the exit buttons.
   --------------------------------------------------------------- */

.mc-screen {
  background-image: url("background.webp");
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  width: 100%;
  min-height: 340px;
  overflow: hidden;
  display: flex;
  border: 1px solid #000;
}

.mc-dialog {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  font-family: var(--mc-font);
  color: #fff;
  /* Fallback for text that does not go through MiniMessage; styled runs
     compute their own shadow from their own colour, as the game does. */
  text-shadow: 0.125em 0.125em 0 #3f3f3f;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
}

/* header band */

.mc-header {
  background: #00000099;
  border-bottom: 2px solid #00000066;
  padding: 8px 12px;
  flex: 0 0 auto;
}
.mc-title-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.mc-title { font-size: 15px; text-align: center; }

/* The warning button styling now comes from .mc-icon-button; this only keeps
   it from inheriting the dialog's text shadow. */
.mc-warning { text-shadow: none; }

/* content area — the world shows through */

.mc-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  min-height: 90px;
  overflow: visible;
}

.mc-zone {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; width: 100%; min-height: 10px;
  padding: 4px; border-radius: 4px;
  border: 1px dashed transparent;
  transition: border-color 0.12s, background 0.12s;
}
.mc-zone.mc-grid { display: grid; justify-content: center; gap: 8px; }
.mc-zone.mc-grid .mc-stub-note { grid-column: 1 / -1; }

.mc-empty {
  color: #ffffff66; font-size: 11px; font-style: italic;
  padding: 6px 0; text-shadow: none; text-align: center;
  font-family: var(--font);
}

/* footer band */

.mc-footer {
  background: #00000099;
  border-top: 2px solid #00000066;
  padding: 10px 12px;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  flex: 0 0 auto;
}

/* selectable elements */

.mc-el { position: relative; cursor: pointer; }
.mc-el::after {
  content: ""; position: absolute; inset: -4px;
  border: 1px solid transparent; border-radius: 3px; pointer-events: none;
}
.mc-el:hover::after { border-color: #63b3ff80; }
.mc-el.is-selected::after { border-color: var(--accent); box-shadow: 0 0 0 1px #63b3ff40; }

/* move / delete chrome */

.el-controls {
  position: absolute;
  top: -12px; right: -6px;
  display: none;
  gap: 2px;
  z-index: 5;
}
.mc-el:hover > .el-controls, .mc-el.is-selected > .el-controls { display: flex; }

.el-ctl {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1;
  width: 20px; height: 20px;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  text-shadow: none;
  display: flex; align-items: center; justify-content: center;
}
.el-ctl:hover { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.el-ctl.is-danger:hover { background: var(--error); border-color: var(--error); color: #14161a; }
.el-ctl.is-note {
  width: auto; padding: 0 6px; cursor: help;
  color: var(--text-dim); font-size: 10px;
}
.el-ctl.is-note:hover { background: var(--bg-raise); border-color: var(--line); color: var(--text-dim); }

.mc-plain { text-align: center; max-width: 100%; }
.mc-label { font-size: 12px; }
.mc-label-above { display: block; text-align: center; margin-bottom: 4px; }

/* buttons */

.mc-button {
  position: relative;
  background: #6c6c6c;
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 #ffffff33, inset 0 -2px 0 #00000055;
  min-height: 22px;
  padding: 3px 6px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 12px; max-width: 100%;
}
.mc-button:hover { background: #7f8ba0; }
.mc-button.is-stub { opacity: 0.6; }
.mc-button-label { pointer-events: none; }

.mc-button-badge {
  position: absolute; top: -7px; right: -4px;
  background: var(--accent-dim); color: #fff;
  font-family: var(--font); font-size: 9px; line-height: 1;
  padding: 2px 4px; border-radius: 3px; text-shadow: none;
}

.mc-stub-note {
  font-family: var(--font); font-size: 10px; color: #ffffff88;
  text-shadow: none; text-align: center; line-height: 1.5; padding-top: 4px;
}

/* inputs */

.mc-checkbox-row { display: flex; align-items: center; gap: 8px; }
.mc-checkbox {
  width: 22px; height: 22px; flex: 0 0 auto;
  background: #000000b3; border: 1px solid #a0a0a0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; cursor: pointer;
}
.mc-checkbox:hover { border-color: #fff; }

.mc-textfield {
  background: #000000b3; border: 1px solid #a0a0a0;
  min-height: 22px; padding: 2px 4px;
  display: flex; align-items: center; max-width: 100%;
}
.mc-textfield.is-multiline { align-items: stretch; }

.mc-textentry {
  background: none; border: none; outline: none;
  color: #e0e0e0; font-family: var(--mc-font); font-size: 12px;
  text-shadow: 2px 2px 0 #3f3f3f;
  width: 100%; padding: 2px; margin: 0; border-radius: 0;
  resize: none;
}
.mc-textentry:focus { border: none; outline: none; }

.mc-slider {
  position: relative; background: #000000b3; border: 1px solid #000;
  min-height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; max-width: 100%; cursor: ew-resize; touch-action: none;
}
.mc-slider-handle {
  position: absolute; top: 0; bottom: 0;
  background: #8b8b8b; border: 1px solid #000;
  box-shadow: inset 0 1px 0 #ffffff33, inset 0 -2px 0 #00000055;
  pointer-events: none;
}
.mc-slider-label { position: relative; z-index: 1; pointer-events: none; }

/* item body element */

.mc-item-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.mc-item-slot {
  position: relative; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.mc-item-img {
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated;
  display: block;
}
.mc-item-glyph { font-size: 9px; color: #cfd4de; text-shadow: none; }
.mc-item-count { position: absolute; right: -2px; bottom: -4px; font-size: 11px; }
.mc-item-desc { text-align: left; }

/* MiniMessage rendering */

/* One rune from a sprite strip. Drawn as a mask filled with the current text
   colour, so runes take colours and gradients like any other text. */
.mc-glyph {
  display: inline-block;
  vertical-align: text-bottom;
  background-color: currentColor;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  image-rendering: pixelated;
}

.mm-obf { filter: blur(1.4px); opacity: 0.85; }
.mm-interactive { text-decoration: underline dotted; cursor: help; }
/* A font the preview cannot draw truthfully — see the Fonts panel. */
.mm-unfaithful { outline: 1px dotted #e8c26866; outline-offset: 1px; }

/* ---- fonts panel ---- */

.font-card {
  border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 10px; margin-bottom: 8px; background: var(--bg-raise);
}
.font-card.is-approx { border-style: dashed; }

.font-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.font-card-head strong { font-size: 12.5px; }

.font-pill {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 5px; border-radius: 10px;
  background: var(--accent-dim); color: #fff;
}
.font-pill.is-warn { background: #6b5a2a; color: var(--warn); }

.font-sample {
  background: #0d0f13; border: 1px solid var(--line-soft); border-radius: 5px;
  padding: 7px 8px; margin-bottom: 6px;
  font-size: 14px; color: #fff; text-shadow: 0.125em 0.125em 0 #3f3f3f;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.font-key {
  display: block; font-family: var(--mono); font-size: 10.5px;
  color: var(--accent); margin-bottom: 5px; word-break: break-all;
}
.font-blurb { margin: 0; font-size: 11px; line-height: 1.5; color: var(--text-dim); }
.font-why {
  margin: 6px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--warn);
  border-left: 2px solid #e8c26855; padding-left: 7px;
}
.font-error { margin: 6px 0 0; font-size: 11px; line-height: 1.5; color: var(--error); }

.font-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.font-copy {
  background: none; border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 5px; padding: 4px 8px;
  font: inherit; font-size: 10.5px; cursor: pointer;
}
.font-copy:hover { color: var(--text); border-color: var(--accent-dim); }
.font-copy.is-done { color: var(--ok); border-color: #6dd58c66; }
.font-copy.is-danger:hover { color: var(--error); border-color: var(--error); }

.font-drop {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px dashed var(--line); border-radius: 7px;
  padding: 12px 10px; text-align: center; cursor: pointer;
  background: #00000026;
}
.font-drop:hover, .font-drop.is-over { border-color: var(--accent); background: #63b3ff14; }
.font-drop strong { font-size: 12px; }

.font-drop-form {
  border: 1px solid var(--accent-dim); border-radius: 7px;
  padding: 10px; background: #63b3ff0f;
}
.font-drop-form .control { margin-top: 6px; }

/* ---- drag feedback ---- */

.is-dragging .mc-zone.is-target { border-color: var(--accent-dim); background: #63b3ff1a; }
.is-dragging .mc-zone.is-target.is-over { border-color: var(--accent); background: #63b3ff2e; }
.is-dragging .mc-zone.is-blocked { opacity: 0.35; }
.is-dragging .el-controls { display: none !important; }

.drop-caret {
  height: 3px; width: 60%; background: var(--accent);
  border-radius: 2px; align-self: center;
}
.drop-caret.is-horizontal { height: auto; width: 3px; min-height: 24px; align-self: stretch; }

/* ---- bottom code panel ---- */

.bottom {
  position: relative;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.grip { display: none; }
body.code-open .grip {
  display: block;
  position: absolute; top: -3px; left: 0; right: 0; height: 9px;
  cursor: ns-resize; z-index: 6;
}
.grip-bar {
  position: absolute; top: 3px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 3px; border-radius: 3px; background: var(--line);
}
.grip:hover .grip-bar { background: var(--accent-dim); }

.bottom-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 14px; flex-wrap: wrap; flex: 0 0 auto;
}
body.code-open .bottom-head { border-bottom: 1px solid var(--line-soft); }

.code-toggle {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-raise); border: 1px solid var(--line);
  color: var(--text); border-radius: 6px;
  padding: 5px 11px; font: inherit; font-size: 12px; cursor: pointer;
}
.code-toggle:hover { border-color: var(--accent-dim); }

.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-dim); padding: 5px 11px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.is-active { color: var(--text); background: var(--bg-raise); border-color: var(--line); }

.bottom-actions { display: flex; align-items: center; gap: 8px; }

.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.badge.is-ok { color: var(--ok); border-color: #6dd58c44; }
.badge.is-warn { color: var(--warn); border-color: #e8c26844; }
.badge.is-error { color: var(--error); border-color: #ef7a7244; }

.bottom-body { display: none; }
body.code-open .bottom-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 0;
  flex: 1 1 auto;
}

.code {
  margin: 0; padding: 12px 14px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: #cfd6e2; white-space: pre; tab-size: 4;
}

.side { border-left: 1px solid var(--line-soft); padding: 12px 14px; overflow-y: auto; }
.code-note { margin: 0 0 14px; font-size: 11px; line-height: 1.6; color: var(--text-dim); }

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

.issue {
  display: flex; gap: 8px; align-items: flex-start; text-align: left;
  background: none; border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 8px 9px; color: var(--text-dim);
  font: inherit; font-size: 11.5px; line-height: 1.55; cursor: pointer;
}
.issue:disabled { cursor: default; }
.issue:not(:disabled):hover { border-color: var(--accent-dim); }
.issue.is-ok { cursor: default; border-style: dashed; }

.issue-dot {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #14161a;
}
.issue.is-error .issue-dot { background: var(--error); }
.issue.is-warning .issue-dot { background: var(--warn); }

/* ---- tooltips ---- */

.tooltip {
  position: fixed;
  z-index: 200;
  max-width: 320px;
  background: #0f1116;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px #0009;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  /* Kept off-screen until placed, so the first show never flashes at 0,0. */
  left: -9999px;
  top: -9999px;
}
.tooltip.is-visible { opacity: 1; transform: translateY(0); }
.tooltip.is-below { transform: translateY(-3px); }
.tooltip.is-below.is-visible { transform: translateY(0); }

.tooltip-title {
  display: block;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 6px;
}
.tooltip p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
}
.tooltip p + p { margin-top: 8px; }

/* ---- tips modal ---- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #06070999;
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(820px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px #0009;
}

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 20px 12px;
}
.modal-title { font-size: 18px; }
.modal-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-dim); }
.modal-close {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text-dim); width: 28px; height: 28px; cursor: pointer; font-size: 12px;
}
.modal-close:hover { color: var(--text); border-color: var(--accent-dim); }

.modal-tabs {
  display: flex; gap: 4px; padding: 0 20px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-tab {
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-dim); padding: 6px 12px;
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.is-active { color: var(--text); background: var(--bg-raise); border-color: var(--line); }

.modal-body { overflow-y: auto; padding: 16px 20px; flex: 1 1 auto; min-height: 0; }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px 16px; border-top: 1px solid var(--line-soft);
}
.modal-hint { font-size: 11px; color: var(--text-dim); }

.tips-lead { margin: 0 0 16px; font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }

.tip-card {
  border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; background: #00000026;
}
.tip-card h4 { font-size: 13px; margin-bottom: 8px; }
.tip-note { margin: 8px 0 0; font-size: 12px; line-height: 1.65; color: var(--text-dim); }

.tip-demo {
  font-family: var(--mc-font); font-size: 14px;
  background: #0d0f13; border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 9px 11px; margin-bottom: 8px; color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
  overflow-x: auto;
}

.snippet { position: relative; margin-top: 4px; }
.snippet-code {
  margin: 0; padding: 9px 74px 9px 11px;
  background: #0d0f13; border: 1px solid var(--line-soft); border-radius: 6px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  color: #cfd6e2; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.snippet-copy {
  position: absolute; top: 6px; right: 6px;
  background: var(--bg-raise); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: 5px;
  padding: 3px 9px; font: inherit; font-size: 11px; cursor: pointer;
}
.snippet-copy:hover { color: var(--text); border-color: var(--accent-dim); }
.snippet-copy.is-done { color: var(--ok); border-color: #6dd58c66; }
.snippet-lang {
  position: absolute; bottom: 6px; right: 8px;
  font-size: 10px; color: var(--text-dim);
}

.mini-tabs { display: flex; gap: 4px; margin-top: 10px; }
.mini-tab {
  background: none; border: 1px solid var(--line-soft); border-radius: 5px;
  color: var(--text-dim); padding: 3px 9px;
  font: inherit; font-size: 11px; cursor: pointer;
}
.mini-tab:hover { color: var(--text); }
.mini-tab.is-active { color: var(--text); background: var(--bg-raise); border-color: var(--line); }
.mini-tab-body { margin-top: 6px; }

/* ---- narrow screens ---- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .panel { max-height: 320px; }
  .panel-left { border-right: none; border-bottom: 1px solid var(--line); }
  .panel-right { border-left: none; border-top: 1px solid var(--line); }
  body.code-open .bottom-body { grid-template-columns: 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line-soft); }
}
