/* Dynamic content appears only after a user action; AI.png remains the base interface. */
:root {
  color-scheme: light;
  --ink: #292929;
  --yellow: #ffff00;
}

button,
input,
textarea {
  font: inherit;
}

.inline-workspace {
  position: absolute;
  z-index: 2;
  left: 22.8515625%;
  top: 27.34375%;
  width: 54.296875%;
  height: 68.75%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--ink);
  font: clamp(13px, 1.05cqw, 21px)/1.5 Arial, sans-serif;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: .8em;
  border-bottom: max(1px, .1cqw) solid var(--ink);
}

.workspace-header h1 {
  margin: 0;
  font-size: 1.45em;
  font-weight: 700;
}

.inline-workspace button,
.history-drawer button,
.auth-dialog button {
  box-sizing: border-box;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: .58em 1em;
  color: var(--yellow);
  background: var(--ink);
  cursor: pointer;
}

.inline-workspace button:disabled,
.history-drawer button:disabled,
.auth-dialog button:disabled {
  cursor: wait;
  opacity: .6;
}

#status {
  min-height: 1.5em;
  margin: .75em 0 0;
  font-weight: 700;
}

#status:empty,
#auth-status:empty,
#history-status:empty {
  display: none;
}

#messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: .9em .25em 1em;
  scrollbar-color: var(--ink) transparent;
}

#messages article {
  box-sizing: border-box;
  width: fit-content;
  max-width: 88%;
  margin: 0 0 .9em;
  padding: .8em 1em;
  border: 1px solid var(--ink);
  border-radius: 1.15em;
  background: rgb(255 255 255 / 64%);
  overflow-wrap: anywhere;
}

#messages article[data-role="user"] {
  margin-left: auto;
  color: var(--yellow);
  background: var(--ink);
}

#messages article[data-role="assistant"] {
  margin-right: auto;
}

#messages article > strong {
  display: block;
  margin-bottom: .3em;
}

#messages p {
  margin: .45em 0 0;
  white-space: pre-wrap;
}

#messages a {
  color: inherit;
  font-weight: 700;
}

#messages img {
  display: block;
  width: min(100%, 760px);
  height: auto;
  margin: .75em 0;
  border-radius: .8em;
}

#prompt-form {
  flex: 0 0 auto;
  padding-top: .75em;
  border-top: max(1px, .1cqw) solid var(--ink);
}

#prompt-form label {
  display: block;
  margin-bottom: .35em;
  font-weight: 700;
}

.composer-row {
  display: flex;
  align-items: stretch;
  gap: .55em;
  padding: .45em;
  border-radius: 1.15em;
  background: var(--ink);
}

#prompt {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  padding: .45em .55em;
  color: var(--yellow);
  background: transparent;
  border: 0;
  outline: 0;
}

#send-prompt {
  align-self: center;
  color: var(--ink);
  background: var(--yellow);
}

.feedback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45em;
  margin-top: .7em;
}

.feedback-controls button {
  padding: .35em .7em;
  font-size: .82em;
}

.feedback-controls button[aria-pressed="true"] {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.feedback-controls span {
  font-size: .82em;
}

.drawer-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgb(0 0 0 / 38%);
}

.history-drawer {
  position: fixed;
  z-index: 21;
  inset: 0 auto 0 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(390px, 88vw);
  padding: 24px;
  color: var(--yellow);
  background: var(--ink);
  box-shadow: none;
  font: 16px/1.45 Arial, sans-serif;
  transform: translateX(-105%);
  transition: transform 220ms ease-out;
}

.history-drawer.is-open {
  transform: translateX(0);
  box-shadow: 10px 0 30px rgb(0 0 0 / 28%);
}

.drawer-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.drawer-header h2,
.dialog-header h1 {
  margin: 0;
}

#close-drawer,
#close-auth {
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
  background: var(--yellow);
  font-size: 28px;
  line-height: 1;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 12px;
}

.drawer-actions button,
.drawer-logout {
  color: var(--ink);
  background: var(--yellow);
}

#drawer-account {
  margin: 8px 0 14px;
  overflow-wrap: anywhere;
}

.history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.history-list button {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  border-color: var(--yellow);
  border-radius: 12px;
  text-align: left;
  overflow-wrap: anywhere;
}

#history-status {
  margin: 12px 0;
}

.drawer-logout {
  align-self: flex-start;
}

.auth-dialog {
  box-sizing: border-box;
  width: min(520px, calc(100% - 32px));
  padding: 24px;
  color: var(--yellow);
  background: var(--ink);
  border: 2px solid var(--yellow);
  border-radius: 18px;
  font: 16px/1.45 Arial, sans-serif;
}

.auth-dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

.auth-dialog label {
  display: block;
  margin: 18px 0;
}

.auth-dialog input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  color: var(--yellow);
  background: transparent;
  border: 1px solid var(--yellow);
  border-radius: 10px;
  outline: 0;
}

.auth-dialog #auth-submit,
.auth-dialog #auth-switch {
  margin: 4px 4px 0 0;
  color: var(--ink);
  background: var(--yellow);
}

@media (max-width: 700px) {
  .inline-workspace {
    left: 5%;
    width: 90%;
    font-size: clamp(12px, 2.8cqw, 17px);
  }

  #messages article {
    max-width: 96%;
  }

  .workspace-header {
    align-items: flex-start;
  }

  .composer-row {
    flex-direction: column;
  }

  #send-prompt {
    align-self: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-drawer {
    transition: none;
  }
}
