:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #1f2a2e;
  --ink-soft: #56676d;
  --accent: #2f7d6b;
  --accent-dark: #245f51;
  --border: #e2e8e6;
  --high-bg: #e3f3ec;
  --high-ink: #1c6b50;
  --low-bg: #eceeef;
  --low-ink: #5c6a6f;
  --error-bg: #fdeceb;
  --error-ink: #9a2c24;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 42, 46, 0.06), 0 6px 18px rgba(31, 42, 46, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* --- Intro ---------------------------------------------------------------- */
.intro {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0 auto;
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* --- Form ----------------------------------------------------------------- */
.analyse-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#link-input {
  flex: 1 1 260px;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#link-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 107, 0.18);
}

button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.4rem;
  color: #fff;
  background: var(--accent);
  transition: background 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: rgba(47, 125, 107, 0.08);
}

.hint {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* --- Status / spinner ----------------------------------------------------- */
.status {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-message {
  margin: 0;
  color: var(--ink-soft);
}

.spinner {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(47, 125, 107, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

/* --- Error ---------------------------------------------------------------- */
.error {
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  background: var(--error-bg);
  color: var(--error-ink);
  border: 1px solid rgba(154, 44, 36, 0.2);
  border-radius: var(--radius);
}

.error p {
  margin: 0 0 0.75rem;
}

/* --- Results -------------------------------------------------------------- */
.results {
  margin-top: 2.5rem;
}

.results-heading {
  font-size: 1.3rem;
  margin: 0 0 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.player-name {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* --- Advice --------------------------------------------------------------- */
.advice {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.advice:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.advice-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.advice-title {
  margin: 0;
  font-size: 1.05rem;
}

.advice-text {
  margin: 0.4rem 0 0.85rem;
  color: var(--ink-soft);
}

.badge {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-high {
  background: var(--high-bg);
  color: var(--high-ink);
}

.badge-low {
  background: var(--low-bg);
  color: var(--low-ink);
}

/* --- Clip ----------------------------------------------------------------- */
.clip {
  display: block;
  width: 100%;
  max-height: 420px;
  margin-top: 0.25rem;
  background: #000;
  border-radius: 10px;
}

.clip-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  background: var(--low-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  .container {
    padding: 1.75rem 1rem 3rem;
  }
  h1 {
    font-size: 1.6rem;
  }
  button {
    flex: 1 1 100%;
  }
}
