@font-face{
  font-family:"Dibaj";
  src:url("../fonts/Dibaj-Medium.woff2") format("woff2"),
      url("../fonts/Dibaj-Medium.woff") format("woff");
  font-weight:500;
  font-style:normal;
  font-display:swap;
}

:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --border:#e7e8ef;
  --text:#1f2330;
  --muted:#7a8091;
  --purple:#6f46ff;
  --purple-dark:#5a35ea;
  --blue:#2f80ed;
  --shadow:0 14px 40px rgba(22, 28, 45, .08);
  --radius:24px;
  --overlay:rgba(15, 18, 30, .55);
}

*{box-sizing:border-box}

body,
button,
input,
select,
textarea{
  font-family: 'Dibaj';
}

html,body{
  margin:0;
  padding:0;
  min-height:100%;
  background:var(--bg);
  color:var(--text);
  font-family: 'Dibaj';
}

body{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:5px;
}

.page{
  width:100%;
  max-width:760px;
}

.converter-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}

.format-bar{
  display:flex;
  align-items:flex-end;
  gap:16px;
  justify-content:space-between;
  background:#fafbfe;
  border:1px solid var(--border);
  border-radius:18px;
  padding:14px 16px;
  margin-bottom:22px;
}

.format-group{
  flex:1;
  min-width:0;
}

.format-label{
  display:flex;
  font-size:13px;
  font-weight: 600;
  color:var(--muted);
  margin-bottom:8px;
  justify-content: center;
}

.format-select{
  width:100%;
  height:32px;
  border:1px solid #dfe3ee;
  border-radius:8px;
  background:#fff;
  color:var(--text);
  padding:0 14px;
  text-align: center;
  font-size:14px;
  font-weight: 600;
  outline:none;
}

.format-select:focus{
  border-color:rgba(111,70,255,.55);
  box-shadow:0 0 0 4px rgba(111,70,255,.08);
}

.format-select:disabled{
  background:#f8f9fc;
  color:#7e8597;
  cursor:not-allowed;
}

.format-arrow{
  transform:rotate(180deg);
  width:32px;
  height:32px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  border:1px solid var(--border);
  color:var(--purple);
  flex:0 0 auto;
}

.format-arrow svg{
  fill:currentColor;
}

.dropzone{
  position:relative;
  border:2px dashed #d7dae5;
  border-radius:22px;
  padding:36px 20px 28px;
  text-align:center;
  background:#fff;
  transition:.2s ease;
  margin-bottom:24px;
}

.dropzone.is-dragover{
  border-color:var(--purple);
  background:#fbf9ff;
}

.file-input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

.dropzone-icon{
  color:#c5cade;
  margin-bottom:10px;
}

.dropzone-icon svg{
  fill:currentColor;
}

.dropzone-title{
  margin:0;
  font-size:22px;
  line-height:1.5;
  font-weight:700;
  letter-spacing:-.2px;
}

.dropzone-subtitle{
  margin:8px 0 14px;
  color:var(--muted);
  font-size:14px;
}

.secondary-btn{
  position:relative;
  z-index:1;
  border:1px solid #dfe3ee;
  background:#f8f9fc;
  color:#353b4a;
  height:44px;
  padding:0 18px;
  border-radius:14px;
  font-size:14px;
  cursor:pointer;
}

.secondary-btn:hover{
  background:#f1f3f9;
}

.file-meta{
  margin:16px 0 0;
  color:#4d5569;
  font-size:13px;
  word-break:break-word;
}

.quality-section{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top:10px;
  margin-bottom:30px;
}

.quality-header{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:10px;
}

.quality-label{
  font-size:18px;
  font-weight:900;
}

.quality-value{
  font-size:13px;
  color:var(--blue);
  font-weight:700;
  background:rgba(47,128,237,.08);
  padding:6px 10px;
  border-radius:999px;
}

.speed-select{
  width:50%;
}

.quality-helper{
  margin:10px 0 0;
  color:var(--muted);
  font-size:13px;
}

.primary-btn{
  width:100%;
  height:58px;
  border:0;
  border-radius:18px;
  background:linear-gradient(180deg, var(--purple), var(--purple-dark));
  color:#fff;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 14px 30px rgba(111,70,255,.22);
}

.primary-btn:hover{
  filter:brightness(1.02);
}

.primary-btn:disabled{
  opacity:.7;
  cursor:not-allowed;
}

.status-text{
  text-align: center;
  margin:14px 4px 0;
  min-height:22px;
  color:var(--muted);
  font-size:13px;
}

/* Modal */
.modal[hidden] {
  display: none !important;
}


.modal {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content:center;
}

.modal-overlay{
  position:absolute;
  inset:0;
  background:var(--overlay);
  backdrop-filter: blur(2px);
}

.modal-box{
  position:relative;
  z-index:1;
  width:min(760px, 100%);
  max-height:min(86vh, 860px);
  overflow:hidden;
  background:#fff;
  border-radius:24px;
  box-shadow:0 24px 80px rgba(0,0,0,.26);
  border:1px solid rgba(255,255,255,.14);
  display:flex;
  flex-direction:column;
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 0;
}

.modal-title{
  margin:0;
  font-size:18px;
}

.modal-close{
  width:38px;
  height:38px;
  border:0;
  border-radius:12px;
  cursor:pointer;
  background:#f3f5fb;
  color:#2f3444;
  font-size:24px;
  line-height:1;
}

.modal-status{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:14px 18px 0;
  font-size:13px;
  color:#4d5569;
}

.modal-progress{
  margin:12px 18px 0;
  height:10px;
  background:#edf0f7;
  border-radius:999px;
  overflow:hidden;
}

.modal-progress-bar{
  width:0%;
  height:100%;
  background:linear-gradient(90deg, #6f46ff, #8b6bff);
  border-radius:999px;
  transition:width .18s ease;
}

.modal-log{
  margin:16px 18px 0;
  flex:1;
  min-height:220px;
  max-height:42vh;
  overflow:auto;
  background:#0f1220;
  color:#cfe1ff;
  border-radius:18px;
  padding:14px;
  font-size:12px;
  line-height:1.7;
  white-space:pre-wrap;
  word-break:break-word;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  padding:16px 18px 18px;
}

.download-btn{
  border:0;
  height:46px;
  padding:0 18px;
  border-radius:14px;
  background:#16a34a;
  color:#fff;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
}

.download-btn:hover{
  filter:brightness(1.03);
}

@media (max-width:640px){
  body{padding:10px}
  .converter-card{padding:10px}
  .format-bar{
    flex-direction:column;
    align-items:stretch;
  }
  .format-arrow{
    transform:rotate(90deg);
    margin:0 auto;
  }
  .quality-header{
    flex-direction:row;
    align-items:center;
  }
  .speed-select{
    width:80%;
  }
  .modal-box{
    max-height:92vh;
  }
  .modal-status{
    flex-direction:column;
  }
}
