/* Dark theme base */
:root{
  --bg:#0e0f13;
  --panel:#14161c;
  --panel-2:#1a1d25;
  --text:#e8e8ef;
  --muted:#8e93a6;
  --accent:#6aa6ff;
  --danger:#ff6b6b;
  --border:#2a2e3a;
  --render: #00ff00;
}

*{box-sizing:border-box}
html,body{
  height:100%;
  background:var(--bg);
  color:var(--text);
  margin:0;
  font:14px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
}
body{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

header,footer{
  padding:12px 16px;
  background:var(--panel);
  border-bottom:1px solid var(--border);
}

header h1{
  margin:0;
  font-size:18px;
  color:var(--text);
}
#filename{ color:var(--muted); 
  font-size: 18px;
  margin-top: 4px;
*/small gap below title*/
}

main{
  display:grid;
  grid-template-columns: 380px 1fr;
  gap:12px;
  padding:12px;
  flex:1;
  min-height:0;
  /*adjust this value for the footer*/
}

.controls{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:8px;
  padding:12px;
  overflow:auto;
}

.urow{
  display:flex;
  flex-wrap:wrap;
  gap:10px 12px;
  align-items:center;
  margin-bottom:12px;
}

label{ display:flex; flex-direction:column; gap:6px; }
label.checkbox, label.radio{ flex-direction:row; align-items:center; gap:8px; }
fieldset.mode{ border:1px dashed var(--border); padding:3px 10px; border-radius:6px; }
legend{ color:var(--muted); }

.btn{
  background:var(--panel-2);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:6px;
  padding:8px 12px;
  cursor:pointer;
}
.btn:hover{ border-color:var(--accent); }
.btn-danger{ border-color:var(--danger); color:#ff6b6b; }
.btn-render{ border-color:var(--render); color:#00ff00}

.file-label input[type=file]{ display:none; }
.file-label .btn{ display:inline-block; }

.drop-zone{
  flex:1;
  min-height:42px;
  border:1px dashed var(--border);
  border-radius:6px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  background:var(--panel-2);
  outline:none;
}
.drop-zone:focus{ border-color:var(--accent); color:var(--text); }

.preview-wrap{
  display:flex;
  flex-direction:column;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:8px;
  min-width:0;
}
.preview-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 12px;
  border-bottom:1px solid var(--border);
  color:var(--muted);
}

.preview{
  position:relative;
  flex:1;
  min-height:0;
  padding:12px;
  overflow:hidden; /* no scroll */
  display:flex;
  align-items:flex-start; /* top */
  justify-content:flex-start; /* left */
  background:var(--panel-2);
}
.ascii-container{
  position:absolute;
  top:12px;
  left:12px;
  transform-origin: top left;
  white-space: pre;
  line-height: 1.0;
  letter-spacing: 0px;
  user-select:text;
  background:#111;
  padding:8px;
  border-radius:6px;
  border:1px solid var(--border);
}

.muted{ color:var(--muted); }

footer{
  position:fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px; /*adjust footer height*/
  background: var(--panel); /*keeps backgroundd dark from theme*/
  border-top:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  z-index:1000; /*keeps it above contnet*/
}

/* === Cross‑platform fixed header & footer (desktop + iOS) === */
header, footer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--panel);
  color: var(--text);
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: auto; /*allow it to expand to two lines*/
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column; /*stack title and filenmae vertically*/
  align-items: flex-start;
  justify-content: center;
  padding-left: 8px 16px;
  text-align: left;
}

footer {
  bottom: 0;
  height: 48px; /* adjust as needed */
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
}

/* Main content fills space between fixed header & footer */
main {
  position: relative;
  min-height: calc(100vh - (90px + 60px));
  padding-top: 90px;   /* header height */
  padding-bottom: 60px;/* footer height */
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}


/* === iOS/Desktop safe viewport sizing for fixed header & footer === */
:root {
  --header-h: 56px; /* updated live via JS */
  --footer-h: 48px; /* updated live via JS */
}

html, body {
  height: 100%;
  min-height: 100%;
  height: -webkit-fill-available;
}

@supports (height: 100svh) {
  body { min-height: 100svh; }
}

/* Middle content fills between fixed bars; avoid cropping on iOS */
main {
  position: relative;
  height: calc(100svh - var(--header-h) - var(--footer-h));
  padding-top: calc(var(--header-h) + env(safe-area-inset-top));
  padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom));
  margin-top: 10px;
  margin-bottom: 10px;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@supports not (height: 100svh) {
  main {
    height: calc(100vh - var(--header-h) - var(--footer-h));
    min-height: -webkit-fill-available;
  }
}
