:root {
  --bg: #fbf6f0;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #8a7d75;
  --line: #ece2d8;
  --wine: #8c2222;
  --wine-dark: #6d1a1a;
  --star: #e8a317;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 35, 20, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.req { color: var(--wine); }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .7rem 1rem;
  background: var(--wine);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; min-width: 0; }
.brand-icon { font-size: 1.5rem; }
.brand-text {
  font-family: Georgia, serif; font-size: 1.15rem; font-weight: 700; line-height: 1.05;
  display: flex; flex-direction: column;
}
.brand-text small { font-size: .68rem; font-weight: 400; opacity: .8; font-family: inherit; letter-spacing: .04em; }
.topbar nav { display: flex; gap: .4rem; flex-shrink: 0; }

.wrap { max-width: 900px; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* ── Botones ────────────────────────────────────────── */
.btn {
  display: inline-block; padding: .55rem .9rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer;
  font-family: inherit;
}
.wrap .btn, .form .btn {
  background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.btn-primary, .wrap .btn-primary { background: #fff; color: var(--wine); border-color: transparent; }
.wrap .btn-primary, .form .btn-primary { background: var(--wine); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-block { display: block; width: 100%; text-align: center; padding: .85rem; font-size: 1rem; }
.wrap .btn-danger { background: #fff; color: #b03030; border-color: #f0c9c9; }

.mini {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: .2rem .5rem; font-size: .75rem; cursor: pointer; font-family: inherit;
}
.mini-danger { color: #b03030; border-color: #f0c9c9; }

.chip {
  display: inline-block; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: .82rem; text-decoration: none;
}
.chip.on { background: var(--wine); color: #fff; border-color: var(--wine); }

.alert {
  background: #fdecec; border: 1px solid #f3c9c9; color: #8c2222;
  padding: .7rem .9rem; border-radius: 12px; margin-bottom: 1rem; font-size: .92rem;
}

/* ── Estrellas ──────────────────────────────────────── */
.stars {
  position: relative; display: inline-block; white-space: nowrap;
  line-height: 1; letter-spacing: .08em; vertical-align: middle;
}
.stars-bg { color: #ddd2c6; }
.stars-fg {
  position: absolute; top: 0; left: 0; overflow: hidden;
  color: var(--star); white-space: nowrap;
}
.puntaje { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.puntaje b { font-size: .95em; }
.puntaje small { color: var(--muted); font-size: .78rem; }

/* ── Listado ────────────────────────────────────────── */
.listado-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.listado-head h1 { margin: 0; font-size: 1.35rem; }
.orden { display: flex; gap: .35rem; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; display: block;
  border: 1px solid var(--line);
}
.card:active { transform: scale(.995); }
.card-foto { position: relative; aspect-ratio: 16 / 10; background: #f0e7dd; }
.card-foto img { width: 100%; height: 100%; object-fit: cover; }
.sin-foto { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.5rem; opacity: .35; }
.badge-nota {
  position: absolute; top: .6rem; right: .6rem;
  background: rgba(20, 12, 8, .78); color: #fff; backdrop-filter: blur(4px);
  padding: .2rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
}
.badge-nota::before { content: "★ "; color: var(--star); }
.badge-fotos {
  position: absolute; bottom: .6rem; right: .6rem;
  background: rgba(20, 12, 8, .6); color: #fff;
  padding: .15rem .5rem; border-radius: 999px; font-size: .72rem;
}
.card-body { padding: .8rem .9rem 1rem; }
.card-body h2 { margin: 0 0 .3rem; font-size: 1.15rem; }
.dir { margin: .45rem 0 0; font-size: .85rem; color: var(--muted); }
.desc {
  margin: .4rem 0 0; font-size: .9rem; color: #5c5049;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.vacio { text-align: center; padding: 3rem 1rem; }
.vacio-icon { font-size: 3.5rem; }
.vacio h1 { margin-top: .6rem; }
.vacio .btn { margin-top: 1.2rem; }

/* ── Login ──────────────────────────────────────────── */
.login { display: flex; justify-content: center; padding-top: 8vh; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem 1.5rem; max-width: 380px; width: 100%; text-align: center;
}
.login-icon { font-size: 3rem; }
.login-card h1 { font-size: 1.4rem; margin: .5rem 0 .3rem; }
.login-card p { font-size: .9rem; margin: 0 0 1.2rem; }
.login-card input {
  width: 100%; padding: .85rem; font-size: 1.1rem; text-align: center; letter-spacing: .3em;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: .8rem; font-family: inherit;
  background: #fdfaf7;
}

/* ── Formularios ────────────────────────────────────── */
.page-title { margin-bottom: 1rem; }
.form { display: flex; flex-direction: column; gap: 1rem; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .8rem;
}
.panel > .muted { margin: -.4rem 0 0; font-size: .85rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; }
.form label > span:first-child { color: #5c5049; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: .7rem .8rem; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 12px; background: #fdfaf7; color: var(--ink);
  font-weight: 400;
}
input:focus, textarea:focus { outline: 2px solid rgba(140, 34, 34, .35); outline-offset: 1px; }
textarea { resize: vertical; }

.nota-puntaje { text-align: center; margin: -.3rem 0 0; }

.file-drop {
  display: block; border: 2px dashed #e0d3c6; border-radius: 12px; padding: 1rem;
  text-align: center; background: #fdfaf7; cursor: pointer; font-weight: 600; color: var(--muted);
}
.file-drop input { display: none; }
.previews { display: flex; gap: .5rem; flex-wrap: wrap; }
.previews img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line);
}
.previews .is-portada { outline: 3px solid var(--star); outline-offset: -3px; }

/* ── Star input ─────────────────────────────────────── */
.star-input { display: flex; align-items: center; gap: .6rem; }
.star-input-stars {
  position: relative; font-size: 2rem; line-height: 1; letter-spacing: .08em;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.star-input-value { font-weight: 700; font-size: 1.05rem; min-width: 2.2ch; }

/* ── Detalle ────────────────────────────────────────── */
.detalle { display: flex; flex-direction: column; gap: 1.2rem; }
.galeria { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.galeria-main { aspect-ratio: 4 / 3; }
.galeria-main img { width: 100%; height: 100%; object-fit: contain; background: #12100f; cursor: zoom-in; }
.galeria-thumbs { display: flex; gap: .35rem; padding: .35rem; overflow-x: auto; background: #1c1917; }
.galeria-thumbs .thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 auto;
  opacity: .55; cursor: pointer;
}
.galeria-thumbs .thumb.on { opacity: 1; outline: 2px solid var(--star); outline-offset: -2px; }

.detalle-head h1 { font-size: 1.75rem; margin-bottom: .4rem; }
.detalle-nota { margin-bottom: .3rem; }
.detalle-desc { white-space: pre-wrap; margin: 0; color: #4b423d; }

.fotos-admin { display: flex; flex-wrap: wrap; gap: .6rem; }
.fa-item {
  position: relative; width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
}
.fa-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.fa-item form { margin: 0; }
.fa-portada { font-size: .72rem; color: var(--star); font-weight: 700; }
.fa-item .mini-danger { position: absolute; top: .25rem; right: .25rem; padding: .1rem .38rem; }

.review { border-top: 1px solid var(--line); padding: .7rem 0 .2rem; }
.review:first-of-type { border-top: none; }
.review-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: .9rem; }
.review-nota { font-weight: 700; }
.review-fecha { color: var(--muted); font-size: .78rem; margin-left: auto; }
.review-head form { margin: 0; }
.review p { margin: .3rem 0 .2rem; color: #4b423d; white-space: pre-wrap; }

.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .93);
  display: flex; align-items: center; justify-content: center; padding: 1rem; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

.pie {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 900px; margin: 0 auto; padding: 1rem;
  font-size: .8rem; color: var(--muted);
}
.pie a { color: var(--muted); }
