@font-face {
  font-family: "Minecraft Preview";
  src: url("../assets/fonts/minecraft.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Unifont Preview";
  src: url("../assets/fonts/unifont.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Unifont Upper Preview";
  src: url("../assets/fonts/unifont-upper.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1a1d23;
  --panel-raised: #20242b;
  --border: #313640;
  --border-soft: #282c34;
  --text: #f1f0ed;
  --muted: #a0a4ad;
  --muted-dark: #747b87;
  --gold: #e6c489;
  --gold-strong: #f2d398;
  --green: #84bf97;
  --mono: "Cascadia Code", Consolas, monospace;
  --sans: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -30%, #242831 0%, transparent 66%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 3px;
}

.app-shell { min-height: 100vh; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 76px);
  border-bottom: 1px solid var(--border-soft);
  background: #15171cbb;
}

.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); }
.brand-mark {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
  background: #a0b086;
  box-shadow: inset -5px -5px 0 #788565, inset 3px 3px 0 #c5cea7, 0 0 18px #a0b08625;
  image-rendering: pixelated;
}
.brand-mark::before, .brand-mark::after, .brand-mark i {
  position: absolute;
  display: block;
  width: 4px;
  height: 4px;
  content: "";
  background: #29302b;
}
.brand-mark::before { top: 6px; left: 5px; }
.brand-mark::after { top: 6px; right: 5px; }
.brand-mark i { bottom: 5px; left: 10px; width: 5px; height: 3px; }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 16px; letter-spacing: 2px; }

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.save-status { min-width: 162px; margin: 0 8px 0 0; color: var(--muted); font-size: 12px; text-align: right; }
.save-status[data-state="saved"] { color: var(--green); }
.save-status[data-state="saving"] { color: var(--gold); }
.save-status[data-state="error"] { color: #e59b87; }

.button {
  min-height: 39px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 13px;
  background: #202329;
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
  cursor: pointer;
}
.button:hover { border-color: #62656c; background: #292d34; }
.button:active { transform: translateY(1px); }
.button-primary { border-color: #e6c489; background: var(--gold); color: #282217; }
.button-primary:hover { border-color: #f2d398; background: var(--gold-strong); }
.button-quiet { color: #d6d5d2; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

main { width: min(1480px, 100%); margin: 0 auto; padding: 40px clamp(20px, 5vw, 76px) 26px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 27px; }
.eyebrow, .panel-kicker { margin: 0; color: var(--gold); font-family: var(--mono); font-size: 10px; letter-spacing: 1.8px; }
h1 { margin: 5px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(31px, 4vw, 43px); font-weight: 400; letter-spacing: -.9px; line-height: 1.16; }
.intro-copy { max-width: 680px; margin: 0; color: var(--muted); font-size: 14px; }
.version-chip { margin-bottom: 4px; border: 1px solid #383c42; border-radius: 99px; padding: 5px 10px; color: #9499a1; font-family: var(--mono); font-size: 10px; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: linear-gradient(150deg, #1d2026, var(--panel) 42%); box-shadow: 0 14px 38px #00000013; }
.panel-heading { min-height: 71px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--border-soft); }
.panel-kicker { margin-bottom: 4px; color: #a3977f; font-size: 9px; letter-spacing: 1.5px; }
h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; color: #a5b699; font-family: var(--mono); font-size: 9px; letter-spacing: 1.2px; }
.live-indicator span { width: 6px; height: 6px; border-radius: 50%; background: #95b17b; box-shadow: 0 0 9px #95b17b66; }

.editor-fields { padding: 21px 20px 18px; }
.field-label { display: block; margin-bottom: 8px; color: #d9d8d4; font-size: 12px; font-weight: 600; }
.name-input, .description-input {
  width: 100%;
  border: 1px solid #383d46;
  border-radius: 5px;
  background: #13151a;
  color: #f0efec;
  box-shadow: inset 0 2px 5px #00000020;
}
.name-input { min-height: 45px; padding: 10px 12px; font-size: 14px; }
.name-input::placeholder, .description-input::placeholder { color: #6f747e; opacity: 1; }
.name-input:focus, .description-input:focus { border-color: #8d7d5e; outline-offset: 1px; }
.description-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 8px; }
.description-label-row .field-label { margin: 0; }
.field-hint { color: #7f858e; font-size: 10px; text-align: right; }
.description-input {
  min-height: 360px;
  resize: vertical;
  padding: 14px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.editor-footnote { margin: 12px 1px 0; color: #868b94; font-size: 11px; line-height: 1.55; }
.unicode-alert { margin: 8px 0 0; padding: 10px 11px; border: 1px solid #675331; border-radius: 5px; background: #201d17; }
.unicode-alert[hidden], .unicode-action[hidden], .vs16-action[hidden] { display: none; }
.unicode-alert-message { margin: 0; color: #f0d29a; font-size: 11px; line-height: 1.5; white-space: pre-line; }
.unicode-alert-help { margin: 4px 0 8px; color: #a8a198; font-size: 10px; line-height: 1.45; }
.unicode-alert-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.unicode-action, .vs16-action { min-height: 29px; padding: 5px 9px; font-size: 10px; }

.preview-panel { display: flex; flex-direction: column; }
.preview-heading { min-height: 71px; }
.approx-badge { border: 1px solid #816c4a; border-radius: 4px; padding: 4px 7px; color: var(--gold-strong); font-family: var(--mono); font-size: 9px; letter-spacing: .9px; white-space: nowrap; }
.approx-badge span { margin-right: 3px; font-size: 14px; vertical-align: -1px; }
.preview-zoom-readout { min-width: 38px; color: #ded8c9; font-family: var(--mono); font-size: 10px; text-align: right; }
.preview-reset { min-height: 30px; padding: 5px 8px; font-size: 10px; white-space: nowrap; }
.preview-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 15px 20px 13px; border-bottom: 1px solid var(--border-soft); background: #191c21; }
.preview-control-note { grid-column: 1 / -1; margin: -3px 0 0; color: #7f858e; font-size: 9px; line-height: 1.45; }
.vanilla-font-status { margin: 0; padding: 9px 20px 0; color: #e8a1a1; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.vanilla-font-status[hidden] { display: none; }
.tooltip-name[data-vanilla-font-version],
.tooltip-link-label[data-vanilla-font-version],
.tooltip-roleplay-label[data-vanilla-font-version],
.tooltip-description[data-vanilla-font-version] { font-size: 16px; line-height: 20px; }
.tooltip-date[data-vanilla-font-version],
.tooltip-st-signature-title[data-vanilla-font-version],
.tooltip-st-signature-byline[data-vanilla-font-version] { font-size: 16px; line-height: 20px; }
.tooltip-link-label[data-vanilla-font-version],
.tooltip-roleplay-label[data-vanilla-font-version] { height: 20px; }
.tooltip-date[data-vanilla-font-version],
.tooltip-st-signature-title[data-vanilla-font-version],
.tooltip-st-signature-byline[data-vanilla-font-version] { height: 20px; }
/* At GUI scale 2, DPR 1, and preview zoom 100%, 4 screenshot px = 4 CSS/backing px = 2 logical renderer px. */
.tooltip-name[data-vanilla-font-version]:not([hidden]) ~ #tooltip-tags,
.tooltip-name[data-vanilla-font-version]:not([hidden]) ~ .tooltip-description,
.tooltip-name[data-vanilla-font-version]:not([hidden]) ~ .tooltip-date,
.tooltip-name[data-vanilla-font-version]:not([hidden]) ~ .tooltip-st-signature:not([hidden]) { position: relative; top: 4px; }
.tooltip-description[data-vanilla-font-version] { position: relative; left: -4px; }
.tooltip-name[data-vanilla-font-version] canvas,
.tooltip-link-label[data-vanilla-font-version] canvas,
.tooltip-roleplay-label[data-vanilla-font-version] canvas,
.tooltip-description[data-vanilla-font-version] canvas,
.tooltip-date[data-vanilla-font-version] canvas,
.tooltip-st-signature-title[data-vanilla-font-version] canvas,
.tooltip-st-signature-byline[data-vanilla-font-version] canvas { display: block; max-width: none; image-rendering: pixelated; }
.preview-tag-controls { min-width: 0; grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 17px; margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--border-soft); }
.preview-tag-controls legend { padding: 0 8px 0 0; color: #a8aab0; font-family: var(--mono); font-size: 9px; letter-spacing: 1px; }
.preview-tag-toggle { display: inline-flex; align-items: center; gap: 7px; color: #c6c7ca; font-size: 10px; cursor: pointer; }
.preview-tag-toggle input { width: 13px; height: 13px; margin: 0; accent-color: var(--gold); }
.tag-swatch { width: 7px; height: 7px; border-radius: 1px; }
.tag-swatch-gold { background: #ffaa00; box-shadow: 0 0 6px #ffaa0055; }
.tag-swatch-blue { background: #5555ff; box-shadow: 0 0 6px #5555ff55; }
.tag-swatch-green { background: #55ff55; box-shadow: 0 0 6px #55ff5555; }
.tag-swatch-aqua { background: #00aaaa; box-shadow: 0 0 6px #00aaaa55; }
.preview-date-entry { display: inline-flex; align-items: center; gap: 7px; color: #a8aab0; font-size: 10px; }
.preview-date-entry input { width: min(230px, 38vw); min-height: 29px; border: 1px solid #383d46; border-radius: 4px; padding: 4px 7px; background: #13151a; color: #d6d5d2; font-size: 10px; }
.preview-date-entry input:disabled { color: #7d828a; }
.preview-tag-note { flex-basis: 100%; margin: -5px 0 0 20px; color: #777e88; font-size: 9px; line-height: 1.4; }

.preview-stage {
  position: relative;
  min-height: 440px;
  flex: 1;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow: auto;
  isolation: isolate;
  padding: 56px 22px 42px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background:
    linear-gradient(140deg, #151920ef, #252a31db 48%, #191d23f0),
    #171a20;
}
.stage-grid { position: absolute; z-index: -1; inset: 0; opacity: .26; background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, black, transparent 88%); }
.stage-label { position: absolute; top: 16px; left: 19px; display: flex; align-items: center; gap: 8px; color: #9298a2; font-family: var(--mono); font-size: 9px; letter-spacing: 1.15px; }
.stage-dot { width: 5px; height: 5px; border: 1px solid #8c9578; background: #a0b086; box-shadow: 0 0 7px #a0b0865a; }
.stage-coordinate { position: absolute; right: 18px; bottom: 14px; color: #646b74; font-family: var(--mono); font-size: 8px; letter-spacing: 1.2px; }
.tooltip-frame { position: relative; flex: 0 0 auto; margin: auto; }
.tooltip-frame[hidden] { display: none; }
.tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  transform-origin: top left;
  padding: 7px 8px 8px;
  border: 1px solid #3c123f;
  background: linear-gradient(135deg, rgb(16 0 16 / 96%), rgb(16 0 16 / 93%));
  box-shadow: 0 0 0 1px #0b070d, 0 6px 18px #0009, inset 0 1px #6c317155;
  color: #f5f1f5;
  font-family: "Minecraft Preview", "Unifont Preview", "Unifont Upper Preview", monospace;
  font-size: 16px;
  font-variant-ligatures: none;
  line-height: 1.125;
  letter-spacing: 0;
  text-shadow: 1px 1px #000c;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-rendering: geometricPrecision;
  width: max-content;
}
.tooltip-name { color: #f3f0f3; font-style: normal; white-space: pre; }
.tooltip-tags { margin: 0; }
.tooltip-link-label { color: #ffaa00; font-style: normal; white-space: pre; }
.tooltip-roleplay-label { color: #5555ff; font-style: normal; white-space: pre; }
.tooltip-description { margin: 0; color: #aaaaaa; font-style: italic; white-space: pre; overflow-wrap: normal; word-break: normal; }
.tooltip-date { display: block; margin: 1.125em 0; color: #00aaaa; font-style: italic; line-height: inherit; white-space: pre; }
.tooltip-description[data-vanilla-font-version] ~ .tooltip-date { margin-block: 20px; }
.tooltip-date[hidden] { display: none; }
.tooltip-st-signature { margin: 0; color: #555555; font-style: normal; white-space: normal; }
.tooltip-st-signature[hidden] { display: none; }
.tooltip-st-signature-title, .tooltip-st-signature-byline { display: block; font-style: normal; line-height: inherit; white-space: pre; }
.tooltip-st-signature-title, .tooltip-st-signature-byline, .tooltip-st-signature-name { font-weight: 400; }
.tooltip-st-signature-title > span:first-child, .tooltip-st-signature-title > span:last-child { color: #ff5555; }
.tooltip-st-signature-title > span:nth-child(2), .tooltip-st-signature-name { color: #55ff55; }
.tooltip-st-signature-period { color: #aaaaaa; }
.minecraft-glyph-metric { display: inline-block; position: relative; width: var(--metric-advance); line-height: inherit; vertical-align: baseline; white-space: pre; }
.minecraft-glyph-metric--unihex { left: calc(0em - var(--metric-ink-left)); }
.minecraft-glyph-metric--unihex.minecraft-glyph-metric--bearing-on-ink { left: 0; }
.minecraft-glyph-metric__ink { display: inline-block; width: var(--metric-source-advance); line-height: inherit; transform: scaleX(var(--metric-scale)); transform-origin: left center; white-space: pre; }
.minecraft-glyph-metric__ink--bearing { position: relative; left: calc(0em - var(--metric-ink-left)); }
.minecraft-text-presentation, .minecraft-glyph-metric__ink--text-presentation { display: inline-block; font-family: "Unifont Upper Preview", "Unifont Preview", "Minecraft Preview", monospace; font-variant-emoji: text; filter: grayscale(1); }
.minecraft-preview-sun { display: inline-block; position: relative; width: 1em; height: 1em; margin: 0; vertical-align: -.125em; white-space: pre; }
.minecraft-preview-sun__ink { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(1px 1px #000c); }
.minecraft-preview-sun__source { display: none; }
.tooltip-description .minecraft-preview-sun__ink { transform: skewX(-10deg); transform-origin: left bottom; }
.minecraft-vs16-marker, .minecraft-zwj-marker { display: inline-block; position: relative; width: 12px; height: 16px; margin: 0 2px 0 1px; box-sizing: border-box; border: 1px solid currentColor; font-size: 0; line-height: 1; vertical-align: baseline; }
.minecraft-vs16-marker::before, .minecraft-zwj-marker::before { position: absolute; inset: 1px 0; color: currentColor; font-family: var(--mono); font-weight: 600; text-align: center; white-space: pre; }
.minecraft-vs16-marker::before { content: "VS\A 16"; font-size: 6px; letter-spacing: -.2px; line-height: 6px; }
.minecraft-zwj-marker::before { content: "ZWJ"; font-size: 4px; letter-spacing: -.35px; line-height: 14px; }
.tooltip-name[hidden], .tooltip-description[hidden] { display: none; }
.empty-preview { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 13px; color: #727985; text-align: center; }
.empty-preview[hidden] { display: none; }
.empty-preview p { margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.8; }
.empty-cube { position: relative; width: 34px; height: 34px; border: 1px solid #5d655b; background: linear-gradient(135deg, #7d8a69 0 49%, #5d6950 50%); box-shadow: inset 4px 4px #a5b28a4a, inset -4px -4px #303a2e70, 0 8px 18px #0004; transform: rotate(-6deg); }
.empty-cube::before { position: absolute; top: 8px; left: 7px; width: 5px; height: 5px; background: #31372e; box-shadow: 13px 0 #31372e, 6px 12px #31372e; content: ""; }

.mobile-tabs { display: none; }
.page-footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 16px; color: #828791; font-size: 10px; }
.page-footer > span:first-child { display: flex; align-items: center; gap: 8px; }
.footer-square { width: 6px; height: 6px; background: #8e9d77; box-shadow: 0 0 6px #8e9d7755; }

.import-dialog { width: min(410px, calc(100vw - 32px)); border: 1px solid #45413a; border-radius: 9px; padding: 23px; background: #1b1e24; color: var(--text); box-shadow: 0 20px 80px #000b; }
.import-dialog::backdrop { background: #08090ccc; backdrop-filter: blur(3px); }
.import-dialog h2 { margin-top: 4px; font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 400; }
.dialog-copy { margin: 11px 0 21px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

@media (max-width: 860px) {
  main { padding-top: 30px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .description-input { min-height: 300px; }
  .preview-stage { min-height: 400px; }
}

@media (max-width: 640px) {
  .topbar { min-height: 67px; padding: 0 16px; gap: 10px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 12px; letter-spacing: 1.3px; }
  .brand-mark { width: 20px; height: 20px; }
  .brand-mark::before { top: 5px; left: 4px; }
  .brand-mark::after { top: 5px; right: 4px; }
  .brand-mark i { bottom: 4px; left: 8px; }
  .topbar-actions { gap: 6px; }
  .save-status { position: absolute; left: 16px; top: 72px; min-width: 0; margin: 0; font-size: 10px; text-align: left; }
  .button { min-height: 34px; padding: 6px 8px; font-size: 10px; }
  main { padding: 35px 15px 20px; }
  .intro { align-items: flex-start; margin-bottom: 19px; }
  .intro-copy { max-width: 410px; font-size: 12px; }
  .version-chip { display: none; }
  .mobile-tabs { display: flex; gap: 6px; margin: 0 0 10px; padding: 4px; border: 1px solid #30343b; border-radius: 7px; background: #17191e; }
  .mobile-tab { min-height: 34px; flex: 1; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #8e949d; font-size: 12px; cursor: pointer; }
  .mobile-tab.is-active { border-color: #41434a; background: #282b31; color: #eee9dd; }
  .workspace { display: block; }
  .workspace[data-mobile-view="preview"] .editor-panel { display: none; }
  .workspace[data-mobile-view="edit"] .preview-panel { display: none; }
  .panel-heading { min-height: 63px; padding: 13px 15px; }
  .editor-fields { padding: 17px 15px 16px; }
  .description-input { min-height: 53vh; font-size: 12px; }
  .field-hint { max-width: 53%; font-size: 9px; }
  .preview-controls { padding: 13px 15px 11px; gap: 11px; }
  .preview-heading { gap: 8px; }
  .preview-zoom-readout { min-width: 34px; }
  .preview-stage { min-height: min(63vh, 500px); padding-right: 15px; padding-left: 15px; }
  .tooltip { max-height: 55vh; }  .page-footer { flex-direction: column; gap: 5px; margin: 12px 2px 0; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
