@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;750;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #121214;
  --panel: #171719;
  --surface: #202023;
  --border: #2b2b30;
  --text: #f5f4f5;
  --muted: #a7a6ae;
  --quiet: #85848e;
  --brand-red: #ed3346;
  --accent: #ff515f;
  font-family: Inter, system-ui, sans-serif;
  font-synthesis: none;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button, input, .replace-button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
svg { flex: none; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.masthead {
  height: 66px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: #151517;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 750; letter-spacing: -.045em; }
.brand strong { font-weight: 750; color: #f5f4f5; }
.brand-icon {
  height: 35px; width: 38px; display: grid; place-items: center;
  background: var(--brand-red); border-radius: 10px; color: #fff;
  box-shadow: inset 0 1px 0 #ffffff30, 0 3px 8px #0004;
}
.help-button {
  display: flex; align-items: center; gap: 7px; color: var(--muted);
  background: #1b1b1e; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font-size: 12px; font-weight: 550;
}
.help-button:hover { color: var(--text); background: var(--surface); }
.importer {
  padding: 26px 32px 23px;
  background: #141416;
  border-bottom: 1px solid var(--border);
}
.importer h1 { font-size: clamp(23px, 3vw, 30px); font-weight: 750; letter-spacing: -.055em; line-height: 1.2; }
.importer p { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 7px; }
.import-form { display: flex; max-width: 860px; gap: 10px; margin-top: 17px; }
.link-field {
  display: flex; flex: 1; min-width: 0; align-items: center; gap: 10px;
  padding: 0 13px; height: 46px; border: 1px solid #34343a;
  border-radius: 9px; color: var(--quiet); background: #1d1d20;
}
.link-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #ed334626; }
.link-field input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font-size: 13px; outline: none; padding: 10px 0; }
.link-field input:focus-visible { outline: none; }
input::placeholder { color: var(--quiet); opacity: 1; }
.primary {
  display: flex; justify-content: center; align-items: center; gap: 9px;
  padding: 0 16px; border: 1px solid #ff64704d; border-radius: 9px;
  background: #df2b40; box-shadow: inset 0 1px 0 #ffffff24, 0 2px 6px #0002;
  color: #fff; min-height: 43px; font-size: 13px; font-weight: 700;
  transition: background .15s ease;
}
.primary:hover:not(:disabled) { background: #ee364b; }
.import-button { gap: 15px; min-width: 160px; white-space: nowrap; }
.import-button svg { transition: transform .15s ease; }
.import-button:hover:not(:disabled) svg { transform: translateX(2px); }
#import-status { margin-top: 11px; color: var(--muted); font-size: 12px; max-width: 860px; line-height: 1.5; }
#import-status[data-level="error"] { color: #ff9aa5; }
#import-status[data-level="partial"] { color: #edc181; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 355px; min-height: calc(100dvh - 227px); }
.preview { display: flex; flex-direction: column; min-width: 0; }
.preview-toolbar, .editor-toolbar {
  height: 56px; padding: 0 22px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border);
}
.preview-toolbar { padding-left: 32px; background: #161618; }
.preview-heading, .editor-heading { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.preview-heading h2, .editor-heading h2 { font-size: 14px; color: var(--text); font-weight: 650; letter-spacing: -.018em; }
.example-tag {
  display: flex; align-items: center; gap: 5px; margin-left: 3px;
  border: 1px solid #383036; border-radius: 20px; padding: 3px 7px; font-size: 10px;
  font-weight: 600; color: #eeb2b8; background: #291c21;
}
.example-tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #f06a75; }
.preview-actions { display: flex; gap: 7px; }
.zoom-control { display: flex; background: #1c1c1f; border: 1px solid #303036; border-radius: 8px; overflow: hidden; }
.zoom-control button, .icon-button {
  display: grid; place-items: center; padding: 0; border: 0;
  height: 31px; width: 31px; background: transparent; color: var(--muted);
}
.zoom-control button:hover:not(:disabled), .icon-button:hover { background: #2b2b30; color: var(--text); }
.zoom-control button:focus-visible { outline-offset: -3px; }
#zoom-reset { width: 43px; font-size: 11px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.icon-button { border-radius: 8px; }
.fit-button { width: 33px; height: 33px; background: #1c1c1f; border: 1px solid #303036; }
.stage {
  flex: 1; min-height: 548px; height: max(548px, min(63vh, 730px)); overflow: auto; position: relative;
  background-color: #111113; background-image: radial-gradient(circle, #35353e 0.75px, transparent 1px);
  background-size: 19px 19px; background-position: 9px 9px; scrollbar-color: #414148 #161619;
  overscroll-behavior: contain;
}
.stage-content { min-height: 100%; min-width: 100%; width: max-content; display: grid; place-items: center; padding: 30px; }
.stage canvas { display: block; max-width: none; height: auto; border-radius: 14px; outline: 1px solid #ffffff18; box-shadow: 0 18px 65px #0009; }
.drop-instruction {
  display: none; position: sticky; bottom: 17px; margin: 0 auto; pointer-events: none;
  width: fit-content; border-radius: 10px; padding: 9px 12px; gap: 7px; align-items: center;
  background: #282127; border: 1px solid var(--accent); color: #fff; font-size: 12px;
}
.stage.dragging { box-shadow: inset 0 0 0 2px var(--accent); }
.stage.dragging .drop-instruction { display: flex; }
.preview-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px;
  padding: 0 22px 0 32px; border-top: 1px solid var(--border);
  background: #161618; color: var(--quiet); font-size: 11px;
}
.preview-footer > span:first-child { display: flex; gap: 7px; align-items: center; }
.editor { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--border); background: var(--panel); }
.editor-toolbar { padding: 0 19px; }
.reset-button { margin-right: -4px; }
.editor-body { padding: 0 18px; }
.editor-section { padding: 14px 0; }
.editor-section + .editor-section { border-top: 1px solid var(--border); }
.editor-section h3 { font-size: 12px; font-weight: 650; letter-spacing: -.012em; margin-bottom: 8px; color: #eeeef0; }
.theme-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: #202023; border: 1px solid #2d2d32; border-radius: 9px; }
.theme-control button {
  display: flex; justify-content: center; align-items: center; gap: 5px; min-width: 0;
  padding: 6px 3px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 550;
}
.theme-control button[aria-pressed=true] { border-color: #47434b; background: #323036; color: var(--text); box-shadow: 0 1px 2px #0003; }
.theme-control button[aria-pressed=true] svg { color: #ff8592; }
.theme-control button:hover { color: var(--text); }
.asset-list { display: grid; gap: 6px; }
.asset-row { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 4px; background: #1b1b1e; border: 1px solid #2b2b30; border-radius: 8px; }
.asset-thumb { flex: none; position: relative; display: grid; place-items: center; width: 43px; height: 34px; overflow: hidden; border-radius: 5px; color: #b19280; background: #302620; }
.asset-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.asset-copy { min-width: 0; flex: 1; }
.asset-copy strong, .asset-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.asset-copy strong { font-size: 11px; font-weight: 650; }
.asset-copy small { margin-top: 3px; color: var(--quiet); font-size: 10px; }
.replace-button {
  flex: none; display: flex; align-items: center; gap: 5px; padding: 6px 7px;
  color: #c3c2ca; font-size: 10px; border: 1px solid #35353a; background: #232326;
  border-radius: 6px; cursor: pointer;
}
.replace-button:hover, .asset-row:focus-within .replace-button { border-color: #78636b; color: var(--text); }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 9px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { color: #bdbcc4; font-size: 10.5px; font-weight: 550; }
.field-wide { grid-column: 1 / -1; }
.field input {
  width: 100%; min-width: 0; height: 32px; padding: 0 8px;
  border: 1px solid #323237; background: #202023; border-radius: 6px;
  color: var(--text); font-size: 11.5px;
}
.field input:focus-visible { outline-offset: 0; border-color: var(--accent); outline: 1px solid var(--accent); }
.export { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 18px 11px; background: #18181a; }
.download-button { width: 100%; position: relative; min-height: 42px; }
.download-button span {
  position: absolute; right: 9px; font-size: 9px; letter-spacing: .04em; font-weight: 800;
  padding: 4px 6px; background: #0002; border-radius: 4px;
}
#export-status { display: block; text-align: center; color: var(--quiet); font-size: 10px; line-height: 1.4; margin-top: 5px; }
dialog {
  max-width: min(460px, calc(100% - 32px)); padding: 21px; color: var(--text);
  border: 1px solid #3b3a40; border-radius: 14px; background: #1b1b1e; box-shadow: 0 20px 80px #0009;
}
dialog::backdrop { background: #0009; }
.dialog-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 11px; }
.dialog-heading h2 { font-size: 19px; letter-spacing: -.03em; }
dialog p { color: var(--muted); line-height: 1.55; font-size: 13px; margin-bottom: 11px; }
#key-form { display: grid; gap: 9px; margin-top: 15px; }
#key-form a { color: #ff9ca6; font-size: 11px; width: fit-content; }
#key-form .primary { margin-top: 5px; }
@media (min-width: 1650px) { .workspace { grid-template-columns: minmax(0, 1fr) 385px; } }
@media (max-width: 950px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 315px; }
  .masthead, .importer { padding-left: 21px; padding-right: 21px; }
  .preview-toolbar, .preview-footer { padding-left: 20px; padding-right: 15px; }
  .stage-content { padding: 20px; }
}
@media (max-width: 720px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .editor { border-left: 0; border-top: 1px solid var(--border); }
  .stage { min-height: 280px; height: clamp(280px, 63vw, 500px); }
  .editor-toolbar, .editor-body, .export { padding-left: 20px; padding-right: 20px; }
  .editor-section { padding-top: 15px; padding-bottom: 15px; }
  .field input { height: 38px; font-size: 13px; }
  .field > span, .asset-copy strong { font-size: 12px; }
  .replace-button { font-size: 11px; padding: 7px; }
}
@media (max-width: 450px) {
  .masthead { height: 58px; }
  .masthead, .importer { padding-left: 14px; padding-right: 14px; }
  .brand { gap: 7px; font-size: 15px; }
  .brand-icon { width: 33px; height: 32px; border-radius: 8px; }
  .help-button { gap: 5px; font-size: 11px; padding: 6px; }
  .importer { padding-top: 20px; padding-bottom: 18px; }
  .import-form { gap: 7px; }
  .import-button { padding: 0 9px; min-width: 0; gap: 5px; font-size: 11px; }
  .link-field { gap: 6px; padding: 0 7px; }
  .link-field input { font-size: 12px; }
  .link-field svg, .import-button svg { width: 15px; }
  .preview-toolbar, .preview-footer { padding-left: 14px; padding-right: 14px; }
  .stage-content { padding: 16px; }
}
