.ed-tool {
  --ed-ink: #122033;
  --ed-muted: #5b6b7c;
  --ed-line: #d7e0ea;
  --ed-soft: #eef5f8;
  --ed-panel: #ffffff;
  --ed-accent: #0e8f86;
  --ed-accent-dark: #0b6f68;
  --ed-accent-soft: rgba(14, 143, 134, 0.12);
  --ed-warn: #9a3412;
  --ed-warn-bg: #fff7ed;
  --ed-radius: 22px;
  --ed-shadow: 0 18px 50px rgba(18, 32, 51, 0.08);
  --ed-font: "Manrope", "Segoe UI", sans-serif;
  --ed-display: "Fraunces", Georgia, serif;

  box-sizing: border-box;
  font-family: var(--ed-font);
  color: var(--ed-ink);
  background:
    radial-gradient(900px 320px at 0% 0%, rgba(14, 143, 134, 0.16), transparent 55%),
    radial-gradient(700px 280px at 100% 10%, rgba(34, 84, 120, 0.12), transparent 50%),
    linear-gradient(165deg, #f3f8fb 0%, #ffffff 45%, #f7fafc 100%);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: 28px;
  box-shadow: var(--ed-shadow);
  padding: clamp(1.35rem, 3.5vw, 2.15rem);
  max-width: 720px;
  margin: 0 auto;
}

.ed-tool *,
.ed-tool *::before,
.ed-tool *::after {
  box-sizing: border-box;
}

.ed-tool [hidden] {
  display: none !important;
}

.ed-tool__header {
  margin-bottom: 1.25rem;
}

.ed-tool__brand {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ed-accent);
}

.ed-tool__title {
  margin: 0;
  font-family: var(--ed-display);
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.ed-tool__subtitle {
  margin: 0.7rem 0 0;
  color: var(--ed-muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 36rem;
}

.ed-tool__notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--ed-warn-bg);
  color: var(--ed-warn);
  border-radius: 14px;
  font-size: 0.95rem;
}

.ed-tool__modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--ed-line);
  border-radius: 999px;
  margin-bottom: 1rem;
}

.ed-tool__mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ed-muted);
  border-radius: 999px;
  padding: 0.78rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ed-tool__mode.is-active {
  background: var(--ed-ink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(18, 32, 51, 0.18);
}

.ed-drop {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: 210px;
  padding: 1.6rem 1.2rem;
  border: 1.5px dashed #9eb0c0;
  border-radius: var(--ed-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(238, 245, 248, 0.9));
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.ed-drop:hover,
.ed-drop.is-dragover {
  border-color: var(--ed-accent);
  background: var(--ed-accent-soft);
  transform: translateY(-1px);
}

.ed-drop__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #fff;
  color: var(--ed-accent);
  border: 1px solid var(--ed-line);
  margin-bottom: 0.35rem;
}

.ed-drop__title {
  font-weight: 800;
  font-size: 1.08rem;
}

.ed-drop__hint {
  color: var(--ed-muted);
  font-size: 0.92rem;
}

.ed-preview {
  display: grid;
  gap: 0.85rem;
  animation: ed-fade-in 0.3s ease;
}

.ed-preview img {
  width: 100%;
  display: block;
  border-radius: var(--ed-radius);
  border: 1px solid var(--ed-line);
  background: #fff;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  box-shadow: 0 14px 34px rgba(18, 32, 51, 0.1);
}

.ed-webcam video {
  width: 100%;
  border-radius: var(--ed-radius);
  background: #0f1720;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.ed-webcam__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.ed-btn {
  appearance: none;
  border: 1px solid var(--ed-line);
  background: var(--ed-panel);
  color: var(--ed-ink);
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ed-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ed-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ed-btn--primary {
  background: linear-gradient(135deg, var(--ed-accent) 0%, #127a9c 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 28px rgba(14, 143, 134, 0.28);
}

.ed-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--ed-accent-dark) 0%, #0f6480 100%);
}

.ed-btn--ghost {
  background: rgba(255, 255, 255, 0.85);
}

.ed-btn--xl {
  width: 100%;
  padding: 0.95rem 1.25rem;
  font-size: 1.02rem;
}

.ed-btn.is-loading [data-ed-analyze-label]::after,
.ed-btn.is-loading [data-ed-webcam-analyze-label]::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.55rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: ed-spin 0.7s linear infinite;
}

.ed-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ed-accent-dark);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  justify-self: center;
}

.ed-status {
  margin-top: 0.95rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: #e8f8f4;
  color: #0b5c4d;
  font-weight: 700;
}

.ed-status.is-error {
  background: #fef2f2;
  color: #991b1b;
}

.ed-results {
  margin-top: 1.15rem;
  display: grid;
  gap: 0.9rem;
  animation: ed-rise 0.45s ease;
}

.ed-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--ed-line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
}

.ed-card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
}

.ed-dominant {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.ed-dominant__item {
  background: linear-gradient(180deg, #ffffff, var(--ed-soft));
  border: 1px solid var(--ed-line);
  border-radius: 18px;
  padding: 1rem 1.05rem;
}

.ed-dominant__label {
  display: block;
  color: var(--ed-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.ed-dominant__value {
  font-family: var(--ed-display);
  font-size: 1.45rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: -0.02em;
}

.ed-score {
  display: grid;
  grid-template-columns: 118px 1fr 52px;
  gap: 0.6rem;
  align-items: center;
  margin: 0.55rem 0;
  font-size: 0.92rem;
}

.ed-score__name {
  text-transform: capitalize;
  color: var(--ed-muted);
  font-weight: 600;
}

.ed-score__bar {
  height: 10px;
  background: #e5edf3;
  border-radius: 999px;
  overflow: hidden;
}

.ed-score__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #12a397, #0e8f86 55%, #127a9c);
  border-radius: inherit;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ed-score__pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

@keyframes ed-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ed-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ed-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .ed-tool {
    border-radius: 20px;
    padding: 1.15rem;
  }

  .ed-dominant {
    grid-template-columns: 1fr;
  }

  .ed-score {
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.75rem;
  }

  .ed-score__bar {
    grid-column: 1 / -1;
  }

  .ed-score__pct {
    text-align: left;
  }
}
