:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand h1 { margin: 0; font-size: 1.35rem; color: var(--accent-dark); }
.brand .subtitle { display: block; font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Layout ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  width: 100%;
  flex: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; font-size: 1.1rem; }
.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-status { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.35); outline-offset: 2px; }
.btn-ghost {
  background: transparent;
  color: var(--accent-dark);
  border-color: var(--border);
}
.btn-ghost:hover { background: #f0fdfa; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-danger { border-color: var(--danger); background: #fff; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }

/* ---------- Texto ---------- */
.case-text {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.98rem;
  font-family: inherit;
  line-height: 1.65;
  background: #fbfdff;
  color: var(--text);
}
.case-text:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-size: 0.8rem; color: var(--text-muted); margin: 10px 0 0; }

/* ---------- Upload ---------- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
  background: #fafcfe;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.drop-zone.dragover { border-color: var(--accent); background: #f0fdfa; }
.drop-zone .drop-icon { font-size: 1.6rem; margin: 0 0 4px; }
.drop-zone .linklike { color: var(--accent); text-decoration: underline; }
.drop-zone:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.35); outline-offset: 2px; }

.upload-status { margin-top: 12px; font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Galeria ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.figure img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #0f172a;
  display: block;
}
.figure .meta {
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}
.figure .actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}
.figure .actions .btn { flex: 1; text-align: center; text-decoration: none; }
.empty-gallery { color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 18px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s;
  max-width: 90vw;
  text-align: center;
  z-index: 50;
}
.toast.show { opacity: 1; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ---------- Responsivo (mobile) ---------- */
@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .btn-copy-link { width: 100%; }
  .section-head { flex-direction: column; align-items: stretch; }
  .status-row { justify-content: space-between; }
  .card { padding: 16px; }
  .gallery { grid-template-columns: 1fr; }
}
