@font-face {
   font-family: "Datatype";
   src: url("./files/Datatype-VariableFont_wdth\,wght.ttf") format('truetype'); 
}
@font-face {
   font-family: "Roboto-Mono";
   src: url("./files/RobotoMono-VariableFont_wght.ttf") format('truetype'); 
}
@font-face {
   font-family: "Roboto";
   src: url("./files/Roboto-VariableFont_wdth,wght.ttf") format('truetype'); 
}
@font-face {
   font-family: "Nunito";
   src: url("./files/Nunito-VariableFont_wght.ttf") format('truetype'); 
}


:root {
   --lightmode-background: #f2f2ef;
   --lightmode-text: #161616;
   --greyed-text: #5f5f5f;
}

html, body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--lightmode-background);
}

body {
   transition: filter 0.25s ease;

}
@media screen and (max-width: 768px) {
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
  }
}
h1 {
   font-family: "Datatype";
   font-size: 20px;
   margin: 0;
   padding:0;
   font-weight: 125;
}
h2, p {
   font-family: "Datatype";
   font-size: 20px;
   margin: 0;
   padding:0;
}
.header-design {
   font-weight: 200;
   font-stretch: 120%;
}

.header-bars {
   font-weight: 900;
   font-stretch: 120%;
}
.circle-outline {
   border-radius: 50%;
   border: 1px dotted var(--lightmode-text);
   display: flex;
   align-items: center;
   justify-content: center;
   width: 28px;
   min-width: 28px;
   height: 28px;
}


h2.section-text {
   text-transform: uppercase;
   letter-spacing: 1px;
   white-space: nowrap; 
   

}
h2.section-label {
   font-family: "Nunito";
   font-size: 14px;
   font-weight: 400;
}
.header-area {
   display: flex;
   width: 100%;
   gap: 4px;
   justify-content: space-between;
   align-items: first baseline;
}
.h-line {
  width: 100%;   
  border-top: 1px solid black; 
  margin: 20px 0;  
}
#page {
   display: flex;
   flex-direction: column;
   min-height: 100vh;
}
#top-banner {
   /* background-color: #161616; */
   /* color: #f2f2ef; */
   border-bottom: 1px solid var(--lightmode-text);
   padding: calc(4px + .2em) 4px 4px 14px;
   width: 100%;
   display: flex;
   gap: 12px;
   justify-content: center;
   align-items: flex-start;
   /* position: relative; */
   /* position: absolute; */
   z-index: 2;
}
#page-title{
   padding: 0px 0px 2px 0px;
   text-transform: uppercase;
}
#meta-controls-cont {
   position: absolute;
   /* top: 0; */
   right: 12px;
}
#restart-btn {
   padding: 2px 8px;
}
.divider {
   font-stretch: 150%;
}
#wrapper {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  height: 100%;
  width: 100%;
  display: flex;
  margin: 0;
  padding: 0;
}
#all-content {
   display: flex;
   /* flex-wrap: wrap; */
   justify-content: space-between;
   padding: 0px 0px 0px 18px;
   box-sizing: border-box;
   width: 100%;
   height: 100vh;
   /* gap: 6px; */
   overflow-y: hidden;
   flex: 1 1 auto;
   min-height: 0;
   position: relative;
}
@media screen and (max-width: 768px) {
  #all-content {
    flex-direction: column;
    overflow-y: visible;
    height: auto;
    padding: 24px;
  }
}
#translation-panel{
   /* margin-top: 12px; */
   /* overflow-y: hidden; */
   height: 100%;
   display: flex;
   flex-direction: column;
   min-width: 0;
   box-sizing: border-box;
   position: relative;
}
@media screen and (max-width: 768px) {
  #translation-panel {
    flex: 1;
    width: 100%;
    height: auto;
    /* overflow-y: visible; */
  }
}
#resizer {
   position: relative;
   flex-basis: 18px;
   z-index: 2;
   cursor: col-resize;
   margin: 0;
   padding: 0;
   align-self: stretch;
   height: 100%;
   box-sizing: border-box;
   border-left: 1px solid rgba(255, 255, 255, 0.05);
   border-right: 1px solid rgb(0, 0, 0);
}
#translation-body {
   /* position: absolute; */
   display: flex;
   flex-direction: column;
   overflow-y: auto;
   overflow-x: hidden;
   /* justify-content: space-between; */
   min-width: 300px;
   /* height: 100%;  */
   padding-bottom: 24px;
   gap: 24px;
   padding-top: 24px;
   align-items: stretch; 
   /* width: 22vw; */
   /* flex: 0 0 auto;  */
}
#translation-body::-webkit-scrollbar {
  display: none;
}
@media screen and (max-width: 768px) {
  #translation-body {
    width: 100%;
    min-width: 0;
    height: auto;
    overflow-y: visible;
  }
}
#translation-body > * {
   flex-grow: 1;
}
.section-title {
   display: flex;
   gap: 12px;
   justify-content: space-between;
}
#panel-compress-cont {
   display: flex;
   justify-content: flex-end;
   height: 24px;
   width: 100%;
   padding-top: 6px; 
   background-color: transparent;
   position: absolute;
}
#compress-carat {
   display: flex;
   justify-content: center;
   align-items: center;
   border: 0;
   margin: 0;
   padding: 0px;
   width: 20px;
   height: 30px;
   border-radius: 20%;
   background: none;
   background-color: var(--lightmode-background);
   transition: 0.2s ease;
}
#compress-carat[aria-expanded="false"] {
  border: none;
  background: none;
}
#compress-carat[aria-expanded="false"]:hover {
  border: none;
}
@media screen and (max-width: 768px) {
  #compress-carat {
    display: none; 
  }
}

.text-input-area {
   display: grid;
}
textarea {
   min-height: 150px;
   min-width: 0;
   overflow-wrap: break-word;
   padding: 0;
   margin: 0;
   resize: vertical;
   background-color: transparent;
}
textarea[data-role="input-text"] {
   padding: 10px 12px; 
   font-family: "Nunito";
   font-weight: 200px;
   /* border-radius: 4px; */
}
.template-textbox:focus {
   outline: none;

}

.drop-zone.drag-over {
  outline: 2px dashed var(--lightmode-text);
  outline-offset: 2px;
}
button {
   -webkit-appearance: none;
   appearance: none;
   cursor: pointer;
   background-color: transparent;
   border: 1px solid var(--lightmode-text);
   /* border-radius: 4px; */
   color: var(--lightmode-text);
   transition: background-color 0.2s ease;
   font-family: "Nunito";
   font-size: 14px;
   padding: 2px 2px;
   
}
button:hover {
   background-color: var(--lightmode-text);
   color: var(--lightmode-background);
   transition: 0.2s ease;
}
.mode-btn {
   padding: 4px 8px;
   flex-grow: 1;
}
.mode-btn[aria-pressed="true"], .toggle-button[aria-pressed="true"] {
   background-color: var(--lightmode-text);
   color: var(--lightmode-background);
}
.mode-buttons {
   display: flex;
   flex-wrap: wrap;
   align-items: stretch;
   justify-content: space-between;
   gap: 4px;
}
/* #arrow-section {
   justify-content: space-around;
   display: flex; */
   /* padding-bottom: 24px; */
/* } */

/* #mode-switch-area {
   padding-bottom: 24px;
} */
#mode-switch-cont {
   display: flex;
   gap: 4px;
}
.toggle-button {
   padding: 4px 8px;
   width: 100%;
}
.toggle-locked button {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}
#restart-cont {
   display: flex;
   justify-content: flex-end;
}
.toggle-type-controls {
   display: flex;
   flex-direction: column;
   align-items: stretch;
   min-width: 0;
   width: 100%;
   box-sizing: border-box;
   /* gap: 24px; */
}

.generate-btn-cont, .action-btn-cont {
   display: flex;
   justify-content: flex-end;
   flex-wrap: wrap;
   gap: 4px;
   padding-top: 4px;
}
.generate-text-btn, [data-role="random-image"], .action-btn {
   border: 0;
   margin: 0;
   padding: 0px;
   background: none;
   display: flex;
   gap: 2px;
}
.generate-text-btn:hover, [data-role="random-image"]:hover, .action-btn:hover {
   background: none;
   color: var(--lightmode-text);
   transition: 0.2s ease;
}
.generate-text-btn p, [data-role="random-image"] p, .action-btn p {
   text-decoration-line: underline;
   text-decoration-style: dotted;
   text-underline-offset: 2px;
   font-size: 14px;
   transition: 0.2s ease;
}
.generate-text-btn p:hover, [data-role="random-image"] p:hover, .action-btn p:hover {
   text-decoration-style: solid;
   transition: 0.2s ease;
}
[data-role="instructions-text"] { 
   font-family: "Nunito";
}
[data-role="drop-file"] {
   min-height: 100px;
   border: 1px solid var(--lightmode-text);
   display: flex;
   padding: 0 0 4px 0px;
   gap: 4px;
   flex-direction: column;
   justify-content: center;
   align-items: stretch;
   cursor: copy;
}

.generation-area {
   display:flex; 
   /* flex-direction: row;  */
   flex-direction: row;
   gap: 4px; 
   align-items: stretch;
   width: 100%;
   box-sizing: border-box;
   min-width: 0;
}
.drop-instructions {
   display: flex;
   gap: 12px;
   justify-content: center;
   align-items: center;
}
[data-role="input-file"] {
   display: none;
}


.image-drop-cont{
   display: flex;
   flex-direction: column;
   align-items: stretch;
   box-sizing: border-box;
   min-width: 0;
   width: 100%;
}
#image-drop-area.drag-over {
   color: var(--greyed-text);
}
#image-icon {
   color: var(--lightmode-text)
}
#image-drop-area.drag-over #image-icon {
   color: var(--greyed-text);
}
[data-role="preview-img"] {
   width: 100%;
   height: auto;
}
.button-area {
   align-items: stretch;
   width: 100%;
   /* max-width: 300px; */
   box-sizing: border-box;
}
[data-role="stage-input-row"] {
   display: flex;
   flex-direction: row;
   gap: 6px;
   align-items: stretch;
   box-sizing: border-box;
   width: 100%;
}
[data-role="stage-input-row"] > .button-area {
  flex: 1 1 0;   /* takes all available width */
  min-width: 0;
  width: 0;
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
[data-role="stage-input-row"].has-output > .button-area {
  flex: 1 1 0;
  width: 0;
  max-width: 400px;
}
[data-role="stage-input-row"] > .button-area .mode-buttons {
  flex: 1 1 auto;
  min-height: 0;
}
[data-role="stage-input-row"] > [data-role="stage-output"] {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  flex: 1 1 0;
  box-sizing: border-box;
  width: 0;
  min-width: 0;
  min-height: 0;
}
[data-role="stage-input-row"].has-output > [data-role="stage-output"] {
  display: flex;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  box-sizing: border-box;
}
[data-role="stage-input-row"] .between-arrows {
  display: none;
}
[data-role="stage-input-row"].has-output .between-arrows {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-direction: column;
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 1.5rem;
}

[data-role="stage-input-row"] > .stage-output-col {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: flex;             
  flex-direction: column;   
}

[data-role="stage-input-row"] > .stage-output-col > [data-role="stage-output"] {
  flex: 1 1 auto;          
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.stage-output-image-wrap {
   flex: 1 1 auto;
   min-height: 0;
   width: 100%;
   height: 100%;
   min-width: 0;
   height: auto;
   display: flex;
   align-items: center;
   justify-content: center;
   border: 1px solid var(--lightmode-text);
   box-sizing: border-box;
}
.stage-output-image {
   max-width: 100%;
   max-height: 100%;
   width: auto;
   height: auto;
   box-sizing: border-box;
   object-fit: contain;
}
.stage-output-text {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-height: 0;
  resize: none;
  box-sizing: border-box;
  resize: none;

}
.stage-output-text:focus {
    outline: none;
}
.between-arrows .arrow {
  display: block;
  width: 10px;
  height: 12px;
  margin: 0;
  flex-shrink: 0;
}

.between-arrows .arrow path {
  fill: var(--lightmode-background);
  stroke: var(--lightmode-text);
  stroke-width: 1;
}
[data-role="stage-input-row"] > :not(.button-area):not(.between-arrows)  {
  display: none;
  min-width: 0;
  min-height: 0;
}
[data-role="stage-input-row"].has-output > :not(.button-area):not(.between-arrows)  {
  display: flex;
  flex-direction: column;

  flex: 1 1 0;
  width: 0;
  min-width: 0;
  box-sizing: border-box;
  align-self: stretch;
}
[data-role="stage-input-row"].has-output > :not(.button-area) > [data-role="stage-output"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
#active-chain-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 11px;
  border-color: transparent transparent transparent var(--lightmode-text);
  z-index: 15;
  pointer-events: none;
  display: none;
}

#chain-stages {
   display: flex;
   flex-direction: column;
   gap: 24px;
   margin-top: 24px;
   margin-bottom: 24px;
}


/* For chain stages, we store inputs but do not display them.
   The only preview shown is the output next to the buttons that produced it. */
[data-role="convert-to-image"] [data-role="stage-prev-output"],
[data-role="convert-to-text"] [data-role="stage-prev-output"] {
  display: none;
}

#canvas-area {
   position: relative;
   display: flex;
   /* justify-content: center; */
   /* align-items: center; */
   flex-direction: column;
   height: 100%;
   min-height: 400px;
   /* flex: 1; */
   flex-basis: 0;
   flex-grow: 1;
   min-width: 0;
   /* margin-left: 10vw; */
   overflow-y: hidden;
   /* padding-top: 24px; */
}
#canvas-container, #initial-display {
   flex: 1;
   
   /* min-width: 250px; */
   padding: 0px 6px;
   max-height: 100vh;
   height: 100%;  

   overflow-y: auto;
   /* background-color: #e1e1db; */
   /* border-top: 1px solid var(--lightmode-text);
   border-left: 1px solid var(--lightmode-text); */
}
#filler-text {
   position: absolute;
   z-index: 20;
   left: 50%;
   top: 50%;
   transform: translate(-50%, -50%)


}
canvas {
  display: block;
  width: 100%;
  flex: 1;
  height: auto;
  overflow: visible;
  background-color: transparent;
}
#download-canvas-btn-cont {
   background-color: var(--lightmode-background);
   position: absolute;
   z-index: 10;
   display: flex;
   justify-content: flex-end;
   bottom: 6px; 
   right: 6px;
   margin-top: auto; 
   flex-shrink: 0;
}
@media screen and (max-width: 768px) {
  #download-canvas-btn-cont {
    bottom: 0px; 
  }
}
.download-canvas-btn {
  max-width: 250px;
}

#compare-overlay-stack {
  position: absolute;
  inset: 0;
  display: none; 
  z-index: 12;
  pointer-events: none;
}

#compare-overlay-stack.is-visible {
  display: block;
}

#compare-overlay-stack #stage-hover-overlay {
  position: absolute;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.5;
  display: block;
  z-index: 1;
}

/* Image: entire stack area */
#compare-overlay-stack #stage-hover-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.5;
  display: block;
  z-index: 1;
}
/* Score bar: overlaid at the bottom, does not shrink the image */
#compare-sim-column {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  box-sizing: border-box;
  background: var(--lightmode-background);
  border-top: 1px solid var(--lightmode-text);
}

.compare-sim-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.compare-sim-label {
  flex-shrink: 0;
  width: 70px;
  font-size: 14px;
  font-family: "Nunito", sans-serif;
  line-height: 1.25;
  color: var(--lightmode-text);
  text-align: left;
  padding: 0 2px;
}

/* Thin black track (full width beside label) */
.compare-sim-track {
  flex: 1;
  height: 2px;
  min-width: 0;
  background: var(--lightmode-text);
  position: relative;
  border-radius: 1px;
}


.compare-sim-badge {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--lightmode-text);
  background: var(--lightmode-background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: "Nunito", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--lightmode-text);
  pointer-events: none;
  z-index: 3;
}

/* White fill, slightly thicker, black border — grows from left */
.compare-sim-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  box-sizing: border-box;
  border: 1px solid var(--lightmode-text);
  background: var(--lightmode-background);
  width: 0%;
  border-radius: 1px;
}

.compare-sim-fill,
.compare-sim-badge {
  transition:
    width 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

#canvas-translation-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--lightmode-background);
  color: var(--lightmode-text);
  font-family: "Nunito", sans-serif;
  font-size: 14px;
  letter-spacing: 0.02em;
  pointer-events: auto;
}

#canvas-translation-loading.is-visible {
  display: flex;
}

#canvas-translation-loading[hidden] {
  display: none !important;
}