:root {
  --blue: #3155D9;
  --blue-deep: #2342B5;
  --bg: #FFFFFF;
  --bg-soft: #F6F8FF;
  --text: #17213A;
  --muted: #737D93;
  --border: #E8ECF5;
  --green: #1FAF5A;
  --green-deep: #189148;
  --danger: #D6455D;
  --danger-bg: #FFF3F5;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(23, 33, 58, .04), 0 18px 40px -16px rgba(49, 85, 217, .22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-soft) 0, var(--bg) 420px) no-repeat, var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 6px 14px -6px rgba(49, 85, 217, .7);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.channel-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.channel-btn i { font-size: 17px; }
.channel-btn:hover { background: var(--green-deep); transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(31, 175, 90, .8); }

/* Main */
.main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
}
.hero { text-align: center; }
.hero h1 { font-size: clamp(1.75rem, 6vw, 2.6rem); line-height: 1.18; font-weight: 700; letter-spacing: -.025em; }
.hero h1 span { color: var(--blue); }
.hero p { margin: 14px auto 0; max-width: 440px; color: var(--muted); font-size: clamp(.9rem, 2.6vw, 1rem); line-height: 1.65; }

/* Card */
.card {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
}
.label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.label i { color: var(--blue); font-size: 13px; }

.field { position: relative; }
.field-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #A3ABBE; font-size: 15px; pointer-events: none; transition: color .2s; }
.field input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 44px;
  font: 500 16px 'Poppins', system-ui, sans-serif;
  letter-spacing: .02em;
  color: var(--text);
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input::placeholder { color: #B6BDCE; font-weight: 400; }
.field input:focus { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(49, 85, 217, .12); }
.field:focus-within .field-icon { color: var(--blue); }
.field input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(214, 69, 93, .1); }

.hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); }

.error {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 14px;
  padding: 11px 14px;
  background: var(--danger-bg);
  border: 1px solid #FBD3DA;
  border-radius: 12px;
  color: var(--danger);
  font-size: 13px; line-height: 1.5; font-weight: 500;
  animation: rise .25s ease;
}
.error i { margin-top: 3px; }

/* Buttons */
.btn {
  position: relative;
  width: 100%;
  height: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0;
  border-radius: 14px;
  font: 600 15px 'Poppins', system-ui, sans-serif;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { margin-top: 18px; background: var(--blue); color: #fff; box-shadow: 0 10px 22px -10px rgba(49, 85, 217, .85); }
.btn-primary:hover { background: var(--blue-deep); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible, .btn-ghost:focus-visible, .channel-btn:focus-visible { outline: 3px solid rgba(49, 85, 217, .35); outline-offset: 2px; }
.btn-ghost { margin-top: 10px; background: var(--bg-soft); color: var(--blue); border: 1px solid var(--border); font-weight: 500; }
.btn-ghost:hover { background: #EEF2FF; }
.btn:disabled { cursor: not-allowed; opacity: .85; transform: none; }

.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-busy .spinner { display: block; }
.btn.is-busy .btn-icon { display: none; }

/* Loading */
.loading { margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--border); text-align: center; color: var(--muted); font-size: 13px; }
.skeleton-avatar {
  width: 148px; height: 148px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(100deg, #EEF1FA 30%, #F8FAFF 50%, #EEF1FA 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* Result */
.result { margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--border); text-align: center; animation: rise .35s ease; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: #EAF8F0; color: var(--green-deep); font-size: 13px; font-weight: 600; }
.frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 20px auto 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 16px 36px -16px rgba(23, 33, 58, .35);
  line-height: 0;
}
.frame img { display: block; max-width: 100%; max-height: min(60vh, 420px); width: auto; height: auto; border-radius: 17px; object-fit: contain; }
.badge {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; line-height: 1.5;
  box-shadow: 0 6px 14px -6px rgba(49, 85, 217, .8);
}
.result-number { margin-top: 14px; font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .03em; }
.actions { margin-top: 4px; }

/* Footer */
.footer { text-align: center; padding: 26px 20px 30px; }
.powered { font-size: 12.5px; font-weight: 500; letter-spacing: .14em; color: var(--muted); }
.powered i { color: var(--blue); margin-right: 4px; }
.powered strong { color: var(--blue); font-weight: 700; }
.footer hr { width: 64px; margin: 14px auto; border: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--border), transparent); width: 160px; }
.footer p { font-size: 12px; color: #9AA3B7; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  background: var(--text);
  color: #fff;
  font-size: 13.5px; font-weight: 500;
  border-radius: 12px;
  box-shadow: 0 14px 30px -10px rgba(23, 33, 58, .5);
  animation: rise .25s ease;
  z-index: 10;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast { animation-name: toast-in; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 480px) {
  .header { padding: 14px 16px; }
  .brand-name { font-size: 14px; }
  .channel-btn { padding: 8px 12px; }
  .channel-btn span { display: none; }
  .channel-btn { width: 40px; height: 40px; justify-content: center; padding: 0; }
  .main { padding: 18px 16px 32px; gap: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
