:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f8fb;
  color: #121826;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  margin: 0;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.appShell {
  position: relative;
  display: block;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #f7f8fb;
}

.aiContextMenu {
  position: fixed;
  display: flex;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 18px 50px rgba(18, 24, 38, 0.18);
  padding: 14px;
  color: #121826;
  z-index: 1000;
}

.menuHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menuHeaderActions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #0f8b6c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #121826;
  font-size: 22px;
  font-weight: 820;
  line-height: 1.1;
  letter-spacing: 0;
}

.modelBadge {
  flex: 0 0 auto;
  border: 1px solid #b9c6d8;
  border-radius: 999px;
  background: #eef3f8;
  color: #304156;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 8px 10px;
}

.promptForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fieldLabel,
.sectionTitle {
  color: #344154;
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  line-height: 1.55;
  padding: 12px;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

textarea:focus {
  border-color: #0f8b6c;
  box-shadow: 0 0 0 3px rgba(15, 139, 108, 0.15);
}

.ratioHeader,
.sectionTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ratioHeader span:last-child {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.ratioGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ratioButton {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #344154;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 120ms ease;
}

.ratioButton:hover {
  transform: translateY(-1px);
}

.ratioButton.isActive {
  border-color: #0f8b6c;
  background: #dff6ef;
  color: #075f4d;
}

.message {
  min-height: 36px;
  border-radius: 8px;
  background: #eef3f8;
  color: #344154;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  padding: 9px 10px;
}

.message.isError {
  background: #fff1f0;
  color: #b42318;
}

.primaryButton,
.iconButton,
.ghostButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
  transition:
    background 120ms ease,
    color 120ms ease,
    opacity 120ms ease,
    transform 120ms ease;
}

.primaryButton {
  width: 100%;
  min-height: 46px;
  background: #0f8b6c;
  color: #ffffff;
  padding: 0 14px;
}

.primaryButton:hover:not(:disabled),
.iconButton:hover,
.ghostButton:hover {
  transform: translateY(-1px);
}

.primaryButton:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.iconButton {
  min-width: 44px;
  min-height: 46px;
  background: #e8edf4;
  color: #344154;
}

.iconButton.compact {
  min-width: 34px;
  min-height: 34px;
}

.ghostButton {
  min-height: 32px;
  background: transparent;
  color: #5c6b80;
  font-size: 12px;
  padding: 0 8px;
}

.recentSection {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
}

.compactRecent {
  flex: 0 0 auto;
}

.emptyState {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #7a8798;
  font-size: 13px;
  font-weight: 700;
}

.recentGrid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.thumbButton {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  padding: 0;
}

.thumbButton img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumbButton span {
  position: absolute;
  right: 7px;
  bottom: 7px;
  border-radius: 999px;
  background: rgba(18, 24, 38, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  padding: 5px 7px;
}

.canvasArea {
  position: fixed;
  inset: 0;
}

.spin {
  animation: spin 900ms linear infinite;
}

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

@media (max-width: 860px) {
  h1 {
    font-size: 21px;
  }

  textarea {
    min-height: 108px;
  }

  .recentGrid {
    overflow: visible;
  }
}

@media (max-width: 520px) {
  .aiContextMenu {
    left: 12px !important;
    width: calc(100vw - 24px);
  }

  .menuHeader {
    align-items: flex-start;
  }

  .modelBadge {
    font-size: 11px;
    padding: 7px 8px;
  }

  .ratioGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recentGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
