:root{
  --bg:#ffffff;
  --fg:#111827;
  --muted:#6b7280;
  --card:#f9fafb;
  --border:#e5e7eb;
  --primary:#2563eb;
  --primaryFg:#ffffff;
  --danger:#dc2626;
}
[data-theme="dark"]{
  --bg:#0b1220;
  --fg:#e5e7eb;
  --muted:#9ca3af;
  --card:#0f172a;
  --border:#1f2937;
  --primary:#3b82f6;
  --primaryFg:#0b1220;
  --danger:#f87171;
}
*{ box-sizing:border-box; }
body{
  margin:0;
  background:var(--bg);
  color:var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}
header{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  padding: 8px 0 14px 0;
}
.title{
  display:flex;
  flex-direction:column;
  gap:4px;
}
h1{
  font-size: 18px;
  margin:0;
  line-height: 1.2;
}
.sub{
  font-size: 13px;
  color: var(--muted);
}
.controls{
  display:flex;
  gap:8px;
  align-items:center;
}
select, button{
  border:1px solid var(--border);
  background:var(--card);
  color:var(--fg);
  border-radius:10px;
  padding:10px 12px;
  font-size:14px;
}
button.primary{
  border-color: transparent;
  background: var(--primary);
  color: var(--primaryFg);
  font-weight: 600;
}
button.secondary{
  border-color: var(--border);
  background: transparent;
}
button:disabled{
  opacity: 0.6;
}
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 880px){
  .grid{
    grid-template-columns: 1.05fr 0.95fr;
    align-items:start;
  }
}
.card{
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
}
textarea{
  width: 100%;
  min-height: 290px;
  resize: vertical;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.45;
  outline: none;
}
.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  margin-top: 10px;
}
.actions{
  display:flex;
  gap:8px;
  align-items:center;
}
.hint{
  color: var(--muted);
  font-size: 13px;
}
.error{
  color: var(--danger);
  font-size: 13px;
  white-space: pre-wrap;
}
.images{
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.viewer{
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  overflow:hidden;
  min-height: 220px;
}
.viewer img{
  width:100%;
  height:auto;
  display:block;
}
