:root {
  --bg: #0b0f14;
  --bg-soft: #0e141b;
  --card: #121826;
  --text: #e6edf3;
  --muted: #93a0ae;
  --brand: #68b5fb;
  --brand-2: #a78bfa;
  --border: #1f2a3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(104,181,251,0.12), transparent 60%),
              radial-gradient(1000px 600px at 110% -10%, rgba(167,139,250,0.10), transparent 60%),
              var(--bg);
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(10px);
  background: linear-gradient(to bottom, rgba(11,15,20,0.9), rgba(11,15,20,0.6));
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.2px; }
.brand-icon { font-size: 20px; }
.brand-name { font-size: 16px; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-actions .link { color: var(--muted); text-decoration: none; }
.header-actions .link:hover { color: var(--text); }
.coffee-btn {
  background: linear-gradient(180deg, #ff6b35, #f7931e);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.coffee-btn:hover {
  background: linear-gradient(180deg, #ff5722, #ff9800);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}
.coffee-icon { font-size: 16px; }

.app-footer { color: var(--muted); padding: 32px 0 64px; }
.app-footer .container { display: flex; flex-direction: column; gap: 12px; }
.footer-content { 
  display: grid; 
  grid-template-columns: 1fr 300px; 
  gap: 24px; 
  align-items: start; 
}
.footer-description { 
  margin: 0; 
  font-size: 14px; 
  line-height: 1.5; 
  color: var(--muted); 
}
.ad-space { 
  display: flex; 
  justify-content: center; 
  align-items: center; 
}
.ad-placeholder {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}
.ad-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ad-content p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}
.ad-content small {
  font-size: 12px;
  color: var(--muted);
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.0));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.uploader { margin: 28px auto; padding: 28px; }
.drop-zone {
  border: 2px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(180deg, rgba(104,181,251,0.06), rgba(167,139,250,0.05));
  cursor: pointer;
  outline: none;
}
.drop-zone:focus-visible { box-shadow: 0 0 0 3px rgba(104,181,251,0.35); }
.drop-zone.drag-over { border-color: var(--brand); background: rgba(104,181,251,0.08); }
.dz-content { display: grid; justify-items: center; gap: 10px; }
.dz-icon { color: var(--brand); }
.dz-title { margin: 6px 0 0; color: var(--text); }
.dz-hint { margin: 0; color: var(--muted); font-size: 13px; }

.player-section { margin: 22px auto; }
.player-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.media { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
video { display: block; width: 100%; height: auto; background: #000; max-height: 60vh; }

.controls { display: grid; gap: 12px; }
.time-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; }

.scrubber { appearance: none; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.12); outline: none; }
.scrubber::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(180deg, var(--brand), var(--brand-2)); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.scrubber::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(180deg, var(--brand), var(--brand-2)); border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

.buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

.btn {
  --bg-btn: rgba(255,255,255,0.06);
  --bg-btn-hover: rgba(255,255,255,0.12);
  border: 1px solid var(--border);
  background: var(--bg-btn);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: var(--bg-btn-hover); }
.btn.primary { background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.secondary { background: rgba(255,255,255,0.08); }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,0.18); }
.btn.danger { background: linear-gradient(180deg, #ef4444, #dc2626); border-color: transparent; color: white; }
.btn.danger:hover { filter: brightness(1.1); }

.select-label { color: var(--muted); font-size: 13px; }
.select { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 10px; }

.preview-area { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; margin-top: 8px; }
.preview-area img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }

.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.hidden { display: none !important; }

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.help-section {
  margin-bottom: 24px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.help-section p {
  margin: 0 0 12px 0;
  color: var(--muted);
  line-height: 1.5;
}

.help-section ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.help-section li {
  margin-bottom: 8px;
  line-height: 1.4;
}

.help-section strong {
  color: var(--text);
}

@media (min-width: 900px) {
  .player-grid { grid-template-columns: 1fr; }
}

/* Mobile-first improvements */
@media (max-width: 768px) {
  .container { width: 95%; }
  
  .uploader { margin: 20px auto; padding: 20px; }
  .drop-zone { padding: 24px 16px; }
  .dz-icon svg { width: 40px; height: 40px; }
  .dz-title { font-size: 16px; margin: 8px 0 0; }
  .dz-hint { font-size: 14px; }
  
  .player-section { margin: 16px auto; padding: 16px; }
  .player-grid { gap: 16px; }
  
  .time-row { gap: 8px; }
  .time { font-size: 14px; }
  
  .buttons { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 12px; 
  }
  .buttons .spacer { display: none; }
  
  .btn { 
    padding: 14px 18px; 
    font-size: 16px; 
    border-radius: 14px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .scrubber { height: 8px; }
  .scrubber::-webkit-slider-thumb { width: 24px; height: 24px; }
  .scrubber::-moz-range-thumb { width: 24px; height: 24px; }
  
  .preview-area { 
    grid-template-columns: 1fr; 
    gap: 16px; 
    text-align: center; 
  }
  .preview-area img { max-width: 100%; max-height: 200px; }
  
  .app-footer { padding: 24px 0 32px; font-size: 14px; }
  .footer-content { 
    grid-template-columns: 1fr; 
    gap: 16px; 
  }
  .ad-placeholder { 
    min-height: 100px; 
    padding: 16px; 
  }
  
  /* Mobile-specific video player improvements */
  video { 
    max-height: 50vh; 
    object-fit: contain;
  }
  
  /* Better mobile header */
  .header-inner { padding: 12px 0; }
  .brand-name { font-size: 15px; }
  .header-actions { gap: 12px; }
  .coffee-btn { 
    padding: 10px 14px; 
    font-size: 13px; 
  }
  .coffee-btn span:last-child { display: none; }
  
  /* Mobile format selector */
  .select-label { font-size: 14px; }
  .select { 
    padding: 10px 12px; 
    font-size: 16px; 
    min-height: 48px;
    border-radius: 12px;
  }
}

@media (pointer: coarse) {
  .btn { padding: 14px 18px; min-height: 48px; }
  .scrubber::-webkit-slider-thumb { width: 24px; height: 24px; }
  .scrubber::-moz-range-thumb { width: 24px; height: 24px; }
}


