:root {
  --bg: #f7f5f0;
  --panel: #fffefa;
  --ink: #111111;
  --muted: #5f625d;
  --line: #e3dfd6;
  --chip: #ebe8df;
  --accent: #c9673f;
  --accent-dark: #a74e2d;
  --danger: #c83d4d;
  --shadow: 0 18px 50px rgba(22, 20, 16, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans KR", system-ui, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.import-button,
.prompt-card,
.drop-zone {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hidden {
  display: none !important;
}

.container {
  width: min(1288px, calc(100% - 48px));
  margin: 0 auto;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #121212;
}

.login-panel {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: #1b1b1b;
  color: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
}

.lock-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: #fff;
}

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

.login-panel h1 {
  margin: 0;
  font-size: 38px;
}

.login-copy {
  margin: 10px 0 24px;
  color: #c7c7c7;
  line-height: 1.7;
}

.login-form,
.prompt-form,
.edit-dialog form {
  display: grid;
  gap: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 168px;
  padding: 15px;
  resize: vertical;
  line-height: 1.7;
}

.login-form input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 103, 63, 0.12);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: #ff9baa;
  font-size: 13px;
}

.primary-button,
.soft-button,
.copy-button,
.danger-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

.primary-button,
.copy-button {
  border: 0;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.copy-button:hover {
  background: var(--accent-dark);
}

.soft-button,
.download-button {
  border: 1px solid var(--line);
  padding: 0 13px;
  background: rgba(255, 254, 250, 0.86);
  color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(200, 61, 77, 0.28);
  padding: 0 16px;
  background: rgba(200, 61, 77, 0.08);
  color: var(--danger);
}

.site-shell {
  min-height: 100vh;
}

.hero {
  padding: 16px 0 64px;
  border-bottom: 1px solid var(--line);
}

.utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.utility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-button {
  position: relative;
  overflow: hidden;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.hero h1 {
  max-width: 980px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
}

.hero-copy {
  margin: 20px 0 36px;
  color: #535650;
  font-size: 19px;
  line-height: 1.7;
}

.search-box {
  position: relative;
  display: block;
  width: min(516px, 100%);
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 13px;
  color: #676a64;
}

.search-box input {
  height: 48px;
  padding-left: 44px;
}

.type-tabs {
  display: inline-flex;
  gap: 6px;
  margin-top: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 254, 250, 0.76);
}

.type-tab {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  background: transparent;
  color: #464943;
  font-weight: 800;
}

.type-tab.active {
  background: var(--ink);
  color: #fff;
}

.composer-panel {
  margin-top: 32px;
  margin-bottom: 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer-head,
.form-actions,
.list-toolbar,
.dialog-header,
.prompt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.composer-head h2,
.composer-head p,
.prompt-title-row h3 {
  margin: 0;
}

.composer-head p {
  margin-top: 6px;
  color: var(--muted);
}

.icon-button,
.detail-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
}

.prompt-kind-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.prompt-kind-control label {
  display: block;
}

.prompt-kind-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.prompt-kind-control span {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefa;
  color: #454943;
  font-weight: 900;
}

.prompt-kind-control input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.drop-zone {
  position: relative;
  min-height: 370px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed #cdc7bb;
  border-radius: 12px;
  background: #f2f0eb;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #fff6ef;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.drop-zone img {
  width: 100%;
  height: 100%;
  min-height: 370px;
  object-fit: contain;
  background: #f2f0eb;
}

.drop-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
}

.drop-empty svg {
  width: 44px;
  height: 44px;
}

.drop-empty strong {
  color: var(--ink);
}

.field-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.form-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.category-bar {
  padding: 36px 0 28px;
}

.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 254, 250, 0.6);
}

.tag-filter {
  flex: 0 0 auto;
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  background: transparent;
  color: #393c37;
  font-weight: 500;
}

.tag-filter.active {
  border: 1px solid var(--line);
  background: #fffefa;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(20, 18, 14, 0.04);
}

.tag-filter small {
  margin-left: 5px;
  color: #555a53;
  font-weight: 500;
}

.list-toolbar {
  margin-bottom: 20px;
}

.list-toolbar strong {
  color: var(--muted);
}

.list-toolbar select {
  width: 132px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 24px;
  padding-bottom: 72px;
}

.prompt-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #e9e4da;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(24, 22, 18, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-kind {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(17, 17, 17, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.card-kind.video {
  background: rgba(201, 103, 63, 0.9);
}

.prompt-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(24, 22, 18, 0.1);
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e8e3d9;
}

.card-body {
  padding: 16px 18px 18px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 13px;
}

.card-tags span,
.detail-tags span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chip);
  color: #3f413d;
  font-size: 12px;
  font-weight: 800;
}

.prompt-card h3 {
  margin: 0 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.45;
}

.card-prompt {
  display: -webkit-box;
  min-height: 48px;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #696b66;
  font-size: 14px;
  line-height: 1.7;
}

.empty-state {
  padding: 86px 0;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.detail-dialog,
.edit-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.detail-dialog {
  width: min(1000px, calc(100% - 32px));
}

.edit-dialog {
  width: min(620px, calc(100% - 32px));
}

.detail-dialog::backdrop,
.edit-dialog::backdrop {
  background: rgba(20, 19, 16, 0.35);
  backdrop-filter: blur(2px);
}

.detail-content,
.edit-dialog form {
  position: relative;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.28);
}

.detail-content {
  padding: 22px;
}

.detail-close {
  position: absolute;
  top: 24px;
  right: 22px;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
}

.detail-header {
  padding-right: 52px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-kind {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.detail-header h2 {
  margin: 0 0 18px;
  font-size: clamp(22px, 3vw, 30px);
}

.detail-image-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  overflow: hidden;
  border-radius: 8px;
  background: #f1efea;
}

.detail-image-frame img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.download-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 34px;
  font-size: 13px;
}

.prompt-detail {
  margin-top: 28px;
}

.prompt-title-row {
  margin-bottom: 12px;
}

.prompt-title-row h3 {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.copy-button {
  min-height: 40px;
}

.prompt-detail pre {
  max-height: 320px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: keep-all;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  color: #111;
  font-family: "Noto Sans KR", Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.edit-dialog form {
  padding: 22px;
}

.dialog-header h3 {
  margin: 0;
}

@media (max-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 28px, 1288px);
  }

  .hero {
    padding-bottom: 44px;
  }

  .utility-row,
  .composer-head,
  .form-actions,
  .prompt-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .utility-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .field-grid,
  .gallery {
    grid-template-columns: 1fr;
  }

  .drop-zone,
  .drop-zone img {
    min-height: 280px;
  }

  .detail-content {
    padding: 18px;
  }

  .detail-close {
    top: 18px;
    right: 18px;
  }

  .detail-image-frame {
    min-height: 280px;
  }
}
