@font-face { font-family: Oswald; src: url("fonts/Oswald.ttf") format("truetype"); font-weight: 200 700; }
@font-face { font-family: Barlow; src: url("fonts/Barlow-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: Barlow; src: url("fonts/Barlow-Bold.ttf") format("truetype"); font-weight: 700; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-Bold.ttf") format("truetype"); font-weight: 700; }
@font-face { font-family: "Russo One"; src: url("fonts/RussoOne-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: Audiowide; src: url("fonts/Audiowide-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Bebas Neue"; src: url("fonts/BebasNeue-Regular.ttf") format("truetype"); font-weight: 400; }
* { box-sizing: border-box; }
body { margin: 0; background: #f2f2ef; color: #22241e; font: 14px Arial, sans-serif; }
header { background: #20231c; color: white; padding: 18px 26px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
h1, h2, p { margin: 0; }
h1 { font-size: 23px; }
header p { color: #c8cdb5; margin-top: 5px; }
.actions, .row { display: flex; align-items: end; gap: 8px; }
.actions { flex-wrap: wrap; }
.header-controls { display: flex; flex: 1; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; min-width: 0; }
.export-actions { margin-left: auto; }
main { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - 83px); }
aside { background: white; border-right: 1px solid #dcded5; padding: 18px; overflow-y: auto; }
aside section { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #e6e8df; }
h2 { font-size: 16px; margin-bottom: 8px; }
p { line-height: 1.45; }
aside p, .workspace-heading p, .note { color: #666b5c; font-size: 12px; }
label { display: block; font-size: 12px; font-weight: bold; margin-top: 11px; }
input, select, textarea, button { font: inherit; }
input:not([type="checkbox"]), select, textarea { display: block; width: 100%; border: 1px solid #c9cdbf; border-radius: 5px; background: white; padding: 8px; margin-top: 5px; color: #222; }
input[type="color"] { height: 36px; padding: 2px; }
input[type="file"] { font-size: 11px; }
textarea { resize: vertical; }
button { cursor: pointer; border: 1px solid #bdc4aa; background: #f6f7f1; padding: 9px 11px; border-radius: 5px; font-weight: bold; color: #303828; }
button:hover { background: #e9eddc; }
button:disabled { opacity: .6; cursor: wait; }
button.primary { background: #b6be95; border-color: #b6be95; color: #171a13; }
button.primary:hover { background: #c9d2a5; }
button.secondary { margin-top: 9px; width: 100%; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; gap: 6px; align-items: center; font-weight: normal; }
.gallery-section { border-top: 1px solid #e6e8df; margin-top: 16px; padding-top: 12px; }
.gallery-section > h3 { font-size: 14px; margin: 0 0 6px; }
.gallery-section > p { margin-top: 8px; }
.gallery-section > button { width: 100%; margin-top: 10px; }
#galleryStatus.error { color: #a42d26; }
.gallery:empty { display: none; }
.gallery { max-height: 420px; overflow-y: auto; margin-top: 12px; }
.gallery h3 { font-size: 12px; margin: 12px 0 4px; overflow-wrap: anywhere; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.gallery button { margin: 0; padding: 5px; font-size: 11px; text-align: left; overflow-wrap: anywhere; }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: white; margin-bottom: 5px; }
.hint { margin-top: 14px; }
#status { white-space: pre-wrap; line-height: 1.4; color: #3c5735; }
#status.error { color: #a42d26; }
.workspace { padding: 24px; min-width: 0; }
.workspace-heading { margin-bottom: 14px; }
.history-actions { display: flex; gap: 8px; margin-top: 12px; }
.history-actions button:disabled { cursor: default; }
.swap-panel { margin-top: 12px; }
.swap-panel summary { cursor: pointer; font-weight: bold; }
.swap-panel p { margin-top: 6px; }
.swap-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.swap-grid { display: grid; grid-template-columns: repeat(4, 55px); grid-template-rows: repeat(2, 48px); gap: 5px; margin-top: 8px; }
.swap-grid button { margin: 0; padding: 4px; font-size: 19px; cursor: grab; }
.swap-grid button:first-child { grid-row: span 2; }
.swap-grid button[aria-pressed="true"] { outline: 3px solid #438be0; outline-offset: -3px; }
.swap-grid button:active { cursor: grabbing; }
.canvas-wrap { background: #d3d5ca; padding: 10px; border-radius: 8px; box-shadow: 0 2px 12px #0002; }
canvas { width: 100%; height: auto; display: block; background: white; touch-action: none; cursor: crosshair; }
.note { margin-top: 14px; }
[hidden] { display: none !important; }
@media (max-width: 850px) {
  header { align-items: flex-start; flex-direction: column; }
  .header-controls { width: 100%; }
  main { display: flex; flex-direction: column-reverse; }
  aside { border-right: 0; border-top: 1px solid #dcded5; }
  .workspace { padding: 14px; }
}
