:root { --page-pad: 16px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #111;
  color: #eee;
}

header {
  padding: 12px var(--page-pad);
  border-bottom: 1px solid #222;
}
header h1 { margin: 0; font-size: 18px; }

main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--page-pad);
  padding: var(--page-pad);
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

.panel {
  background: #151515;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 12px;
}

label { display: block; font-size: 12px; opacity: .8; margin: 10px 0 6px; }

textarea, input[type="number"], select, input[type="color"], input[type="text"] {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
  background: #0f0f0f;
  color: #eee;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  font-size: 14px;
}
.checkbox input { width: 16px; height: 16px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
button {
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
  background: #1b1b1b;
  color: #eee;
  cursor: pointer;
}
button.primary { background: #3a68ff; border-color: #3a68ff; color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

.previewGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 10px;
}
.card { background: #101010; border: 1px solid #222; border-radius: 8px; padding: 8px; }
.thumb { width: 100%; aspect-ratio: 4 / 5; display: block; border-radius: 6px; object-fit: cover; background: #fff; }
.meta { font-size: 12px; opacity: .75; margin-top: 6px; display: flex; justify-content: space-between; }

.small { font-size: 12px; opacity: .85; }
.subtle { font-size: 11px; opacity: .65; margin-top: 6px; }

.divider { border: 0; border-top: 1px solid #222; margin: 12px 0; }
.nested {
  padding: 10px;
  margin-top: 6px;
  border: 1px dashed #2a2a2a;
  border-radius: 8px;
  background: #131313;
}

.hidden { display: none !important; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 6px; align-items: center;
}
.toolbar .sep { width: 1px; height: 22px; background: #2a2a2a; margin: 0 2px; }
.toolbar button {
  padding: 6px 10px; font-size: 13px; line-height: 1;
  background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px;
}
.toolbar button:active { transform: translateY(1px); }

.stack { display: flex; flex-direction: column; gap: 10px; }

.labelBlock { display: flex; flex-direction: column; gap: 6px; }

.labelOptions { display: flex; gap: 8px; }
.labelOptions select,
.labelOptions input { flex: 1; }

textarea {
  resize: both;
  min-height: 400px;
  min-width: 250px;
  padding-bottom: 20px;
}
textarea::-webkit-resizer { width: 50px; height: 50px; }

.top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0 8px;
  position: relative;
}
#btnGenerateTop {
  background: #3a68ff;
  border: none;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  color: #fff;
  border-radius: 4px;
}
#btnGenerateTop:hover { 
  background: #2c5ce6; 
  color: #fff; 
}

#btnClearText {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  color: #bbb;
}
#btnClearText:hover { color: #fff; }

.settings {
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 8px 12px 12px;
  background: #121212;
  margin-top: 10px;
}
.settings > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.settings > summary::before {
  content: '▾';
  transition: transform .2s;
}
.settings[open] > summary::before { transform: rotate(0deg); }
.settings:not([open]) > summary::before { transform: rotate(-90deg); }
.settings:not([open]) { padding-bottom: 8px; }

.share-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 15px;
  background: #1a73e8;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  cursor: pointer;
}
.share-fab[disabled] { opacity: .5; cursor: not-allowed; }

@media (max-width: 560px) {
  .share-fab {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
  }
}
