@layer reset, base, ui, layout;

@layer reset {
  *, *::before, *::after { box-sizing: border-box }
  body, h1, h2, h3, p, ol, ul { margin: 0 }
  [hidden] { display: none !important }
  a { color: inherit; text-decoration: none }
  button, input, select { font: inherit }
  img { max-width: 100%; display: block }
}
@layer base {
  :root {
    --canvas: #f8fafc; --paper: #fff; --ink: #0f172a; --muted: #475569; --blue: #2563eb;
    --edge: #dbe3ee; --soft-blue: #edf4ff; --navy: #14223b; --radius: 18px;
    font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    color: var(--ink); background: var(--canvas); line-height: 1.55;
  }
  body { min-height: 100dvh }
  html[lang=ko] { word-break: keep-all; overflow-wrap: break-word }
  main { min-height: 65dvh }
  ::selection { background: #dceaff; color: var(--ink) }
  :focus-visible { outline: 3px solid #1554c9; outline-offset: 4px }
  h1, h2, h3 { line-height: 1.2; letter-spacing: -.031em }
  h2 { font-size: clamp(1.35rem, 2.4vw, 1.8rem) }
  .wrap { width: min(1140px, calc(100% - 64px)); margin-inline: auto }
}
@layer ui {
  .skip { position: fixed; z-index: 1; left: 14px; top: 14px; padding: .65rem 1rem; background: white; transform: translateY(-150%) }
  .skip:focus { transform: none }
  .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; gap: .5rem; padding: .58rem 1rem;
    border-radius: 11px; border: 1px solid transparent; font-weight: 690; font-size: .91rem; text-align: center; cursor: pointer }
  .primary { color: white; background: var(--blue) }
  .primary:hover { background: #194fc9 }
  .primary:disabled { cursor: default; background: #64748b }
  .secondary, .choose { border-color: #cbd8ec; color: #164592; background: white }
  .secondary:hover, .choose:hover { background: #edf4ff }
  .choose { position: relative; flex: none }
  .choose:focus-within { outline: 3px solid #1554c9; outline-offset: 4px }
  .choose input { opacity: 0; position: absolute; cursor: pointer; inset: 0; width: 100%; height: 100% }
  .download { background: #eaf3ff; color: #1346a5; border-color: #c3d9fa; width: 100%; margin-top: 9px }
  .download:hover { background: #d9eaff }
  .field { display: grid; gap: .35rem; margin-bottom: .76rem; min-width: 0; color: #263750; font-size: .83rem; font-weight: 660 }
  .field input:not([type=range]), .field select { width: 100%; border-radius: 9px; border: 1px solid #cbd8e8;
    min-height: 42px; background: var(--paper); color: var(--ink); padding: .45rem .55rem }
  .field input[type=range] { width: 100%; accent-color: var(--blue); margin: 0; height: 27px }
  .field output { float: right; color: #1853bb }
  .field.color input { width: 64px; cursor: pointer }
  .fields { display: grid; grid-template-columns: repeat(2,minmax(0, 1fr)); gap: .68rem }
  .check { display: flex; gap: .5rem; align-items: center; margin-bottom: .74rem; font-size: .85rem; font-weight: 620; color: #263750 }
  .check input { width: 17px; height: 17px; accent-color: var(--blue); margin: 0 }
  .check:has(input:focus-visible) { outline: 3px solid #1554c9; outline-offset: 3px; border-radius: 5px }
}
@layer layout {
  .header { background: #ffffffee; border-bottom: 1px solid var(--edge) }
  .header-inner { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 1rem }
  .brand { display: inline-flex; align-items: center; gap: .57rem; font-size: 1.22rem; letter-spacing: -.04em; font-weight: 820 }
  .header nav { display: flex; gap: 1.7rem; color: var(--muted); font-size: .91rem; font-weight: 640 }
  .header nav a:hover, .footer a:hover, .back:hover { color: #124ba9; text-decoration: underline }
  .language { border: 1px solid var(--edge); padding: .33rem .67rem; border-radius: .52rem; font-size: .85rem; color: #344863; font-weight: 650 }
  .hero { padding: clamp(36px, 6vw, 68px) 0 clamp(24px, 4vw, 40px) }
  .hero h1 { font-size: clamp(2.1rem, 5.35vw, 4.2rem); letter-spacing: -.066em; font-weight: 810; max-width: 22ch }
  .hero p { color: var(--muted); font-size: clamp(.96rem, 1.75vw, 1.15rem); margin-top: .77rem; max-width: 52ch }
  .back { display: inline-flex; color: #1b4f9e; font-weight: 650; font-size: .87rem; margin-bottom: .8rem }
  .workspace { overflow: hidden; border-radius: var(--radius); background: var(--paper); border: 1px solid #d5dfed;
    box-shadow: 0 16px 38px -26px #17336259 }
  .workspace-head { background: var(--navy); color: white; display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; padding: .88rem 1.16rem }
  .workspace-name { display: inline-flex; gap: .55rem; align-items: center; font-weight: 730; line-height: 1.22 }
  .work-icon { display: inline-grid; place-items: center; border-radius: .45rem; width: 1.7rem; height: 1.7rem; flex: none; background: #f8fafc21; color: #e3edff }
  .local { display: inline-flex; flex: none; align-items: center; gap: .44rem; color: #d2e1f8; font-size: .82rem; font-weight: 630 }
  .local i { border: 1px solid currentColor; width: .63rem; height: .63rem; border-radius: .2rem; rotate: 45deg }
  .workspace-body { display: grid; grid-template-columns: minmax(0,2.12fr) minmax(232px, 1fr); }
  .media-column { padding: 1.18rem; min-width: 0 }
  .dropzone { display: flex; align-items: center; gap: .8rem; border: 1px dashed #a9bfe3; background: var(--soft-blue); padding: .95rem;
    border-radius: 13px; color: #17365f; }
  .dropzone.dragging { background: #d5e6ff; border-color: #1649a2; outline: 2px solid #2563eb }
  .choose-mark { flex: none; width: 40px; height: 40px; border-radius: 11px; background: #dceaff; color: #194fac; display: grid; place-items: center; font-size: 1.45rem }
  .dropzone strong { display: block; font-size: .93rem; line-height: 1.28 }
  .dropzone p { color: #425572; font-size: .76rem; margin-top: .22rem }
  .dropzone .choose { margin-left: auto }
  .preview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .88rem; margin-top: 1.15rem }
  .preview-slot { min-width: 0 }
  .preview-slot h2 { font-size: .82rem; color: #334966; margin-bottom: .45rem; letter-spacing: .005em }
  .preview { display: grid; place-items: center; aspect-ratio: 16 / 9; width: 100%; min-width: 0; min-height: 98px; overflow: hidden; border: 1px solid #e2e8f2; border-radius: 10px;
    background-color: #f9fbff; background-image: conic-gradient(#ecf1fa 25%, #f9fbff 0 50%, #ecf1fa 0 75%, #f9fbff 0); background-size: 18px 18px; }
  .preview span { color: #3d536f; text-align: center; padding: .5rem; font-size: .78rem; background: #f9fbffe8; border-radius: .35rem }
  .preview img { width: 100%; height: 100%; min-height: 0; object-fit: contain }
  .file-meta { min-height: 1.35em; font-size: .76rem; color: #425572; margin-top: .45rem }
  .settings { border-left: 1px solid var(--edge); background: #fdfefe; padding: 1.1rem 1.16rem; min-width: 0 }
  .settings h2 { font-size: 1.03rem; margin-bottom: .9rem; letter-spacing: -.012em }
  .actions { display: flex; gap: .48rem; flex-wrap: wrap }
  .actions .primary { flex: 1 1 118px }
  .status:empty { display: none }
  .status { margin-top: .68rem; color: #263c5c; font-size: .81rem; overflow-wrap: anywhere }
  .status[data-kind=error], .status[data-kind=warning] { color: #9e2721 }
  .status[data-kind=success] { color: #116148 }
  .file-list { display: grid; gap: .2rem; margin-top: .8rem; padding: 0; list-style: none }
  .file-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .55rem; font-size: .83rem; padding: .5rem .55rem; border-bottom: 1px solid #e6edf7 }
  .file-list span { flex: 1 1 90px; overflow-wrap: anywhere; font-weight: 630 }
  .file-list small { color: var(--muted) }
  .batch-link { color: #154dab; font-weight: 680; text-decoration: underline }
  .no-js { padding: .7rem; color: #7b281a }
  .directory, .guide, .faq { margin-top: clamp(36px, 6vw, 67px) }
  .directory h3 { color: #334861; font-size: .94rem; margin-top: 1.45rem; margin-bottom: .55rem }
  .directory h2 + .tool-grid { margin-top: .96rem }
  .tool-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .66rem }
  .tool-card { background: white; min-height: 86px; border: 1px solid var(--edge); border-radius: 12px; padding: .69rem;
    display: grid; grid-template-columns: 34px 1fr auto; align-items: start; align-content: center; gap: .63rem }
  .tool-card:hover { border-color: #93b4e8; background: #f3f8ff }
  .tool-card strong { display: block; font-size: .91rem; margin: .06rem 0 .15rem; line-height: 1.22 }
  .tool-card strong + span { display: block; color: var(--muted); font-size: .75rem; line-height: 1.36 }
  .tool-icon { display: grid; place-items: center; background: #eaf2ff; border-radius: 8px; color: #164b9d; width: 34px; height: 34px; font-weight: 700 }
  .tool-arrow { color: #3467ae; font-size: .85rem }
  .steps { list-style: none; padding: 0; margin-top: .8rem; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .7rem 1rem }
  .steps li { display: flex; align-items: center; gap: .68rem; padding: .57rem 0; font-size: .91rem }
  .steps span { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: #e2edff; color: #1a4f9c; font-weight: 780 }
  .example { margin-top: .86rem; border-left: 3px solid #3674e6; padding: .46rem .8rem; color: #344c6c; }
  .example strong { color: #142d55; font-size: .87rem }
  .faq details { border-bottom: 1px solid var(--edge); padding: .76rem .12rem; color: #273a56 }
  .faq h2 { margin-bottom: .63rem }
  .faq summary { cursor: pointer; font-weight: 680 }
  .faq p { font-size: .9rem; margin-top: .38rem }
  .footer { margin-top: 4rem; border-top: 1px solid var(--edge); padding: 1.4rem 0; color: #405371; font-size: .82rem }
  .footer-inner, .footer nav { display: flex; flex-wrap: wrap; gap: .76rem 1.1rem }
  .footer-inner > span { color: #1b314f; font-weight: 800; margin-right: auto }
  .policy { padding-top: clamp(36px, 6vw, 68px); max-width: 760px }
  .policy h1 { font-size: clamp(1.85rem, 5vw, 3.1rem); margin-bottom: .75rem }
  .policy p + p { margin-top: .55rem }
  .policy a:not(.button) { color: #184eae; text-decoration: underline }
  @media (max-width: 880px) {
    .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)) }
    .wrap { width: calc(100% - 40px) }
  }
  @media (max-width: 660px) {
    .wrap { width: calc(100% - 28px) }
    .header-inner { min-height: 57px; gap: .52rem }
    .header nav { gap: .62rem; font-size: .77rem }
    .brand { font-size: 1rem; gap: .32rem }
    .brand img { width: 26px; height: 26px }
    .language { font-size: .73rem; padding: .3rem .5rem }
    .workspace-head { padding: .7rem .78rem }
    .workspace-name { font-size: .87rem }
    .local { font-size: .67rem }
    .workspace-body { grid-template-columns: 1fr }
    .settings { border-left: 0; border-top: 1px solid var(--edge); padding: .9rem }
    .media-column { padding: .8rem }
    .dropzone { gap: .5rem; padding: .66rem; flex-wrap: wrap }
    .dropzone strong { font-size: .81rem }
    .dropzone p { font-size: .71rem }
    .choose-mark { width: 34px; height: 34px }
    .dropzone .choose { padding-inline: .57rem }
    .preview-grid { gap: .45rem; margin-top: .75rem }
    .preview span { font-size: .69rem }
    .steps { grid-template-columns: 1fr; gap: .16rem }
    .tool-card { grid-template-columns: 28px minmax(0,1fr); gap: .37rem; padding: .49rem; min-height: 81px }
    .tool-icon { width: 28px; height: 28px }
    .tool-arrow { display: none }
    .tool-card strong { font-size: .8175rem }
  }
  @media (max-width: 400px) {
    .dropzone > div { flex: 1 1 155px }
    .dropzone .choose { width: 100% }
  }
}
