:root {
    --bg: #ffffff;
    --cyan: #0cc8f3;
    --cyan-dark: #089bd7;
    --cyan-light: #4ddcff;
    --text: #ffffff;
    --text-soft: rgba(255, 255, 255, 0.88);
    --ink: #1f2937;
    --muted: #6b7280;
    --error: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.page-shell { min-height: 100vh; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e9eef3;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-mark svg { width: 42px; height: 42px; }

.brand-copy strong {
    font-size: 1.1rem;
    color: #111827;
}

.hero {
    background: linear-gradient(180deg, var(--cyan) 0%, var(--cyan-dark) 100%);
    padding: 68px 20px 80px;
}

.hero-inner {
    width: min(100%, 760px);
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(2.3rem, 5vw, 4rem);
    line-height: 1.18;
    font-weight: 700;
}

.hero-text {
    margin: 26px auto 34px;
    max-width: 680px;
    color: var(--text-soft);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.8;
}

.download-panel {
    width: min(100%, 680px);
    margin: 0 auto;
}

.input-wrap {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.input-wrap input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    padding: 14px 18px;
    color: #374151;
    font-size: 1rem;
}

.input-wrap input::placeholder { color: #8b95a5; }

.paste-btn, .download-btn, .result-btn { border: 0; cursor: pointer; }

.paste-btn {
    min-width: 118px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #3fd4ff 0%, #0fa2eb 100%);
    color: #ffffff;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
}

.paste-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 162, 235, 0.4);
}

.download-btn {
    width: 100%;
    margin-top: 18px;
    padding: 20px;
    border-radius: 18px;
    background: #1173ff;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 115, 255, 0.4);
}

.download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.download-btn .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.download-btn.loading .spinner { display: inline-block; }
.download-btn.loading .btn-text { display: none; }

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

.helper-text {
    margin: 18px 0 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.96rem;
    line-height: 1.7;
}

/* RESULT CARD */
.result-card {
    width: min(100%, 680px);
    margin: 22px auto 0;
    padding: 18px;
    border-radius: 18px;
    background: #ffffff;
    text-align: left;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-media {
    position: relative;
    margin-bottom: 16px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 9 / 16;
    max-height: 500px;
}

.result-media video, .result-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-media video { position: absolute; top: 0; left: 0; }

.cover-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.74);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}

.play-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 3;
    transition: background 0.3s;
}

.play-overlay:hover { background: rgba(0,0,0,0.1); }
.play-overlay.hidden { display: none; }

.play-btn-circle {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.play-btn-circle:hover { transform: scale(1.1); }

.play-btn-circle svg {
    width: 28px; height: 28px;
    margin-left: 4px;
    fill: var(--cyan-dark);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-label {
    margin: 0 0 4px;
    color: #6b7280;
    font-size: 0.84rem;
}

.result-head h3 {
    margin: 0;
    font-size: 1rem;
    color: #111827;
}

.result-status {
    padding: 8px 12px;
    border-radius: 999px;
    background: #e6fff6;
    color: #067647;
    font-size: 0.86rem;
    font-weight: 700;
}

.result-url {
    margin: 14px 0 0;
    color: #4b5563;
    line-height: 1.6;
    word-break: break-all;
    font-size: 0.85rem;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eef8ff;
    color: #0b75d1;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.tag-chip:hover {
    background: #d6ecff;
    transform: translateY(-1px);
}

.tag-chip svg { width: 14px; height: 14px; margin-right: 6px; }
.tag-chip.copied { background: #d4edda; color: #155724; }

.result-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.result-btn {
    padding: 14px 16px;
    border-radius: 14px;
    background: #eef7ff;
    color: #1173ff;
    font-weight: 700;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-btn:hover {
    background: #d6ecff;
    transform: translateY(-1px);
}

.result-btn.primary {
    background: #1173ff;
    color: #ffffff;
}

.result-btn.primary:hover { background: #0d5fd4; }
.result-btn svg { width: 18px; height: 18px; }

/* VIDEO INFO */
.video-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9eef3;
}

.video-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.info-item {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
}

.info-item .info-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.info-item .info-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

/* CREATOR INFO */
.creator-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 14px;
}

.creator-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--cyan);
}

.creator-details h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #111827;
}

.creator-details p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: #6b7280;
}

/* COPY SECTIONS */
.copy-section {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e9eef3;
}

.copy-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
}

.copy-section-title svg { width: 18px; height: 18px; color: var(--cyan-dark); }

.copy-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}

.copy-box-text {
    flex: 1;
    font-size: 0.85rem;
    color: #374151;
    word-break: break-all;
    line-height: 1.5;
    max-height: 80px;
    overflow-y: auto;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--cyan);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--cyan-dark);
    transform: translateY(-1px);
}

.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { background: var(--success); }

/* HASHTAGS */
.hashtags-section { margin-top: 14px; }

.hashtags-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
}

.hashtags-section-title svg { width: 18px; height: 18px; color: var(--cyan-dark); }

.hashtags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hashtag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #eef8ff 0%, #e0f2fe 100%);
    color: #0b75d1;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #bae6fd;
    user-select: none;
}

.hashtag-chip:hover {
    background: linear-gradient(135deg, #d6ecff 0%, #bae6fd 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(11, 117, 209, 0.15);
}

.hashtag-chip svg { width: 14px; height: 14px; }

.hashtag-chip.copied {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-color: #c3e6cb;
}

.copy-all-hashtags {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--cyan);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.copy-all-hashtags:hover {
    background: var(--cyan-dark);
    transform: translateY(-1px);
}

.copy-all-hashtags svg { width: 16px; height: 16px; }
.copy-all-hashtags.copied { background: var(--success); }

/* PROFILE URL */
.profile-url-section {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e9eef3;
}

.profile-url-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.profile-url-logo { width: 28px; height: 28px; flex-shrink: 0; }

.profile-url-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.profile-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}

.profile-url-text {
    flex: 1;
    font-size: 0.85rem;
    color: #0b75d1;
    word-break: break-all;
    font-weight: 600;
}

.profile-url-text a { color: #0b75d1; text-decoration: none; }
.profile-url-text a:hover { text-decoration: underline; }

.profile-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--cyan);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.profile-copy-btn:hover { background: var(--cyan-dark); }
.profile-copy-btn.copied { background: var(--success); }

.bottom-note {
    width: min(100%, 720px);
    margin: 38px auto 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.8;
}

.hidden { display: none !important; }
.is-error { color: #ffe2e8; }
.is-success { color: #eafff5; }

.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;
}

/* TOAST */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
}

.toast.error { background: var(--error); }
.toast.success { background: var(--success); }
.toast.info { background: var(--cyan-dark); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

@media (max-width: 640px) {
    .topbar { padding: 16px; }
    .hero { padding: 46px 16px 56px; }
    .hero h1 { font-size: 2.1rem; }
    .hero-text { margin: 22px auto 26px; font-size: 1rem; }
    .input-wrap { gap: 10px; }
    .input-wrap input { padding: 12px 10px; }
    .paste-btn { min-width: 92px; padding: 14px 12px; }
    .download-btn { padding: 18px; }
    .result-actions { grid-template-columns: 1fr; }
    .result-head { align-items: flex-start; flex-direction: column; }
    .bottom-note { margin-top: 30px; font-size: 0.96rem; }
    .video-info-grid { grid-template-columns: 1fr; }
    .toast-container { left: 16px; right: 16px; }
    .toast { max-width: 100%; }
    .copy-box { flex-direction: column; align-items: stretch; }
    .copy-btn { justify-content: center; }
    .profile-url-box { flex-direction: column; align-items: stretch; }
    .profile-copy-btn { justify-content: center; }
}
