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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 620px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 36px 30px;
  text-align: center;
}

header h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

header p {
  font-size: 14px;
  opacity: 0.9;
}

main {
  padding: 32px 30px;
}

.input-group {
  display: flex;
  gap: 10px;
}

.link-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}

.link-input:focus {
  outline: none;
  border-color: #667eea;
}

.help-text {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 8px;
  line-height: 1.5;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-download {
  background: linear-gradient(135deg, #2eb872 0%, #1f9b5c 100%);
  color: white;
  width: 100%;
  font-size: 16px;
}

.btn-download:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(46, 184, 114, 0.3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.resource-info.hidden,
.listing.hidden,
.message.hidden {
  display: none;
}

.info-card {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.info-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
}

#resourceIcon {
  font-size: 38px;
}

.info-text h2 {
  font-size: 18px;
  margin-bottom: 4px;
  word-break: break-word;
}

.info-text p {
  font-size: 13px;
  color: #666;
}

.hint {
  font-size: 12px;
  color: #777;
  margin-top: 12px;
  line-height: 1.5;
  text-align: center;
}

.block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 2px solid #eee;
}

.block-title {
  font-size: 18px;
  margin-bottom: 4px;
}

.block-sub {
  font-size: 12px;
  color: #888;
  margin-bottom: 14px;
}

.video-icon {
  font-size: 34px;
}

.quality-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.quality-row label {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

.select {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  background: white;
}

.select:focus {
  outline: none;
  border-color: #667eea;
}

.info-card.hidden {
  display: none;
}

.listing-title {
  font-size: 14px;
  color: #555;
  margin-bottom: 10px;
}

.listing-body {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.listing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.listing-row:last-child {
  border-bottom: none;
}

.listing-name {
  flex: 1;
  word-break: break-word;
}

.listing-size {
  color: #888;
  font-variant-numeric: tabular-nums;
}

.message {
  padding: 14px 18px;
  border-radius: 8px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.5;
}

.message.success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.message.error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.message.info {
  background: #e7f1ff;
  border: 1px solid #c5ddff;
  color: #1c4587;
}

footer {
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  padding: 18px 30px;
  text-align: center;
  font-size: 12px;
  color: #666;
}

@media (max-width: 520px) {
  header {
    padding: 28px 20px;
  }

  header h1 {
    font-size: 23px;
  }

  main {
    padding: 20px;
  }

  .input-group {
    flex-direction: column;
  }

  .btn-primary {
    width: 100%;
  }
}
