:root {
    --bg: #eef3f6;
    --surface: #ffffff;
    --surface-soft: #f5f8fb;
    --ink: #111827;
    --muted: #667085;
    --line: #d8e1e7;
    --primary: #087f8c;
    --primary-dark: #086571;
    --blue-soft: #eaf4ff;
    --green: #067647;
    --green-soft: #ecfdf3;
    --orange: #c95d0b;
    --orange-soft: #fff5eb;
    --danger: #b42318;
    --danger-soft: #fff1f3;
    --shadow: 0 12px 30px rgba(31, 52, 63, 0.07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.is-hidden { display: none !important; }

.shell {
    width: min(1060px, calc(100% - 32px));
    margin: 0 auto;
}

.page-main { padding: 24px 0 22px; }
.hero,
.workspace {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: minmax(300px, 0.92fr) minmax(480px, 1.08fr);
    align-items: center;
    gap: 28px;
    min-height: 204px;
    padding: 24px 26px;
    margin-bottom: 14px;
}

.hero-copy { min-width: 0; padding: 2px 0; }
.hero-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    align-items: stretch;
    gap: 12px;
}
.brand-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 16px;
    font-weight: 800;
}
.brand-line img { width: 36px; height: 36px; }
.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 12px;
    line-height: 1.3;
    font-weight: 800;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 32px; line-height: 1.15; }
h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.hero-subtitle { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.state-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 7px 11px;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid rgba(6, 118, 71, 0.2);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}
.state-pill i { width: 7px; height: 7px; background: #12a06a; border-radius: 50%; }

.contact-card {
    width: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 12px;
    background: #f8fbfc;
    border: 1px solid #cfdbe0;
    border-radius: 8px;
    box-shadow: none;
}
.contact-card div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px;
}
.contact-card strong { color: #155e75; font-size: 14px; white-space: nowrap; }
.contact-card span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.contact-card img {
    display: block;
    width: 164px;
    height: 164px;
    padding: 5px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e1e8ef;
    border-radius: 6px;
}

.promo {
    display: flex;
    min-width: 0;
    min-height: 158px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 18px;
    color: #fff;
    text-decoration: none;
    background: #124a56;
    border: 1px solid #124a56;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(18, 74, 86, 0.18);
}
.promo:hover { background: #0e3e48; border-color: #0e3e48; }
.promo div { width: 100%; text-align: center; }
.promo span {
    display: block;
    margin-bottom: 12px;
    color: #9ff0dc;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 900;
}
.promo strong {
    display: block;
    max-width: 310px;
    margin: 0 auto;
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    text-wrap: balance;
}
.promo b {
    width: 100%;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    color: #103f49;
    background: #fff;
    border-radius: 8px;
    white-space: nowrap;
}

.guide {
    margin-bottom: 14px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.guide-heading {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.guide-heading::-webkit-details-marker { display: none; }
.guide-heading:hover { background: #f8fbfc; }
.guide[open] .guide-heading { background: #f8fbfc; border-bottom: 1px solid var(--line); }
.guide-heading::after {
    content: "";
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    margin-left: auto;
    border-right: 2px solid #667085;
    border-bottom: 2px solid #667085;
    transform: rotate(45deg) translateY(-3px);
    transition: transform 160ms ease;
}
.guide[open] .guide-heading::after { transform: rotate(225deg) translate(-2px, -1px); }
.guide-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #fff;
    background: #b42318;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 900;
}
.guide-title { display: grid; gap: 1px; min-width: 0; }
.guide-title strong { font-size: 16px; line-height: 1.35; }
.guide-title strong b { color: var(--danger); }
.guide-title small { color: var(--muted); font-size: 11px; font-weight: 800; }
.guide-video-wrap {
    padding: 16px;
    background: #f4f7f9;
}
.guide-video {
    display: block;
    width: 100%;
    max-height: min(72vh, 760px);
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #0b1115;
    border: 1px solid #cfdbe0;
    border-radius: 8px;
}

.workspace { padding: 22px 24px; }
.redeem-form { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-heading { margin-bottom: 15px; }
.form-heading .eyebrow { margin-bottom: 5px; }
.redeem-form label { display: block; margin-bottom: 8px; color: #344054; font-size: 13px; font-weight: 800; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
.input-row input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}
.input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15, 107, 186, 0.14); }
.input-row input:disabled { background: #f1f4f7; }
.input-row button,
.buy-code-link,
.primary-action {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 17px;
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
}
.input-row button,
.primary-action { color: #fff; background: var(--primary); border: 0; }
.input-row button:hover,
.primary-action:hover { background: var(--primary-dark); }
.input-row button:disabled,
.primary-action:disabled { cursor: wait; opacity: 0.55; }
.buy-code-link {
    color: var(--primary);
    background: #f3f9ff;
    border: 1px solid rgba(15, 107, 186, 0.28);
    text-decoration: none;
}
.buy-code-link:hover { color: #fff; background: var(--primary); }

.idle-state {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 13px;
    margin-top: 16px;
    padding: 14px 16px;
    color: var(--muted);
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.idle-state img { width: 38px; height: 38px; opacity: 0.56; }
.idle-state div { display: grid; gap: 4px; }
.idle-state strong { color: #344054; font-size: 15px; }
.idle-state span { font-size: 12px; }
.idle-state.is-searching img { opacity: 0.94; animation: searchPulse 1.4s ease-in-out infinite; }
.idle-state.is-searching strong { color: var(--primary); }

.task-area { padding-top: 20px; }
.task-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.task-heading .eyebrow { margin-bottom: 5px; }
.timer-badge {
    min-width: 72px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: var(--orange);
    background: var(--orange-soft);
    border: 1px solid rgba(201, 93, 11, 0.24);
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.result-card { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.number-block { display: grid; grid-template-columns: 126px minmax(0, 1fr); overflow: hidden; }
.country-code-block,
.national-number-block { min-width: 0; padding: 17px; }
.country-code-block { border-right: 1px solid var(--line); background: #fff; }
.country-code-block > span,
.national-number-block > span,
.code-block > span { color: var(--muted); font-size: 12px; font-weight: 800; }
.country-code-block > strong { display: block; margin-top: 7px; font-size: 27px; font-variant-numeric: tabular-nums; }
.national-number-block > div,
.code-block > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 7px; }
.national-number-block strong { min-width: 0; font-size: 29px; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.copy-button {
    flex: 0 0 auto;
    min-width: 66px;
    min-height: 36px;
    color: var(--primary);
    background: #fff;
    border: 1px solid rgba(15, 107, 186, 0.28);
    border-radius: 7px;
    font-weight: 800;
}
.copy-button:hover { color: #fff; background: var(--primary); }

.action-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 12px;
    padding: 13px 14px;
    background: var(--blue-soft);
    border-radius: 8px;
}
.action-block p { margin: 0; color: var(--muted); font-size: 12px; }
.primary-action { min-width: 208px; }

.waiting-block { margin-top: 12px; padding: 14px; background: var(--orange-soft); border-radius: 8px; }
.waiting-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.waiting-line strong { color: var(--ink); }
.waiting-line #pollHint { margin-left: auto; }
.pulse-dot { width: 8px; height: 8px; background: var(--orange); border-radius: 50%; animation: pulse 1.4s ease-in-out infinite; }
.progress-track { height: 6px; margin-top: 11px; background: rgba(201, 93, 11, 0.14); border-radius: 6px; overflow: hidden; }
.progress-track span { display: block; width: 8%; height: 100%; background: var(--orange); border-radius: inherit; transition: width 1s linear; }
.wait-advice {
    display: grid;
    gap: 3px;
    margin-top: 12px;
    padding: 11px 12px;
    color: #7a271a;
    background: #fff;
    border: 1px solid rgba(180, 35, 24, 0.24);
    border-radius: 7px;
    line-height: 1.5;
}
.wait-advice strong { font-size: 13px; }
.wait-advice span { font-size: 12px; }

.code-block { margin-top: 12px; padding: 18px; color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
.code-block > span { color: #cfe6fa; }
.code-block strong { font-size: 38px; line-height: 1.1; }
.copy-button.inverse { color: #fff; background: transparent; border-color: rgba(255,255,255,0.45); }
.sms-text { margin: 12px 0 0; color: #d9eafa; font-size: 13px; overflow-wrap: anywhere; }

.task-footer { min-height: 38px; display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-top: 11px; color: var(--muted); font-size: 12px; }
.text-button {
    min-height: 38px;
    padding: 8px 14px;
    color: #a42318;
    background: #fff4f2;
    border: 1px solid rgba(180, 35, 24, 0.32);
    border-radius: 7px;
    box-shadow: 0 3px 8px rgba(180, 35, 24, 0.08);
    font-weight: 800;
}
.text-button:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.text-button:disabled {
    cursor: not-allowed;
    color: #98a2b3;
    background: #f2f4f7;
    border-color: #d0d5dd;
    box-shadow: none;
    opacity: 1;
}

.message-box { margin-top: 14px; padding: 13px 15px; background: var(--orange-soft); border: 1px solid rgba(201, 93, 11, 0.25); border-radius: 8px; }
.message-box strong { display: block; margin-bottom: 4px; color: #7a3a09; }
.message-box p { margin: 0; color: #765536; font-size: 13px; line-height: 1.55; }
.message-box.is-error { background: var(--danger-soft); border-color: rgba(180, 35, 24, 0.24); }
.message-box.is-error strong { color: var(--danger); }
.message-box.is-error p { color: #7e403a; }

.page-note { margin: 15px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.toast {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 20;
    min-width: 120px;
    max-width: calc(100% - 32px);
    padding: 10px 14px;
    color: #fff;
    background: #111827;
    border-radius: 999px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 160ms ease, transform 160ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes pulse { 50% { opacity: 0.36; transform: scale(0.76); } }
@keyframes searchPulse { 50% { opacity: 0.48; transform: scale(0.9); } }

@media (max-width: 760px) {
    .shell { width: min(100% - 20px, 1060px); }
    .page-main { padding: 14px 0 20px; }
    .hero { grid-template-columns: 1fr; align-items: stretch; min-height: 0; padding: 18px; gap: 16px; }
    .brand-line { margin-bottom: 14px; }
    .brand-line img { width: 32px; height: 32px; }
    h1 { font-size: 27px; }
    .hero-subtitle { font-size: 13px; }
    .state-pill { margin-top: 13px; }
    .hero-actions { grid-template-columns: minmax(0, 1fr) 142px; }
    .contact-card { width: 142px; gap: 7px; padding: 8px; }
    .contact-card div { justify-content: center; }
    .contact-card span { display: none; }
    .contact-card img { width: 124px; height: 124px; padding: 5px; }
    .promo { min-height: 142px; padding: 15px; }
    .promo span { font-size: 17px; }
    .promo strong { font-size: 15px; }
    .workspace { padding: 18px; }
    .form-heading { align-items: start; }
    .input-row { grid-template-columns: 1fr 1fr; }
    .input-row input { grid-column: 1 / -1; }
    .input-row button, .buy-code-link { width: 100%; }
    .action-block { align-items: stretch; flex-direction: column; gap: 10px; }
    .primary-action { width: 100%; min-width: 0; }
}

@media (max-width: 480px) {
    .hero { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
    .brand-line { margin-bottom: 11px; }
    .eyebrow { font-size: 11px; }
    h1 { font-size: 22px; }
    .hero-subtitle { line-height: 1.5; }
    .hero-actions { grid-template-columns: minmax(0, 1fr) 116px; gap: 9px; }
    .contact-card { width: 116px; padding: 7px; }
    .contact-card div { justify-content: center; padding: 0; }
    .contact-card img { width: 100px; height: 100px; margin: 0 auto; padding: 4px; }
    .promo { min-height: 116px; gap: 9px; padding: 11px; }
    .promo span { margin-bottom: 7px; font-size: 15px; }
    .promo strong { font-size: 13px; line-height: 1.5; }
    .promo b { min-height: 34px; padding: 6px 11px; font-size: 13px; }
    .guide-heading { padding: 11px 13px; }
    .guide-title strong { font-size: 14px; }
    .guide-video-wrap { padding: 10px; }
    .guide-video { max-height: 68vh; border-radius: 6px; }
    .workspace { padding: 16px 14px; }
    .idle-state { min-height: 76px; margin-top: 14px; }
    .number-block { grid-template-columns: 76px minmax(0, 1fr); }
    .country-code-block, .national-number-block { padding: 14px 11px; }
    .country-code-block > strong, .national-number-block strong { font-size: 22px; }
    .national-number-block > div, .code-block > div { align-items: stretch; flex-direction: column; gap: 10px; }
    .copy-button { width: 100%; }
    .code-block strong { font-size: 32px; }
    .task-footer { align-items: start; flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
