 :root {
  --bg: #f6f0e5;
  --panel: #fffaf1;
  --ink: #202020;
  --muted: #70695d;
  --line: #d9c9aa;
  --gold: #b08a2e;
  --dark: #111;
  --green: #183a2e;
  --red: #b23a34;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fffaf1 0, var(--bg) 45%, #efe4cf 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 240, 229, 0.94);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 800;
  font-size: 12px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 6px;
  letter-spacing: -0.04em;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 0.95;
}

.subhead {
  margin-bottom: 0;
  color: var(--muted);
  max-width: 720px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

button {
  appearance: none;
  border: 1px solid var(--dark);
  background: var(--dark);
  color: white;
  padding: 10px 13px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

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

button.ghost {
  color: var(--dark);
  background: transparent;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 22px;
  padding: 22px;
}

.sidebar {
  position: sticky;
  top: 128px;
  height: calc(100vh - 150px);
  overflow: auto;
}

.panel {
  background: rgba(255, 250, 241, 0.78);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 12px 30px rgba(55, 42, 20, 0.07);
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.favorite-label {
  font-weight: 900;
  color: var(--green);
}

.hint, .criteria {
  color: var(--muted);
  font-size: 14px;
}

.criteria {
  padding-left: 18px;
  line-height: 1.7;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 241, 0.86);
  box-shadow: 0 18px 42px rgba(55, 42, 20, 0.10);
}

.card.favorite {
  outline: 4px solid rgba(176, 138, 46, 0.35);
}

.card-image-wrap {
  position: relative;
  background: #eee;
  border-bottom: 1px solid var(--line);
}

.concept-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
}

.fav-pill {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--gold);
  color: white;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card.favorite .fav-pill { display: inline-block; }

.card-body { padding: 16px; }

.card-title-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.favorite-btn {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--green);
  border-color: var(--green);
}

.card.favorite .favorite-btn {
  background: var(--gold);
  border-color: var(--gold);
}

.scores {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.score {
  padding: 0;
  accent-color: var(--gold);
}

.score-total {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f1e4ca;
  font-weight: 800;
}

.notes-label { margin-top: 8px; }

dialog {
  width: min(94vw, 1200px);
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: #111;
  color: white;
  box-shadow: 0 20px 90px rgba(0,0,0,.5);
}

dialog::backdrop { background: rgba(0,0,0,.72); }

dialog img {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

dialog p {
  padding: 14px 18px 18px;
  margin: 0;
  font-weight: 800;
}

.close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0,0,0,.66);
  font-size: 26px;
  line-height: 1;
}

@media (max-width: 900px) {
  .topbar, .layout { display: block; }
  .actions { justify-content: flex-start; margin-top: 14px; }
  .sidebar { position: static; height: auto; }
  .toolbar { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar, .toolbar, button, dialog { display: none !important; }
  .layout { display: block; padding: 0; }
  .grid { grid-template-columns: 1fr; }
  .card { break-inside: avoid; box-shadow: none; margin-bottom: 18px; }
  .concept-image { aspect-ratio: auto; max-height: 540px; object-fit: contain; }
  textarea { border: 1px solid #999; min-height: 90px; }
}
