* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "Segoe UI", "Sarabun", "Tahoma", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2d3748;
    padding: 24px 16px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 32px;
}

header {
    text-align: center;
    margin-bottom: 28px;
}

h1 {
    font-size: 28px;
    color: #1a202c;
    margin-bottom: 6px;
}

.subtitle {
    color: #718096;
    font-size: 14px;
}

.row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.quality-row label {
    color: #4a5568;
    font-size: 14px;
    min-width: 70px;
}

input[type="url"], select {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.15s;
}

input[type="url"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 22px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

button:hover { background: #5568d3; }
button:active { transform: scale(0.98); }
button:disabled { background: #a0aec0; cursor: not-allowed; }

.status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.status.loading { background: #ebf8ff; color: #2b6cb0; }
.status.error   { background: #fff5f5; color: #c53030; }

.preview {
    margin-top: 20px;
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 12px;
}

.preview img {
    width: 180px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: #cbd5e0;
}

.preview .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview h2 {
    font-size: 16px;
    color: #1a202c;
    line-height: 1.4;
}

.preview #meta {
    font-size: 13px;
    color: #718096;
    flex: 1;
}

.result {
    margin-top: 20px;
    padding: 16px;
    background: #f0fff4;
    border-radius: 8px;
    color: #22543d;
}

.result a {
    color: #2f855a;
    font-weight: 600;
    text-decoration: underline;
}

.hidden { display: none; }

footer {
    margin-top: 28px;
    text-align: center;
    color: #a0aec0;
    font-size: 12px;
}

@media (max-width: 540px) {
    .row { flex-direction: column; align-items: stretch; }
    .preview { flex-direction: column; }
    .preview img { width: 100%; height: 160px; }
    .quality-row { flex-direction: row; }
}
