.tool-actions--result {
  margin-top: 0;
}

.btn {
  transition: transform 0.04s ease, opacity 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tool-error {
  line-height: 1.5;
}

.tool-warning {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: 0.875rem;
  line-height: 1.5;
  background: color-mix(in srgb, #f59e0b 12%, var(--md-sys-color-surface));
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--md-sys-color-outline-variant));
  color: #7a4a00;
}

.auto-preview-status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.result-header h2 {
  margin-bottom: 0;
}

.text-input,
.select-input {
  width: 100%;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 0.9375rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input--compact {
  max-width: 96px;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

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

.drop-zone {
  margin-top: 8px;
  padding: 28px 20px;
  border: 2px dashed var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-large);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 35%, white);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.04s ease, box-shadow 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 65%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 16%, transparent);
  outline: none;
}

.drop-zone.is-dragover {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 80%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
}

.drop-zone__icon {
  display: inline-block;
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--md-sys-color-primary);
}

.drop-zone__title {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.drop-zone__desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
}

.input-help {
  margin-top: 14px;
  margin-bottom: 22px;
}

.selected-files {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.selected-files__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.selected-files__label {
  margin: 0;
}

.selected-files__summary {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}

.selected-files__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.selected-file-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.selected-file-item + .selected-file-item {
  margin-top: 10px;
}

.selected-file-item:hover {
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 28%, transparent);
  box-shadow: var(--md-sys-elevation-1);
}

.selected-file-item.is-dragging {
  opacity: 0.62;
  box-shadow: var(--md-sys-elevation-2);
  transform: scale(0.985);
}

.selected-file-item.is-drop-target {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 60%, white);
  box-shadow: var(--md-sys-elevation-1);
}

.selected-file-item__thumb {
  width: 108px;
  height: 108px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--md-sys-color-outline-variant);
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selected-file-item__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.selected-file-item__meta {
  min-width: 0;
}

.selected-file-item__name {
  display: block;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  word-break: break-all;
}

.selected-file-item__sub {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}

.selected-file-item__drag-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 70%, white);
  color: var(--md-sys-color-on-primary-container);
  font-size: 0.75rem;
  font-weight: 600;
  width: fit-content;
  cursor: grab;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.selected-file-item__drag-handle:active {
  cursor: grabbing;
}

.selected-file-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  appearance: none;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.04s ease;
}

.icon-button:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 28%, transparent);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button--danger {
  background: var(--danger-container);
  color: var(--danger);
  border-color: var(--danger-outline);
}

.icon-button--danger:hover {
  background: color-mix(in srgb, var(--danger-container) 85%, white);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 24%, var(--danger-outline));
}

.icon-button .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.preset-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 42%, var(--md-sys-color-surface));
  border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 16%, var(--md-sys-color-outline-variant));
}

.preset-box__label {
  margin-bottom: 10px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.preset-chip {
  appearance: none;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.04s ease, box-shadow 0.15s ease;
}

.preset-chip:hover,
.preset-chip:focus {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent);
  outline: none;
}

.preset-chip:active {
  transform: translateY(1px);
}

.preset-chip .material-symbols-outlined {
  font-size: 18px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.option-group {
  min-width: 0;
}

.option-group--full {
  grid-column: 1 / -1;
}

.option-help {
  margin: 8px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  cursor: pointer;
  font-size: 0.9375rem;
}

.radio-chip input {
  margin: 0;
}

.range-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-input {
  width: 100%;
  accent-color: var(--md-sys-color-primary);
}

.result-meta {
  margin-bottom: 14px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.55;
}

.image-result {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f8 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  padding: 16px;
}

.image-result img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: var(--md-sys-elevation-1);
  background: transparent;
}

.how-to-list {
  margin: 0;
  padding-left: 1.25em;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.8;
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  padding-top: 14px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.faq-item:first-child {
  padding-top: 0;
  border-top: none;
}

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.faq-item p {
  margin: 0;
}

@media (max-width: 600px) {
  .tool-actions--result {
    width: 100%;
  }

  .tool-actions--result .btn {
    flex: 1;
  }

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

  .radio-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .radio-chip {
    width: 100%;
  }

  .selected-files__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .selected-file-item {
    grid-template-columns: 1fr;
  }

  .selected-file-item__thumb {
    width: 100%;
    height: 180px;
  }

  .selected-file-item__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .selected-file-item__drag-handle {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

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

  .range-field {
    align-items: stretch;
  }}
