:root{
  --bg:#f6f7fb;
  --bg-2:#f1f5ff;
  --panel:#ffffff;
  --panel-soft:#ffffff;
  --ink:#0f172a;
  --muted:#475569;
  --line:#e5e7eb;
  --line-strong:#d1d5db;
  --steel:#334155;
  --accent:#2563eb;
  --danger:#b91c1c;
  --success:#2563eb;
  --shadow:0 10px 30px rgba(15, 23, 42, .08);
  --radius-xl:18px;
  --radius-lg:14px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  color:var(--ink);
  font-family:"Aptos","Segoe UI Variable Text","Segoe UI",sans-serif;
  background:linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  overflow-x:hidden;
}

.page{
  position:relative;
  z-index:1;
  max-width:1120px;
  margin:0 auto;
  padding:22px 16px 26px;
}

.page::before{
  content:"";
  position:absolute;
  inset:-60px -20px -20px -20px;
  pointer-events:none;
  z-index:0;
  opacity:.08;
  background-image:
    repeating-linear-gradient(0deg, rgba(15,23,42,.22) 0, rgba(15,23,42,.22) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(90deg, rgba(15,23,42,.12) 0, rgba(15,23,42,.12) 1px, transparent 1px, transparent 28px);
}

.page > *{
  position:relative;
  z-index:1;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.brand__mark{
  width:34px;
  height:34px;
  border-radius:12px;
  background:linear-gradient(135deg, rgba(37,99,235,.18), rgba(37,99,235,.08));
  border:1px solid rgba(37,99,235,.22);
  position:relative;
  flex:0 0 auto;
}

.brand__mark span{
  position:absolute;
  border-radius:999px;
  background:var(--accent);
  opacity:.9;
}

.brand__mark span:nth-child(1){
  width:12px;
  height:12px;
  left:10px;
  top:10px;
}

.brand__mark span:nth-child(2){
  width:18px;
  height:6px;
  left:8px;
  top:20px;
  opacity:.75;
}

.brand__text{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.brand__name{
  font-family:"Aptos Display","Segoe UI Variable Display","Aptos","Segoe UI",sans-serif;
  font-size:16px;
  font-weight:900;
  letter-spacing:-.01em;
}

.brand__tag{
  color:var(--muted);
  font-size:13px;
  margin-top:2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.topbar__meta{
  display:flex;
  align-items:center;
  gap:10px;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(37,99,235,.22);
  color:var(--steel);
  background:rgba(255,255,255,.7);
  font-size:12.5px;
  font-weight:700;
}

.workspace{
  display:grid;
  grid-template-columns:minmax(300px, .92fr) minmax(320px, 1.08fr);
  gap:16px;
  align-items:start;
}

.panel{
  position:relative;
  overflow:hidden;
  padding:22px;
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
  animation:rise-in .35s ease-out both;
}

.panel--input{
  background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(251,253,255,.98));
}

.panel--output{
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.98));
}

.panel--output::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:4px;
  background:linear-gradient(90deg, rgba(37,99,235,.9), rgba(37,99,235,.35));
}

.panel__eyebrow{
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.14em;
  color:var(--steel);
}

.panel__title{
  margin:12px 0 10px;
  font-family:"Aptos Display","Segoe UI Variable Display","Aptos","Segoe UI",sans-serif;
  font-size:clamp(2rem, 2.4vw, 3rem);
  line-height:1.05;
  letter-spacing:-.03em;
}

.panel__copy{
  margin:0;
  color:var(--muted);
  line-height:1.55;
  font-size:1rem;
}

.file-input{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
}

.dropzone{
  margin-top:22px;
  padding:28px 20px;
  min-height:280px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1.5px dashed rgba(37,99,235,.30);
  border-radius:var(--radius-lg);
  background:rgba(255,255,255,.7);
  transition:border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
  cursor:pointer;
}

.panel--input .dropzone{
  margin-top:0;
}

.dropzone:hover,
.dropzone:focus{
  outline:none;
  border-color:rgba(37,99,235,.9);
  background:rgba(255,255,255,.95);
  transform:translateY(-2px);
  box-shadow:0 18px 32px rgba(37, 99, 235, .10);
}

.dropzone:hover .dropzone__icon,
.dropzone:focus .dropzone__icon{
  transform:translateY(-2px);
}

.dropzone:focus-visible{
  outline:3px solid rgba(37,99,235,.22);
  outline-offset:4px;
}

.dropzone.is-active{
  border-color:rgba(37,99,235,.9);
  background:rgba(248,250,255,.98);
  box-shadow:0 20px 36px rgba(37, 99, 235, .14);
}

.dropzone__inner{
  max-width:360px;
  text-align:center;
}

.dropzone__title{
  margin-top:18px;
  font-family:"Aptos Display","Segoe UI Variable Display","Aptos","Segoe UI",sans-serif;
  font-size:1.45rem;
  line-height:1.15;
  letter-spacing:-.02em;
}

.dropzone__hint{
  margin-top:10px;
  color:var(--muted);
  font-size:14px;
  line-height:1.55;
}

.dropzone__icon{
  position:relative;
  width:84px;
  height:84px;
  margin:0 auto;
  border-radius:28px;
  background:linear-gradient(135deg, rgba(37,99,235,.14), rgba(37,99,235,.06));
  border:1px solid rgba(37,99,235,.18);
  transition:transform .18s ease;
}

.dropzone__icon span{
  position:absolute;
  border-radius:999px;
}

.dropzone__icon span:nth-child(1){
  inset:18px 18px auto auto;
  width:18px;
  height:18px;
  background:rgba(37,99,235,.95);
}

.dropzone__icon span:nth-child(2){
  left:18px;
  right:18px;
  bottom:22px;
  height:18px;
  background:rgba(37,99,235,.6);
}

.dropzone__icon span:nth-child(3){
  left:24px;
  top:22px;
  width:26px;
  height:26px;
  background:rgba(37,99,235,.82);
}

.pane{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.pane__top{
  display:flex;
  gap:16px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

.pane__title{
  margin-top:6px;
  font-family:"Aptos Display","Segoe UI Variable Display","Aptos","Segoe UI",sans-serif;
  font-size:1.9rem;
  line-height:1.05;
  letter-spacing:-.02em;
}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.btn{
  min-height:46px;
  border:1px solid transparent;
  border-radius:999px;
  padding:12px 18px;
  cursor:pointer;
  font:inherit;
  font-weight:700;
  color:#ffffff;
  background:linear-gradient(135deg, rgba(37,99,235,.98), rgba(37,99,235,.78));
  box-shadow:none;
  transition:background .15s ease, opacity .15s ease, transform .15s ease, box-shadow .15s ease;
  text-align:center;
}

.btn:hover:not(:disabled){
  transform:translateY(-1px);
  background:linear-gradient(135deg, rgba(29,78,216,.98), rgba(37,99,235,.72));
  box-shadow:0 14px 24px rgba(37, 99, 235, .18);
}

.btn:focus{
  outline:3px solid rgba(37,99,235,.20);
  outline-offset:2px;
}

.btn:disabled{
  opacity:.42;
  cursor:not-allowed;
  box-shadow:none;
}

.btn--ghost{
  color:var(--ink);
  background:#ffffff;
  border:1px solid var(--line-strong);
  box-shadow:none;
}

#copy{
  padding:10px 14px;
  min-height:40px;
  transition:background-color .18s ease, transform .18s ease, border-color .18s ease;
}

#copy:hover:not(:disabled){
  background:#f8fafc;
  transform:translateY(-1px);
  box-shadow:none;
}

.textarea{
  width:100%;
  min-height:390px;
  resize:vertical;
  padding:18px 18px 18px 22px;
  border:1px solid var(--line);
  border-radius:16px;
  background:
    linear-gradient(180deg, #ffffff, #fbfcff),
    repeating-linear-gradient(0deg, rgba(15,23,42,.035) 0, rgba(15,23,42,.035) 1px, transparent 1px, transparent 28px);
  color:var(--ink);
  font:15px/1.7 "Cascadia Code","Consolas","Courier New",monospace;
  outline:none;
  transition:border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}

.panel--output.is-processing .textarea{
  border-color:rgba(37,99,235,.45);
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}

.panel--output.has-text .textarea{
  border-color:rgba(37,99,235,.28);
}

.status-row{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.outputbar{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.status-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.status,
.status-note{
  min-height:16px;
  font-size:13px;
}

.status{
  color:var(--muted);
  font-weight:800;
}

.status-note{
  color:var(--muted);
  letter-spacing:.01em;
}

.status--ok{color:var(--success)}
.status--err{color:var(--danger)}

.spinner{
  width:16px;
  height:16px;
  border-radius:50%;
  border:2px solid rgba(37,99,235,.18);
  border-top-color:rgba(37,99,235,.95);
  display:none;
  animation:spin .85s linear infinite;
}

.spinner.is-active{
  display:inline-block;
}

@keyframes spin{
  from{transform:rotate(0deg)}
  to{transform:rotate(360deg)}
}

@keyframes rise-in{
  from{
    opacity:0;
    transform:translateY(12px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

@media (max-width: 920px){
  .workspace{
    grid-template-columns:1fr;
  }
}

@media (max-width: 640px){
  .page{
    padding:14px 12px 20px;
  }

  .topbar{
    margin-bottom:12px;
  }

  .brand__tag{
    display:none;
  }

  .panel{
    padding:20px;
  }

  .panel__title{
    font-size:2rem;
  }

  .dropzone{
    min-height:220px;
    padding:24px 16px;
  }

  .pane__title{
    font-size:1.6rem;
  }

  .actions{
    width:100%;
  }

  .actions .btn{
    flex:1 1 0;
  }

  .textarea{
    min-height:300px;
    font-size:15px;
  }
}
