/* GuessRank redesign: add clip, contact and stats pages. Builds on v2.css tokens and components. */

/* ---------- Page heads ---------- */
.v2-forms-title { font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; }
.v2-forms-lead { margin: 0; font-size: 18px; line-height: 1.5; color: var(--v2-muted); }

/* ---------- Fields ---------- */
.v2-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.v2-stack > * + * { margin-top: 8px; }
.v2-label { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 500; color: var(--v2-text); }
.v2-label__note { font-size: 12px; font-weight: 400; color: var(--v2-faint); }
.v2-input {
  display: block; width: 100%; min-height: 48px; margin: 0; padding: 0 16px; border: 0; border-radius: 12px;
  background: var(--v2-raised); box-shadow: inset 0 0 0 1px var(--v2-line);
  color: var(--v2-text); font-family: var(--v2-font); font-size: 16px; line-height: 1.5;
  transition: box-shadow 150ms var(--v2-ease);
}
.v2-input::placeholder { color: var(--v2-faint); opacity: 1; }
.v2-input:focus-visible { outline-offset: 2px; }
.v2-input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--v2-red); }
.v2-select { position: relative; }
.v2-select select { height: 48px; padding-right: 44px; -webkit-appearance: none; appearance: none; cursor: pointer; }
.v2-select select option { background: var(--v2-raised); color: var(--v2-text); }
.v2-select select:has(option[value="none"]:checked) { color: var(--v2-faint); }
.v2-select > svg { position: absolute; right: 16px; top: 16px; color: var(--v2-faint); pointer-events: none; }
.v2-hint { font-size: 14px; line-height: 1.4; color: var(--v2-faint); }
.v2-field-error { font-size: 14px; line-height: 1.4; color: var(--v2-red); animation: v2-pop 200ms var(--v2-ease) both; }
.v2-field-error[hidden] { display: none; }
.v2-link--small { font-size: 14px; }

/* ---------- Add clip: layout ---------- */
.v2-addclip { max-width: 1120px; }
.v2-addclip__intro { max-width: 720px; display: flex; flex-direction: column; gap: 16px; padding: 64px 0 40px; }
.v2-addclip__body { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.v2-clip-card { flex: 1 1 560px; min-width: 0; max-width: 680px; padding: 32px; }
.v2-clip-form { display: flex; flex-direction: column; gap: 24px; margin: 0; }
.v2-clip-form[hidden] { display: none; }
.v2-clip-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 24px 16px; align-items: start; }
.v2-clip-stats-link { align-self: flex-start; margin: -8px 0 -12px; }
.v2-clip-aside { flex: 1 1 300px; min-width: 0; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.v2-side-card { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.v2-side-card--review { gap: 12px; }
.v2-side-card h2 { font-size: 18px; }
.v2-side-card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--v2-muted); }
.v2-rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; font-size: 14px; line-height: 1.5; color: var(--v2-muted); }
.v2-rules li { display: flex; gap: 12px; }
.v2-rules svg { flex: 0 0 auto; margin-top: 2px; color: var(--v2-faint); }
.v2-rules b { font-weight: 500; color: var(--v2-text); overflow-wrap: anywhere; }

/* ---------- Add clip: YouTube URL check icon (the page script writes Font Awesome <i> tags; drawn here as masks) ---------- */
.v2-url { position: relative; }
.v2-url .v2-input { padding-right: 48px; }
.url-validation-status { position: absolute; right: 14px; top: 15px; display: flex; line-height: 0; }
.url-validation-status.is-valid { color: var(--v2-green); }
.url-validation-status.is-invalid { color: var(--v2-red); }
.url-validation-status i {
  display: block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--v2-url-icon) center / 18px 18px no-repeat; mask: var(--v2-url-icon) center / 18px 18px no-repeat;
}
.url-validation-status .fa-circle-check { --v2-url-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.url-validation-status .fa-circle-xmark { --v2-url-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6'/%3E%3Cpath d='m9 9 6 6'/%3E%3C/svg%3E"); }
.url-validation-status .fa-circle-exclamation { --v2-url-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E"); }

/* ---------- Add clip: rank select (options are built by the page script) ---------- */
.custom-select-wrapper { position: relative; }
.custom-select-trigger {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 0 16px; border: 0; border-radius: 12px;
  background: var(--v2-raised); box-shadow: inset 0 0 0 1px var(--v2-line);
  color: var(--v2-text); font-family: var(--v2-font); font-size: 16px; text-align: left; cursor: pointer;
  transition: box-shadow 150ms var(--v2-ease);
}
.custom-select-trigger:focus-visible { outline-offset: 2px; }
.custom-select-trigger.is-error { box-shadow: inset 0 0 0 1px var(--v2-red); }
.custom-select-trigger:has(.rank-option-logo) { padding-left: 8px; }
.v2-clip-form:has(#GAME option[value="none"]:checked) .custom-select-trigger { cursor: not-allowed; }
.custom-select-trigger-text { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; overflow: hidden; white-space: nowrap; color: var(--v2-faint); }
.custom-select-trigger-text:has(.rank-option-text) { color: var(--v2-text); }
.custom-select-trigger-text .rank-option-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.custom-select-arrow {
  flex: 0 0 auto; width: 16px; height: 16px; background: var(--v2-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  transition: transform 200ms var(--v2-ease);
}
.custom-select-wrapper.open .custom-select-arrow { transform: rotate(180deg); }
.custom-options {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 8px);
  display: none; flex-direction: column; gap: 4px; max-height: 336px; overflow-y: auto; padding: 8px;
  background: var(--v2-raised); border-radius: 16px; box-shadow: 0 20px 48px rgba(0, 0, 0, .5);
  scrollbar-color: var(--v2-fill) transparent;
}
.custom-select-wrapper.open .custom-options { display: flex; animation: v2-pop 200ms var(--v2-ease) both; }
.custom-option {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 12px 4px 8px; border-radius: 8px;
  color: var(--v2-text); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color 150ms var(--v2-ease);
}
.custom-option:hover, .custom-option.selected { background: var(--v2-fill); }
.custom-option:focus-visible { outline-offset: -2px; background: var(--v2-fill); }
.custom-option .rank-option-text { flex: 1 1 auto; min-width: 0; }
.custom-option.selected::after {
  content: ""; flex: 0 0 auto; width: 16px; height: 16px; background: var(--v2-lavender);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
.rank-option-logo { flex: 0 0 auto; width: 32px; height: 32px; object-fit: contain; }

/* ---------- Add clip: terms, security check, notice, send ---------- */
.v2-field--terms { gap: 4px; }
.v2-terms { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding-top: 2px; font-size: 14px; line-height: 1.5; color: var(--v2-muted); cursor: pointer; }
.v2-terms input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--v2-accent); cursor: pointer; }
.v2-terms input:focus-visible { outline-offset: 2px; }
.v2-terms a { color: var(--v2-lavender); text-decoration: underline; text-underline-offset: 3px; }
.v2-terms a:hover { color: #c4bcf6; }
#clip-terms-error { padding-left: 32px; }
.cf-turnstile { width: 300px; max-width: 100%; min-height: 65px; border-radius: 12px; background: var(--v2-ad); }
.cf-turnstile.is-error { box-shadow: 0 0 0 1px var(--v2-red); }

/* The page script sets is-visible plus is-success/is-error/is-warning and later drops is-visible on a timer.
   Shown inline above the button, the message stays until the next edit (forms.js clears it). */
.add-clip-notice { display: none; }
.add-clip-notice.is-error, .add-clip-notice.is-warning {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px;
  background: var(--v2-raised); color: var(--v2-red); font-size: 14px; line-height: 1.5;
  animation: v2-pop 200ms var(--v2-ease) both;
}
.add-clip-notice.is-warning { color: var(--v2-gold); }
.add-clip-notice.v2-shake { animation: v2-shake 440ms cubic-bezier(.36, .07, .19, .97); }
.add-clip-notice::before {
  content: ""; flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
}
.v2-clip-submit { display: flex; }

/* ---------- Add clip: success (rendered after the redirect to ?status=completed) ---------- */
/* The 48px circle picks up where the send button left off: it turns green and the check draws itself, then the text rises. */
.v2-clip-done { display: flex; flex-direction: column; gap: 24px; }
.v2-clip-done__head { display: flex; flex-direction: column; gap: 12px; }
.v2-clip-done__mark {
  width: 48px; height: 48px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  background: rgba(95, 208, 143, .16); color: var(--v2-green);
  animation: v2-forms-land 300ms var(--v2-ease) both;
}
.v2-clip-done__mark svg { animation: v2-forms-check 460ms var(--v2-spring) both; }
.v2-clip-done__mark path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: v2-forms-draw 380ms 160ms var(--v2-ease) forwards; }
.v2-clip-done h2 { font-size: 24px; }
.v2-clip-done p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--v2-muted); }
.v2-clip-done__text, .v2-clip-done__actions { animation: v2-rise 400ms 420ms var(--v2-ease) both; }
.v2-clip-done__text { display: flex; flex-direction: column; gap: 12px; }
.v2-clip-done__actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .v2-clip-card { flex-basis: 100%; }
  .v2-clip-aside { flex-basis: 100%; max-width: 680px; }
}

/* ---------- Contact ---------- */
.v2-contact { max-width: 1040px; }
.v2-contact__top { display: flex; flex-wrap: wrap; gap: 48px 64px; align-items: flex-start; padding-top: 80px; }
.v2-contact__intro { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.v2-contact__lead { margin: 0; max-width: 440px; font-size: 20px; line-height: 1.5; color: var(--v2-muted); }
.v2-contact__mail { flex: 1 1 420px; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.v2-contact__mail-head { display: flex; flex-direction: column; gap: 8px; }
.v2-contact__mail h2 { font-size: 14px; font-weight: 500; color: var(--v2-faint); }
.v2 .v2-contact__address { align-self: flex-start; font-size: 30px; font-weight: 600; line-height: 1.2; color: var(--v2-text); overflow-wrap: anywhere; transition: color 150ms var(--v2-ease); }
.v2 .v2-contact__address:hover { color: #c4bcf6; }
.v2-contact__partners { padding-top: 80px; }
.v2-contact__partners h2 { margin: 0 0 24px; font-size: 24px; }
.v2-contact__logos { display: flex; align-items: center; justify-content: center; padding: 32px 24px; border-radius: 16px; background: var(--v2-ad); }
.v2-contact__logos img { display: block; max-width: 100%; height: auto; }

/* ---------- Stats ---------- */
.v2-stats { max-width: 1200px; }
.v2-stats__search { padding-top: 64px; }
.v2-stats__intro { max-width: 720px; display: flex; flex-direction: column; gap: 12px; }
.v2-stats__form { margin: 32px 0 0; padding: 24px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.v2-stats__user { flex: 1 1 280px; }
.v2-stats__game { flex: 1 1 240px; }
.v2-stats__go { flex: 0 0 auto; }
.v2-stats__go .v2-label { visibility: hidden; }
.v2-stats__help { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding: 0 8px; font-size: 14px; line-height: 1.5; color: var(--v2-faint); }
.v2-stats__help svg { flex: 0 0 auto; margin-top: 3px; }
.v2-stats__results { padding-top: 64px; }
.v2-stats__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.v2-stats__title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v2-stats__title h2 { font-size: 24px; overflow-wrap: anywhere; }
.v2-stats__meta { font-size: 14px; color: var(--v2-muted); }
.v2-stats__legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.v2-stats__legend span { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--v2-muted); }
.v2-stats__legend i { display: block; width: 12px; height: 8px; border-radius: 999px; background: var(--v2-accent); }
.v2-stats__legend i.is-real { background: var(--v2-green); }
.v2-stats__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr)); gap: 24px; }
.v2-stat-card { display: flex; flex-wrap: wrap; gap: 20px; padding: 16px; border-radius: 24px; background: var(--v2-card); }
.v2-stat-card__media, .v2-stat-card__guesses { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.v2-stat-card__media { gap: 12px; }
.v2-stat-card__guesses { gap: 8px; }
.v2-stat-card__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--v2-ad); }
.v2-stat-card__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.v2-stat-card__real { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.v2-stat-card__real img { flex: 0 0 auto; width: 32px; height: 32px; object-fit: contain; }
.v2-stat-card__real > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v2-stat-card__real small { font-size: 12px; color: var(--v2-faint); }
.v2-stat-card__real b { font-size: 14px; font-weight: 600; color: var(--v2-text); }
.v2-stat-card__label { font-size: 12px; color: var(--v2-faint); }
.v2-bars { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.v2-bar { display: grid; grid-template-columns: 32px 88px minmax(0, 1fr) 36px; align-items: center; gap: 8px; min-height: 24px; }
.v2-bar .rank-image { display: flex; justify-content: center; }
.v2-bar .rank-image img { display: block; width: 24px; height: 24px; object-fit: contain; }
.v2-bar__name { font-size: 12px; color: var(--v2-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-bar__track { display: block; height: 8px; border-radius: 999px; background: var(--v2-fill); overflow: hidden; }
.v2-bar .bar { display: block; height: 100%; max-width: 100%; border-radius: 999px; background: var(--v2-accent); transform-origin: left center; animation: v2-forms-grow 360ms var(--v2-ease) both; }
.v2-bar .percentage { font-size: 12px; text-align: right; color: var(--v2-muted); font-variant-numeric: tabular-nums; }
.v2-bar.is-real .v2-bar__name { font-weight: 600; color: var(--v2-text); }
.v2-bar.is-real .percentage { color: var(--v2-text); }
.v2-bar.is-real .bar { background: var(--v2-green); }
.v2-pages { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.v2 .v2-pages a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 999px;
  color: var(--v2-muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color 150ms var(--v2-ease), color 150ms var(--v2-ease), transform 120ms var(--v2-ease);
}
.v2 .v2-pages a:hover { background: var(--v2-hover); color: var(--v2-text); }
.v2 .v2-pages a:active { transform: scale(.97); }
.v2 .v2-pages a.active { background: var(--v2-fill); color: var(--v2-text); }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 860px) {
  .v2-forms-title { font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; }
  .v2-forms-lead { font-size: 16px; }

  .v2-addclip__intro { gap: 12px; padding: 32px 0 24px; }
  .v2-addclip__body { gap: 24px; }
  .v2-clip-card { max-width: none; padding: 20px; }
  .v2-clip-form { gap: 20px; }
  .v2-clip-aside { max-width: none; gap: 24px; }
  .v2-side-card { padding: 24px; gap: 16px; }
  .v2-side-card--review { gap: 12px; }
  .v2-rules { gap: 12px; }
  .v2-clip-submit { justify-content: center; }
  .v2-clip-send { --v2-send-w: 100%; }
  .v2-clip-done { gap: 20px; }
  .v2-clip-done h2 { font-size: 20px; }
  .v2-clip-done__actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .v2-clip-done__actions .v2-link { align-self: center; }

  .v2-contact__top { gap: 32px; padding-top: 32px; }
  .v2-contact__lead { font-size: 18px; }
  .v2-contact__mail { padding: 24px; }
  .v2 .v2-contact__address { font-size: 24px; }
  .v2-contact__partners { padding-top: 48px; }
  .v2-contact__partners h2 { margin-bottom: 16px; font-size: 20px; }
  .v2-contact__logos { padding: 24px 16px; }

  .v2-stats__search { padding-top: 32px; }
  .v2-stats__form { margin-top: 24px; padding: 20px; }
  .v2-stats__results { padding-top: 48px; }
}
@media (max-width: 640px) {
  .v2-stats__go { flex: 1 1 100%; }
  .v2-stats__go .v2-label { display: none; }
  .v2-stats__go .v2-pill { width: 100%; }
}

/* ---------- Motion ---------- */
@keyframes v2-forms-land { from { background-color: var(--v2-accent); } to { background-color: rgba(95, 208, 143, .16); } }
@keyframes v2-forms-check { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes v2-forms-draw { to { stroke-dashoffset: 0; } }
@keyframes v2-forms-grow { from { transform: scaleX(0); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .v2-clip-done__mark, .v2-clip-done__mark svg, .v2-clip-done__mark path, .v2-clip-done__text, .v2-clip-done__actions, .v2-stat-card { animation-delay: 0ms !important; }
}

/* Phones: the address must fit on one line instead of breaking mid-word. */
@media (max-width: 640px) {
  .v2-contact__mail { padding: 24px; }
  .v2 .v2-contact__address { font-size: 20px; }
}
