:root {
  color-scheme: dark;
  --bg: #171b1f;
  --panel: #1d2227;
  --panel-strong: #111417;
  --line: #394149;
  --line-soft: #2a3036;
  --text: #e7ecef;
  --muted: #8b969f;
  --muted-strong: #aeb7bd;
  --accent: #91dfc2;
  --accent-strong: #b0edd6;
  --danger: #f2a3a3;
  --danger-bg: rgba(185, 70, 70, 0.12);
  --info-bg: rgba(88, 130, 145, 0.11);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  color: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

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

.page-shell {
  width: min(1620px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
}

main {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.resolver {
  padding: clamp(150px, 25vh, 270px) 0 96px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 30px);
  margin-bottom: 32px;
}

.title-row h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(48px, 6.2vw, 84px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.055em;
}

.title-logo {
  display: block;
  flex: 0 0 auto;
  width: clamp(46px, 5.2vw, 66px);
  height: clamp(46px, 5.2vw, 66px);
}

.resolver-form {
  width: 100%;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 14px;
}

.url-field {
  position: relative;
}

.url-field svg {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
  pointer-events: none;
}

.url-field input,
#submit-button,
.source-field select,
.secondary-button {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

.url-field input {
  width: 100%;
  padding: 0 18px 0 50px;
  color: var(--text);
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.url-field input::placeholder {
  color: #667078;
}

.url-field input:hover {
  border-color: #4c565f;
}

.url-field input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.012);
}

#submit-button {
  position: relative;
  padding: 0 18px;
  color: var(--bg);
  background: var(--accent);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

#submit-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

#submit-button:active:not(:disabled) {
  transform: translateY(1px);
}

#submit-button:focus-visible,
.secondary-button:focus-visible,
.source-field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#submit-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  margin: 0 auto;
  border: 2px solid rgba(23, 27, 31, 0.28);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

#submit-button.is-loading .button-label {
  display: none;
}

#submit-button.is-loading .button-spinner {
  display: block;
}

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

.message {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
}

.message.error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(242, 163, 163, 0.28);
}

.message.info {
  color: #b8c7cc;
  background: var(--info-bg);
}

.result {
  margin-bottom: 96px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.result-header {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.result-label,
.source-field label {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
}

.result-title-group h2 {
  max-width: 820px;
  margin-bottom: 0;
  font-family: var(--mono);
  font-size: clamp(21px, 3vw, 32px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.source-host {
  max-width: 340px;
  padding-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 4px;
}

#video-player {
  display: none;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

#video-player.is-ready {
  display: block;
}

.player-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #626d75;
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}

.player-placeholder > span {
  color: var(--accent);
  font-size: 20px;
}

.player-placeholder p {
  margin: 0;
}

.result-toolbar {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.source-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.source-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 13px;
  appearance: none;
  color: var(--text);
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 20px,
    calc(100% - 12px) 20px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  font-family: var(--mono);
  font-size: 11px;
}

.source-field select:hover,
.source-field select:focus {
  border-color: #56616a;
}

.source-field select option {
  color: var(--text);
  background: var(--panel);
}

.result-actions {
  display: flex;
  gap: 10px;
}

.secondary-button {
  min-height: 48px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.secondary-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.018);
  border-color: #56616a;
}

.result-note {
  margin: 13px 0 0;
  color: #68737b;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.6;
}

.about-trigger {
  position: fixed;
  right: clamp(16px, 2vw, 28px);
  bottom: clamp(16px, 2vw, 28px);
  z-index: 5;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(23, 27, 31, 0.82);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.about-trigger svg,
.about-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.about-trigger .about-dot {
  fill: currentColor;
  stroke: none;
}

.about-trigger:hover {
  color: var(--accent);
  background: rgba(29, 34, 39, 0.96);
  border-color: #56616a;
}

.about-trigger:focus-visible,
.about-close:focus-visible,
.about-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.about-dialog {
  width: min(760px, calc(100% - 40px));
  max-height: min(84vh, 780px);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.about-dialog::backdrop {
  background: rgba(6, 8, 10, 0.74);
  backdrop-filter: blur(4px);
}

.about-panel {
  position: relative;
  max-height: min(84vh, 780px);
  padding: 34px 34px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.about-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.about-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  border-color: #56616a;
}

.section-kicker {
  display: block;
  margin-bottom: 13px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.about-dialog .seo-intro {
  max-width: 650px;
  padding-right: 52px;
}

.about-dialog .seo-intro h2 {
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: clamp(25px, 4vw, 38px);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.about-dialog .seo-intro > p {
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.72;
}

.about-dialog .seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 34px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.about-dialog .seo-grid article {
  min-width: 0;
  padding: 23px 22px 23px 0;
}

.about-dialog .seo-grid article + article {
  padding-left: 22px;
  border-left: 1px solid var(--line-soft);
}

.about-dialog .seo-grid h3,
.about-dialog .faq h2 {
  margin-bottom: 11px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.015em;
}

.about-dialog .seo-grid p,
.about-dialog .faq details p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.about-dialog .faq {
  margin-top: 38px;
}

.about-dialog .faq h2 {
  margin-bottom: 18px;
  font-size: 18px;
}

.about-dialog .faq details {
  border-top: 1px solid var(--line-soft);
}

.about-dialog .faq details:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.about-dialog .faq summary {
  position: relative;
  padding: 17px 34px 17px 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.about-dialog .faq summary::-webkit-details-marker {
  display: none;
}

.about-dialog .faq summary::after {
  content: "+";
  position: absolute;
  top: 15px;
  right: 2px;
  color: var(--accent);
  font-size: 17px;
}

.about-dialog .faq details[open] summary::after {
  content: "−";
}

.about-dialog .faq details p {
  max-width: 650px;
  padding: 0 36px 18px 0;
}

.about-links {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #68737b;
  font-family: var(--mono);
  font-size: 9px;
}

.about-links a {
  color: var(--muted-strong);
  transition: color 150ms ease;
}

.about-links a:hover {
  color: var(--accent);
}

.noscript-message {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  margin: 0;
  padding: 12px 14px;
  color: var(--danger);
  background: var(--panel-strong);
  border: 1px solid rgba(242, 163, 163, 0.28);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 28px, 1620px);
  }

  .resolver {
    padding: 100px 0 68px;
  }

  .title-row {
    gap: 16px;
    margin-bottom: 27px;
  }

  .title-row h1 {
    font-size: clamp(39px, 12vw, 58px);
  }

  .title-logo {
    width: 43px;
    height: 43px;
  }

  .input-row,
  .result-toolbar {
    grid-template-columns: 1fr;
  }

  #submit-button {
    width: 100%;
  }

  .result-header {
    display: block;
  }

  .source-host {
    display: block;
    max-width: 100%;
    margin-top: 12px;
    padding-top: 0;
  }

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

  .about-trigger {
    right: 14px;
    bottom: 14px;
    width: 34px;
    height: 34px;
  }

  .about-dialog {
    width: calc(100% - 24px);
    max-height: 88vh;
  }

  .about-panel {
    max-height: 88vh;
    padding: 28px 20px 22px;
  }

  .about-close {
    top: 14px;
    right: 14px;
  }

  .about-dialog .seo-intro {
    padding-right: 38px;
  }

  .about-dialog .seo-intro > p {
    font-size: 14px;
  }

  .about-dialog .seo-grid {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }

  .about-dialog .seo-grid article,
  .about-dialog .seo-grid article + article {
    padding: 18px 0;
    border-left: 0;
  }

  .about-dialog .seo-grid article + article {
    border-top: 1px solid var(--line-soft);
  }

  .about-dialog .faq {
    margin-top: 30px;
  }

  .about-links {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 14px;
  }
}

@media (max-width: 460px) {
  .resolver {
    padding-top: 74px;
  }

  .title-row {
    gap: 13px;
  }

  .title-logo {
    width: 38px;
    height: 38px;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
