:root{
  --bg: #f7f7f9;
  --panel: #ffffff;
  --muted: #667085;
  --fg: #111318;
  --accent: #e60023;
  --secondary: #28354e;
  --border: #e6e8ee;
  --btn: #ffffff;
  --btn-hover: #f2f4f7;
  --shadow: 0 6px 20px rgba(27,31,39,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 10% -10%, rgba(230,0,35,.08), transparent 40%),
              radial-gradient(1000px 600px at 100% 0%, rgba(230,0,35,.06), transparent 45%),
              var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wrap {
  max-width: 1280px;
  margin: 4rem auto;
  padding: 0 16px 4rem;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}
.title {
  font-size: clamp(22px, 3.5vw, 32px);
  margin: 0 0 8px;
  letter-spacing: .2px;
}
.subtitle {
  text-align: left;
  margin: 0 auto;
  max-width: 75ch;
  color: var(--secondary);
}

.subtitle:not(:last-child) {
  margin-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px){
  .grid { grid-template-columns: 1fr; }
}
@media (min-width: 1200px){
  .grid { grid-template-columns: 1.2fr 1fr 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.form {
  padding: 18px;
}
.form label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
}
.form textarea,
.form input[type="text"]{
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  outline: none;
}
.form textarea:focus,
.form input[type="text"]:focus{
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-accent {
  background: var(--accent);
  border: none;
  color: #fff;
}

.btn {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--btn);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: background .2s ease-in-out;
  min-width: 130px;
  text-align: center;
}
.btn:hover { background: var(--btn-hover); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--btn);
}
.btn:disabled:hover { 
  background: var(--btn); 
  transform: none;
}

.error {
  margin-top: 8px;
  color: #ff6b6b;
  font-weight: 600;
  min-height: 1.2em;
}

.panel {
  padding: 16px 16px 20px;
}
.panel h3 {
  margin: 4px 0 10px;
  font-size: 15px;
  color: var(--secondary);
  letter-spacing: .2px;
  text-transform: uppercase;
}
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 96%, #000);
  padding: 12px;
  border-radius: 10px;
  word-break: break-all;
}

#outHtml { max-height: 300px; overflow: auto; }

.stack { display: grid; gap: 12px; }

.preview {
  padding: 16px;
  display: grid;
  place-items: start;
}
.pinit-link { position: relative; display: inline-block; text-decoration: none; }
.pinit-link img { display: block; max-width: 100%; height: auto; border-radius: 12px; }

.pinit-link::before {
  content: "Pin it";
  position: absolute;
  top: 10px; left: 10px;
  display: inline-flex;
  align-items: center; justify-content: center;
  height: 32px; min-width: 32px;
  padding: 0 10px;
  background-color: #bb2729;
  color: #fff;
  font: 600 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  opacity: .92;
  transition: opacity .2s ease-in-out, transform .2s ease-in-out;
  pointer-events: none;
  z-index: 1;
  transform: translateY(0);
}
.pinit-link:hover::before { opacity: 1; transform: translateY(-1px); }

.footer {
  margin: 28px auto 8px;
  text-align: center;
  color: var(--secondary);
  font-size: 13px;
}

.made-by {
  background: rgba(40,53,78,0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  border: 1px solid rgba(40,53,78,0.2);
}

.made-by:hover {
  background: rgba(40,53,78,0.15);
  transform: translateY(-1px);
}

.bottom-buttons {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 1000;
}

/* Like counter styles */
.like-counter {
  text-align: center; 
  margin: 20px 0; 
  font-size: 14px; 
  color: var(--muted);
}

.like-count {
  margin-right: 8px; 
  transition: all 0.2s ease;
}

.like-btn {
  background: none; 
  border: none; 
  cursor: pointer; 
  font-size: 16px; 
  color: var(--accent); 
  padding: 0; 
  margin: 0;
}
