:root {
  --bg: #F9FAFB;
  --fg: #111827;
  --muted: #6B7280;
  --primary: #5B5BF0;
  --primary-hover: #4a4ae6;
  --primary-soft: #EDE9FE;
  --primary-tint: #F5F3FF;
  --success: #10B981;
  --success-hover: #0e9f6e;
  --danger: #EF4444;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --input: #D1D5DB;
  --row: #F9FAFB;
  --radius: 0.75rem;
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Hiragino Sans", "Yu Gothic UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 1rem; }
.wrap { max-width: 80rem; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:focus-visible, .lang-menu summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }
.btn-success:disabled { opacity: .6; cursor: progress; }
.btn-outline { background: #fff; border-color: var(--input); color: var(--fg); }
.btn-outline:hover { background: var(--row); }
.btn-lg { height: 2.75rem; padding: 0 2rem; font-size: 1rem; }
.icon { width: 1rem; height: 1rem; flex: none; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(249 250 251 / 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); text-decoration: none; }

.lang-menu { position: relative; }
.lang-menu summary { list-style: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu[open] summary .icon { transform: rotate(180deg); }
.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 0.375rem);
  min-width: 10rem;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow-lg);
}
.lang-menu li a {
  display: block;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  text-decoration: none;
}
.lang-menu li a:hover, .lang-menu li a:focus-visible { background: #F3F4F6; outline: none; }
.lang-menu li a[aria-current="page"] { font-weight: 600; color: var(--primary); }

/* Hero */
main { padding: 0 1rem; }
.hero { text-align: center; padding: 4rem 0 1.5rem; }
.hero h1 {
  max-width: 64rem;
  margin: 0 auto;
  font-size: 2.25rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.hero p { max-width: 42rem; margin: 1rem auto 0; font-size: 1.125rem; color: var(--muted); }
.hero .btn { margin-top: 2rem; }
.divider { max-width: 80rem; margin: 0 auto; border: 0; border-top: 1px solid var(--border); }

/* Tool */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem 0 4rem;
  scroll-margin-top: 5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}
.card-title { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-size: 1.25rem; font-weight: 700; }
.card-title .icon { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.options { display: flex; flex-direction: column; gap: 1.5rem; align-self: start; }
.options .card-title { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field-group { display: flex; flex-direction: column; gap: 1rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
[hidden] { display: none !important; }
label { font-size: 0.875rem; font-weight: 500; }
input[type="text"], input[type="number"], select {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input::placeholder { color: #9CA3AF; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 250px;
  padding: 2rem;
  text-align: center;
  background: #fff;
  border: 2px dashed var(--input);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .3s, background-color .3s, transform .3s;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); }
.dropzone.is-dragging { border-color: var(--primary); background: var(--primary-tint); transform: scale(1.02); }
.dropzone .dz-icon { width: 3rem; height: 3rem; margin-bottom: 0.5rem; color: #9CA3AF; transition: color .3s, transform .3s; }
.dropzone.is-dragging .dz-icon { color: var(--primary); transform: translateY(-8px); }
.dz-title { font-size: 1.25rem; font-weight: 600; }
.dz-prompt { color: var(--muted); margin-bottom: 0.5rem; }
.dropzone .btn { pointer-events: none; }

.preview { margin-top: 2rem; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.preview-head h3 { font-size: 1.125rem; font-weight: 700; }
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  margin: 0;
  padding: 0 0.5rem 0 0;
  overflow-y: auto;
  list-style: none;
}
.file-list::-webkit-scrollbar { width: 8px; }
.file-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.file-list::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 4px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--row);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
}
.names { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; font-size: 0.875rem; }
.names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.names .old { color: var(--muted); }
.names .new { font-weight: 500; color: #047857; }
.names .icon { color: var(--primary); }
.remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--fg);
  opacity: .5;
  cursor: pointer;
}
.file-row:hover .remove, .remove:focus-visible { opacity: 1; }
.remove:hover { background: #F3F4F6; }

/* Tool options added in v2 */
textarea {
  width: 100%;
  min-height: 7rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
  resize: vertical;
}
textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.hint { font-size: 0.8125rem; color: var(--muted); }
.hint.strong { color: var(--fg); font-weight: 500; }
.hint.error { color: #B91C1C; font-weight: 500; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
select { min-width: 0; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .field-row.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.field-row .field { min-width: 0; }

.opt-group { border-top: 1px solid var(--border); padding-top: 0.25rem; }
.opt-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.opt-group summary::-webkit-details-marker { display: none; }
.opt-group summary .icon { transition: transform .2s; }
.opt-group[open] summary .icon { transform: rotate(180deg); }
.opt-group summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.opt-body { display: flex; flex-direction: column; gap: 0.875rem; padding: 0.25rem 0 0.5rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; cursor: pointer; }
.check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--primary); }
.link-button {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover { color: var(--fg); }

.folder-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #F3F4F6; color: var(--fg); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.preview-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; }
select.compact { flex: 0 1 auto; width: auto; max-width: min(14rem, 100%); height: 2.25rem; }
.folder-note { margin: -0.5rem 0 0.75rem; }
.folder-name { margin: -0.25rem 0 0.75rem; font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.warnings {
  margin: 0 0 0.75rem;
  padding: 0.625rem 0.875rem 0.625rem 1.75rem;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: calc(var(--radius) - 4px);
  color: #92400E;
  font-size: 0.8125rem;
}
.warnings li + li { margin-top: 0.25rem; }
#drag-hint { margin-bottom: 0.5rem; }
.file-list { max-height: 360px; }
.file-row { gap: 0.5rem; cursor: grab; }
.file-row.dragging { opacity: .4; }
.file-row.drop-before { box-shadow: 0 -2px 0 var(--primary); }
.file-row.drop-after { box-shadow: 0 2px 0 var(--primary); }
.file-row.same .new { color: var(--muted); font-weight: 400; }
.file-row.warn .new { color: #B45309; }
.grip { display: inline-flex; color: #9CA3AF; flex: none; }
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.status { margin-right: auto; font-size: 0.8125rem; color: var(--muted); }
.preview.is-busy .file-list { opacity: .6; pointer-events: none; }

/* Features */
.features, .faq { padding: 5rem 0; }
.section-head { text-align: center; }
.section-head h2 { font-size: 1.875rem; line-height: 1.2; font-weight: 800; }
.section-head p { margin-top: 1rem; font-size: 1.125rem; color: var(--muted); }
.feature-grid { display: grid; gap: 2rem; margin-top: 4rem; }
.feature {
  padding: 2rem;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  display: inline-flex;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
}
.feature-icon .icon { width: 2rem; height: 2rem; }
.feature h3 { margin-bottom: 0.5rem; font-size: 1.25rem; font-weight: 700; }
.feature p { color: var(--muted); }

/* How-to guide (only on pages whose content has one) */
.guide { padding: 5rem 0 0; }
.guide .wrap { max-width: 56rem; }
.steps { display: grid; gap: 1rem; margin: 3rem 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
}
.steps h3, .use h3 { margin-bottom: 0.25rem; font-size: 1.125rem; font-weight: 700; }
.steps p, .use p, .compare dd { color: var(--muted); }
.guide-sub { margin-top: 4rem; font-size: 1.5rem; line-height: 1.3; font-weight: 800; text-align: center; }
.uses { display: grid; gap: 1rem; margin-top: 2rem; }
.use {
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.use .example {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--primary-tint);
  color: var(--fg);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.compare { margin: 2rem 0 0; }
.compare dt { margin-top: 1.25rem; font-weight: 700; }
.compare dd { margin: 0.25rem 0 0; }

/* FAQ */
.faq .wrap { max-width: 48rem; }
.faq .section-head { margin-bottom: 3rem; }
.faq details {
  margin-bottom: 1rem;
  padding: 0 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform .2s; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.faq details p { padding-bottom: 1.5rem; color: var(--muted); }

/* Footer */
.site-footer { background: #fff; border-top: 1px solid var(--border); }
.footer-inner { max-width: 80rem; margin: 0 auto; padding: 2rem 1rem; text-align: center; font-size: 0.875rem; color: var(--muted); }
.footer-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.footer-langs a { text-decoration: none; transition: color .2s; }
.footer-langs a:hover { color: var(--primary); }
.footer-langs a[aria-current="page"] { font-weight: 600; color: var(--primary); }

/* Toasts */
.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  width: 100%;
  max-width: 24rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: toast-in .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast-error { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 0.125rem; font-weight: 600; }
.toast p { color: var(--muted); }
.toast.out { opacity: 0; transform: translateY(0.5rem); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } }

/* 404 */
.notfound { max-width: 40rem; margin: 0 auto; padding: 6rem 0; text-align: center; }
.notfound h1 { font-size: 2.25rem; font-weight: 800; }
.notfound p { margin-top: 1rem; color: var(--muted); }
.notfound .footer-langs { margin-top: 2rem; }

@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
  .hero { padding: 5rem 0 2.5rem; }
  .hero h1 { font-size: 3rem; }
  .tool { padding-bottom: 6rem; }
  .features, .faq { padding: 7rem 0; }
  .section-head h2 { font-size: 2.25rem; }
}
@media (min-width: 768px) {
  main { padding: 0 2rem; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .uses { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .container { padding: 0 2rem; }
  .hero h1 { font-size: 3.75rem; }
  .tool { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .brand { font-size: 1.0625rem; }
  .header-inner { gap: 0.5rem; }
  .lang-menu summary { padding: 0 0.625rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
