.room-ai [hidden] {
  display: none !important;
}

.room-ai .page-head {
  padding-bottom: clamp(14px, 3vw, 34px);
}

.room-ai-workspace {
  padding-top: 0;
}

.room-ai-form,
.room-ai-result,
.room-ai-help .wrap {
  max-width: 820px;
  margin-inline: auto;
}

.room-ai-form {
  min-width: 0;
  padding: clamp(16px, 4vw, 32px);
}

.room-ai-mode {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
  min-width: 0;
}

.room-ai-mode legend {
  margin-bottom: 9px;
  padding: 0;
  font-weight: 800;
}

.room-ai-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: #e9ece4;
  border-radius: 16px;
}

.room-ai-options label {
  position: relative;
  min-width: 0;
}

.room-ai-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.room-ai-options span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
}

.room-ai-options input:checked + span {
  background: var(--lime);
}

.room-ai-options input:focus-visible + span,
.room-ai :is(input[type="file"], select, textarea, summary, a, button):focus-visible {
  outline: 2px solid #526700;
  outline-offset: 3px;
}

.room-ai-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.room-ai-form .field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 7px;
}

.room-ai-wide {
  grid-column: 1 / -1;
}

.room-ai-form textarea,
.room-ai-form select,
.room-ai-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  font-size: max(16px, 1rem);
}

.room-ai-form textarea {
  min-height: 116px;
  padding: 12px;
  resize: vertical;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d7dcd1;
  border-radius: 14px;
  line-height: 1.5;
}

.room-ai-form input[type="file"] {
  padding: 8px;
  background: #fff;
  border: 1px dashed #9ca68e;
  border-radius: 12px;
}

.room-ai-form input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: var(--lime);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.room-ai-form .hint {
  color: #555b4f;
  line-height: 1.45;
}

.room-ai-consent {
  display: flex;
  gap: 9px;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  margin-top: 12px;
  cursor: pointer;
  font-weight: 600;
}

.room-ai-consent input {
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #526700;
}

.room-ai-privacy {
  margin: 0 0 18px;
}

.room-ai-submit {
  min-height: 46px;
  max-width: 100%;
  justify-content: center;
  text-align: center;
}

.room-ai-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.room-ai-submit[data-generating] {
  opacity: 1;
  background: #e4f6ae;
  cursor: progress;
}

.room-ai-message {
  margin: 12px 0 6px;
  color: #404739;
  line-height: 1.45;
}

.room-ai-message:empty {
  display: none;
}

.room-ai-message[data-error] {
  color: #8e2a20;
}

.room-ai-wait {
  margin-top: 9px;
}

.room-ai-wait-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #dee5d2;
}

.room-ai-wait-track::before {
  display: block;
  width: 36%;
  height: 100%;
  border-radius: inherit;
  background: #6b8b1c;
  content: "";
  animation: room-ai-wait-sweep 1.8s ease-in-out infinite alternate;
}

@keyframes room-ai-wait-sweep {
  from { transform: translateX(0); }
  to { transform: translateX(175%); }
}

@media (prefers-reduced-motion: reduce) {
  .room-ai-wait-track::before {
    animation: none;
  }
}

.room-ai-wait-time {
  margin: 7px 0 0;
  color: #404739;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.room-ai-limit {
  margin: 12px 0 0;
}

.room-ai figure {
  margin: 0;
}

.room-ai figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
  background: var(--soft);
}

.room-ai #room-ai-preview img {
  max-width: 220px;
  max-height: 170px;
}

.room-ai-result {
  margin-top: 24px;
  scroll-margin-top: 85px;
}

.room-ai-result figure {
  margin-bottom: 14px;
}

.room-ai-result figure img {
  max-height: min(70vh, 780px);
}

.room-ai-help details {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.room-ai-help summary {
  cursor: pointer;
  font-weight: 750;
}

.room-ai-help details a {
  text-decoration: underline;
}

@media (max-width: 405px) {
  .room-ai-form .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 550px) {
  .room-ai-submit {
    width: 100%;
  }
}
