:root {
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  color: #181818;
  background: #fff;
  --page: #fff;
  --surface: #fff;
  --ink: #181818;
  --muted: #64666a;
  --line: #dbdcde;
  --button: #f3f3f3;
  --selected: #202020;
  --selected-ink: #fff;
  --red: #e51d2d;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.logo-color-filter { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { width: min(1220px, 100%); min-height: 100vh; margin: auto; padding: 20px 24px 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 52px; padding: 5px 0 19px; }
.header-brand { display: block; flex: 0 0 auto; width: 168px; max-width: 45vw; height: auto; }
.header-side { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font-size: 1.4rem; }
.workspace { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 34px; align-items: start; }
.site-footer { margin-top: 56px; padding: 24px 0 28px; border-top: 1px solid var(--line); text-align: center; }
.demo-disclaimer { margin: 0 auto 18px; max-width: 60ch; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.footer-brand { display: block; width: 142px; max-width: 55vw; height: auto; margin: 0 auto; }
.preview-panel { position: sticky; top: 18px; min-width: 0; }
.preview-footline { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); font-size: .8rem; }
.preview-footline { padding-top: 10px; }
.fabric { position: relative; height: clamp(300px, 38vw, 485px); overflow: hidden; border-radius: 12px; background-color: #f4f2ef; background-image: repeating-linear-gradient(86deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px), repeating-linear-gradient(176deg, rgba(255,255,255,.08) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1), inset 0 0 26px rgba(0,0,0,.06); transition: background-color .2s ease; }
.fabric[data-orientation="vertical"] { height: clamp(400px, 52vw, 600px); }
#previewCanvas { width: 100%; height: 100%; display: block; }
.controls { min-width: 0; padding-top: 2px; }
.field { display: grid; gap: 9px; }
.field > label, legend, .size-group > label { color: var(--ink); font-size: 1rem; font-weight: 800; }
.text-input-wrap { position: relative; display: block; }
#previewText { width: 100%; height: 52px; padding: 0 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); font-size: 1rem; font-weight: 600; }
.text-input-wrap #previewText { padding-right: 49px; }
#clearText { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); width: 27px; height: 27px; border: 0; border-radius: 50%; color: #fff; background: var(--muted); font-size: 1.15rem; line-height: 1; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; padding: 0; }
.control-group { margin-top: 29px; }
.font-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.font-option { min-height: 57px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--button); text-align: center; transition: border-color .15s ease, background-color .15s ease; }
.font-option:hover { border-color: var(--red); }
.font-option.active { border: 2px solid var(--red); padding: 9px 11px; color: var(--selected-ink); background: var(--selected); }
.font-option strong { display: block; font-size: .94rem; line-height: 1.25; }
.font-option small { display: none; }
.size-group > label { display: block; margin-bottom: 11px; }
.size-control { display: grid; grid-template-columns: 41px minmax(0, 1fr) 41px 65px; align-items: center; gap: 12px; }
.size-control button { height: 41px; border: 1px solid var(--line); border-radius: 8px; background: var(--button); color: var(--ink); font-size: 1.45rem; line-height: 1; }
.size-control button:hover { border-color: var(--red); }
.size-control input { width: 100%; accent-color: var(--red); }
.size-control output { text-align: right; white-space: nowrap; font-size: .9rem; font-weight: 800; }
.swatches { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; padding: 4px 3px; }
.swatch { width: 43px; height: 43px; padding: 0; border: 1px solid rgba(0,0,0,.14); border-radius: 50%; background: var(--color); }
.swatch.active { outline: 2px solid var(--red); outline-offset: 3px; }
.fabric-swatches .swatch { border-radius: 8px; background-image: repeating-linear-gradient(87deg, rgba(0,0,0,.045) 0 1px, transparent 1px 3px); }
.view-switch, .orientation-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.view-switch button, .orientation-switch button { min-height: 46px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--button); font-size: .92rem; font-weight: 700; }
.view-switch button.active, .orientation-switch button.active { border: 2px solid var(--red); color: var(--selected-ink); background: var(--selected); }
.status-text { margin: 27px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.export-actions { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.export-actions button { width: 100%; min-height: 50px; border: 0; border-radius: 9px; background: var(--red); color: #fff; font-weight: 800; font-size: 1rem; }
.export-actions button:hover { filter: brightness(.94); }
.export-actions button:disabled { opacity: .5; cursor: wait; }
:root[data-theme="dark"] { color-scheme: dark; --page: #141414; --surface: #212121; --ink: #f7f7f7; --muted: #b7b7b7; --line: #414141; --button: #292929; --selected: #202020; --selected-ink: #fff; }
:root[data-theme="dark"] .header-brand, :root[data-theme="dark"] .footer-brand { filter: url(#logo-dark-ink); }
@media (max-width: 850px) {
  .app-shell { --mobile-gutter: 18px; --sticky-header-height: 92px; width: min(620px, 100%); padding: 20px var(--mobile-gutter) 0; }
  .topbar { position: sticky; top: 0; z-index: 30; height: var(--sticky-header-height); min-height: 0; margin: -20px calc(-1 * var(--mobile-gutter)) 0; padding: 20px var(--mobile-gutter) 12px; background: var(--page); }
  .workspace { display: flex; flex-direction: column; gap: 23px; }
  .preview-panel { position: sticky; top: var(--sticky-header-height); z-index: 29; align-self: stretch; width: calc(100% + 2 * var(--mobile-gutter)); margin: 0 calc(-1 * var(--mobile-gutter)); padding: 8px var(--mobile-gutter) 12px; background: var(--page); box-shadow: 0 8px 12px -12px rgba(0,0,0,.35); }
  .preview-footline { min-width: 0; font-size: clamp(.68rem, 2.8vw, .8rem); white-space: nowrap; }
  .controls { width: 100%; }
  .fabric { height: clamp(220px, 44vw, 300px); }
  .fabric[data-orientation="vertical"] { height: clamp(240px, 42dvh, 340px); }
}
@media (max-width: 480px) {
  .app-shell { --mobile-gutter: 17px; --sticky-header-height: 83px; padding-top: 18px; }
  .topbar { margin-top: -18px; padding-top: 18px; }
  .header-brand { width: 148px; }
  .site-footer { margin-top: 42px; padding: 20px 0 24px; }
  .footer-brand { width: 132px; }
  .fabric { height: 210px; }
  .fabric[data-orientation="vertical"] { height: clamp(240px, 42dvh, 340px); }
  .swatches { justify-content: space-between; gap: 9px; }
  .swatch { width: 40px; height: 40px; }
}
