textarea {
  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: 14px 16px;
  resize: vertical;
  min-height: 220px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea: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);
}

.tool-help h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-area {
  position: relative;
  width: 100%;
}

.upload-label {
  width: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
  border: 1.5px dashed var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  padding: 24px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.upload-label:hover,
.upload-area.is-dragover .upload-label {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 40%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 15%, transparent);
}

.upload-label__icon {
  font-size: 40px;
  color: var(--md-sys-color-primary);
}

.upload-label__title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.upload-label__text {
  display: block;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
}

.selected-file-name {
  margin: 12px 0 18px;
  padding: 10px 12px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface);
  word-break: break-all;
}

.text-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: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-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);
}

.result-summary {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: start;
}

.preview-block__label {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.favicon-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #eef3f8 75%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%) -8px 0 / 16px 16px,
    #fff;
}

.favicon-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: var(--md-sys-elevation-1);
  background: #fff;
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow: hidden;
}

.favicon-preview--16 {
  width: 96px;
  height: 96px;
}

.favicon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#html-output {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
}

.generated-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.generated-item {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 14px;
}

.generated-item--ico {
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 42%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 55%, var(--md-sys-color-surface));
}

.generated-item__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.generated-item__preview {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background:
    linear-gradient(45deg, #eef3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, #eef3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #eef3f8 75%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #eef3f8 75%) -8px 0 / 16px 16px,
    #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generated-item__preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.generated-item__meta {
  min-width: 0;
}

.generated-item__name {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  word-break: break-all;
}

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

.generated-item__badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
}

.generated-item__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.generated-item__actions .btn {
  padding: 8px 12px;
  font-size: 0.8125rem;
}

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

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

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

  .upload-label {
    min-height: 160px;
  }

  .tool-actions .btn,
  .generated-item__actions .btn {
    flex: 1 1 auto;
  }}
