:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #f0f3f5;
  --surface-active: #e8f3ef;
  --text: #151a21;
  --muted: #5c6672;
  --line: #d8dde3;
  --line-strong: #aeb7c2;
  --accent: #176d54;
  --accent-hover: #105841;
  --danger: #b42318;
  --focus: #2563eb;
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

code {
  font-family: "JetBrains Mono", "Menlo", "Consolas", monospace;
  font-size: 0.92em;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08rem 0.28rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.logo {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0.35rem;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand-mark img {
  width: 100%;
  height: auto;
  display: block;
}

.brand-text {
  min-width: 0;
  display: grid;
  gap: 0.05rem;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 0.98rem;
}

.brand-text span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.nav-links,
.footer-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-links a,
.footer-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active,
.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--text);
  background: var(--surface-subtle);
  outline: none;
}

.app-main {
  flex: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  gap: 1rem;
  padding: 1rem 0 2rem;
}

.legal-main {
  width: min(900px, calc(100% - 32px));
}

.tool-summary,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tool-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-summary h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lead {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.summary-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 0.5rem;
}

.summary-facts div {
  min-width: 0;
  padding: 0.6rem 0.7rem;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.summary-facts dt {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.summary-facts dd {
  margin: 0;
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
}

.workflow-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  position: sticky;
  top: 64px;
  z-index: 5;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.workflow-pill:hover,
.workflow-pill:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.workflow-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.workflow-pill.completed {
  background: var(--surface-active);
  color: var(--accent);
  border-color: #b9d8cb;
}

.card {
  padding: 1.15rem;
}

.step-card {
  display: grid;
  gap: 1rem;
}

.step-heading {
  display: grid;
  gap: 0.25rem;
}

.step-label {
  width: fit-content;
  margin: 0;
  padding: 0.2rem 0.45rem;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 800;
}

.card h2 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
}

.card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.98rem;
}

.hint,
.muted {
  color: var(--muted);
  margin: 0;
}

.hint {
  line-height: 1.65;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  background: var(--surface-subtle);
  cursor: pointer;
}

.dropzone:focus-visible,
.button:focus-visible,
.frame-rate-chip:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dropzone.active {
  border-color: var(--accent);
  background: var(--surface-active);
}

.drop-inner {
  display: grid;
  gap: 0.8rem;
  align-items: center;
  justify-items: center;
}

.drop-title {
  margin: 0;
  font-weight: 800;
  max-width: 100%;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.drop-actions,
.action-row,
.result-actions,
.result-secondary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.action-row {
  justify-content: flex-end;
}

.result-actions {
  justify-content: space-between;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  gap: 0.45rem;
  padding: 0.62rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--surface-subtle);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface-subtle);
}

.button-ghost {
  background: transparent;
  color: var(--muted);
}

.button.button-small {
  min-height: 2rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.84rem;
}

.selection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.selection-header p {
  font-weight: 800;
}

.selected-files {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: var(--surface-subtle);
  max-height: 12rem;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Menlo", "Consolas", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

.selected-files.empty {
  color: var(--muted);
  font-family: inherit;
}

.settings-form {
  display: grid;
  gap: 1rem;
}

fieldset {
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

fieldset.highlight {
  background: var(--surface-subtle);
}

legend {
  padding: 0 0.35rem;
  font-weight: 800;
}

.checkbox,
.toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.45rem 0;
  font-weight: 700;
}

.checkbox input,
.toggle input {
  flex: 0 0 auto;
}

.checkbox.nested {
  margin-left: 1.25rem;
  color: var(--muted);
}

.toggle input[type="checkbox"] {
  width: 2.4rem;
  height: 1.25rem;
  appearance: none;
  background: #c9d1d9;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
}

.toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 0.93rem;
  height: 0.93rem;
  border-radius: 4px;
  background: #ffffff;
  transition: transform 0.16s ease;
}

.toggle input[type="checkbox"]:checked {
  background: var(--accent);
}

.toggle input[type="checkbox"]:checked::after {
  transform: translateX(1.15rem);
}

.mode-settings,
.frame-rate-options,
.advanced-body {
  display: grid;
  gap: 0.55rem;
}

.mode-settings.hidden {
  display: none;
}

.mode-settings input[type="number"],
input[type="number"]#frameRate {
  width: min(18rem, 100%);
  padding: 0.65rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.frame-rate-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.frame-rate-chip {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.42rem 0.7rem;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.frame-rate-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.frame-rate-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.advanced {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0.7rem 0.85rem;
}

.advanced summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "+";
  margin-left: 0.35rem;
  color: var(--muted);
}

.advanced[open] summary::after {
  content: "-";
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 1rem;
}

.stats {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.stats div:last-child {
  border-bottom: 0;
}

.stats dt {
  color: var(--muted);
  font-weight: 700;
}

.stats dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.auto-only,
.frame-only {
  display: none;
}

.log {
  margin: 0;
  min-height: 210px;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.8rem;
  border-radius: 8px;
  background: #10151c;
  border: 1px solid #10151c;
  color: #e6edf3;
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.info-card {
  display: grid;
  gap: 0.75rem;
}

.info-card ul,
.howto-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}

.howto-list {
  display: grid;
  gap: 0.55rem;
}

.howto-list strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.howto-list p,
.info-card p {
  margin: 0;
  line-height: 1.75;
}

.info-card a {
  color: var(--accent);
}

.workflow-mode .tool-summary,
.workflow-mode .info-card {
  display: none;
}

.workflow-mode .app-main {
  width: min(880px, calc(100% - 32px));
}

.app-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 1rem 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.app-footer strong {
  color: var(--text);
}

@media (max-width: 880px) {
  html {
    scroll-padding-top: 118px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.15rem;
  }

  .nav-links a {
    flex: 0 0 auto;
  }

  .tool-summary {
    grid-template-columns: 1fr;
  }

  .summary-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workflow-nav {
    top: 104px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 128px;
  }

  .app-main,
  .legal-main,
  .workflow-mode .app-main,
  .app-footer {
    width: min(100% - 20px, 1120px);
  }

  .tool-summary h1 {
    font-size: 1.32rem;
  }

  .summary-facts,
  .workflow-nav {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1rem;
  }

  .drop-actions,
  .action-row,
  .result-actions,
  .result-secondary,
  .selection-header {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .selected-files {
    max-height: 16rem;
  }
}
