:root {
  color: #1c1917;
  background: #f6f4f1;
  font-family: Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, .button {
  border: 0;
  border-radius: 8px;
  background: #9f1239;
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.ghost { background: transparent; color: #1c1917; border: 1px solid #d6d3d1; }
.danger { background: #44403c; }
button:disabled { opacity: 0.55; cursor: wait; }
label { display: grid; gap: 6px; font-size: 14px; }
input, textarea, select {
  width: 100%;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: inherit;
}
textarea { resize: vertical; }
.muted, .hint { color: #57534e; font-size: 13px; }
.error { color: #9f1239; font-size: 14px; }
.eyebrow { letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: #9f1239; margin: 0; }
h1, h2 { font-weight: 600; margin: 0; }
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card, dialog {
  width: min(440px, 100%);
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(28, 25, 23, 0.08);
}
.card form, #login-form, #settings-form, #generate-form { display: grid; gap: 14px; }
#studio {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 380px 1fr;
}
aside {
  border-right: 1px solid #e7e5e4;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #fbfaf8;
}
aside header { display: grid; gap: 6px; }
aside footer, .row { display: flex; gap: 8px; flex-wrap: wrap; }
.board { padding: 24px; }
.board-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 16px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tile {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #eee; display: block; }
.tile div { padding: 10px 12px 12px; display: grid; gap: 4px; }
.tile strong { font-size: 13px; font-weight: 600; }
.file-list, .refs { display: flex; gap: 8px; flex-wrap: wrap; }
.file-list img, .refs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #e7e5e4; }
.viewer-top { margin: 0 0 12px; }
.viewer-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: calc(100% - 24px);
}
#viewer { width: min(920px, calc(100vw - 32px)); position: relative; padding-top: 58px; }
#viewer-image { width: 100%; max-height: 68vh; object-fit: contain; background: #f5f5f4; border-radius: 12px; display: block; }
#viewer-meta { margin: 0; }
#viewer-prompt { white-space: pre-wrap; margin: 10px 0 0; }
#viewer-prompt.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 2.8em;
}
#viewer-refs { margin-top: 10px; }
@media (max-width: 860px) {
  #studio { grid-template-columns: 1fr; }
  aside { border-right: 0; border-bottom: 1px solid #e7e5e4; }
  .viewer-top { margin: 0 0 12px; }
  .viewer-actions { position: static; max-width: none; justify-content: flex-end; }
}
