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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #a855f7;
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-2: #232340;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  padding-top: calc(var(--safe-top) + 16px);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

/* Header */
.header {
  padding: 20px 0;
}

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

.logo h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Input Section */
.input-section {
  margin-bottom: 24px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
}

.input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

#urlInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 14px 0;
  width: 100%;
}

#urlInput::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.clear-btn:hover {
  color: var(--text);
}

.error-msg {
  font-size: 13px;
  color: var(--danger);
  min-height: 20px;
  padding: 6px 0 0 2px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Player */
.player-section {
  margin-bottom: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.player-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.player-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
}

.player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Platforms */
.platforms-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: var(--surface);
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.platform-card:active {
  transform: scale(0.96);
}

.platform-card:hover {
  border-color: var(--primary);
}

.platform-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.platform-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Tips */
.tips-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f59e0b;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.tips-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-list li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tips-list strong {
  color: var(--text);
}

/* Footer */
.footer {
  text-align: center;
  padding: 8px 0 16px;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Responsive: larger screens */
@media (min-width: 480px) {
  #app {
    padding-top: 32px;
  }

  .platforms-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
