:root {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --accent: #1877f2;
  --accent-hover: #145dbf;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --error: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f172a, #1e293b);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  text-align: center;
}

.subtitle {
  color: var(--muted);
  text-align: center;
  margin: 0 0 24px;
  font-size: 0.9rem;
}

.apk-btn {
  display: block;
  text-align: center;
  margin: 0 0 20px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #0f9d58;
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.apk-btn:hover {
  background: #0c7c46;
}

form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.url-row {
  display: flex;
  gap: 8px;
  flex: 1 1 200px;
}

input[type="url"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: var(--text);
  font-size: 0.95rem;
}

input[type="url"]:focus {
  outline: 2px solid var(--accent);
}

button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#pasteBtn {
  flex: 0 0 auto;
  background: #334155;
  padding: 12px 14px;
}

#pasteBtn:hover {
  background: #475569;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 400;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  text-align: left;
  width: fit-content;
}

.link-btn:hover:not(:disabled) {
  background: none;
  text-decoration: underline;
}

.status {
  margin-top: 16px;
  font-size: 0.9rem;
  text-align: center;
}

.status.error {
  color: var(--error);
}

.status.loading {
  color: var(--muted);
}

.result {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  background: #0f172a;
  border-radius: 12px;
  padding: 16px;
}

.result img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #334155;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

#title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

#description {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: pre-line;
}

#description.collapsed {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.quality-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.quality-row select {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: var(--text);
  font-size: 0.8rem;
}

.progress-wrap {
  height: 6px;
  border-radius: 4px;
  background: #334155;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.download-btn {
  display: inline-block;
  background: #16a34a;
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

.download-btn:hover {
  background: #15803d;
}

footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.8rem;
}
