:root{
  --bg:#0b0e14;
  --panel:#121827;
  --panel2:#0f1422;
  --text:#e8eefc;
  --muted:#a9b4d0;
  --line:rgba(255,255,255,.12);
  --accent:#7aa2ff;
  --danger:#ff6b6b;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: radial-gradient(1200px 800px at 10% 0%, #141a2d 0%, var(--bg) 55%);
  color:var(--text);
}

header{
  padding:18px 18px 10px;
  display:flex;
  align-items:center;
  gap:12px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  position:sticky;
  top:0;
  z-index:5;
  backdrop-filter: blur(10px);
}

header h1{
  margin:0;
  font-size:16px;
  letter-spacing:.2px;
}

header .tag{
  font-size:12px;
  color:var(--muted);
  padding:4px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background: rgba(255,255,255,.03);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 70vw;
}

main{
  padding:16px;
  display:grid;
  grid-template-columns: 1.6fr 1fr;
  gap:14px;
  max-width:1100px;
  margin:0 auto;
}

@media (max-width: 920px){
  main{ grid-template-columns: 1fr; }
  header .tag{ max-width: 92vw; }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

.card .head{
  padding:12px 14px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  border-bottom:1px solid var(--line);
  background: rgba(0,0,0,.08);
}

.card .head .title{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width: 220px;
}

.card .head .title strong{
  font-size:13px;
  letter-spacing:.2px;
}

.card .head .title span{
  font-size:12px;
  color:var(--muted);
  line-height: 1.5;
}

.card .body{ padding:14px; }

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.btn{
  appearance:none;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
  font-size:13px;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}

.btn:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.18);
}

.btn:active{ transform: translateY(1px); }

.btn.primary{
  border-color: rgba(122,162,255,.45);
  background: rgba(122,162,255,.12);
}

.btn.danger{
  border-color: rgba(255,107,107,.45);
  background: rgba(255,107,107,.10);
}

.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.selectBtn{
  padding:8px 10px;
  line-height: 1;
}

.hint{
  font-size:12px;
  color:var(--muted);
  line-height:1.55;
}

.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:11px;
  padding:2px 6px;
  border:1px solid var(--line);
  border-bottom-color: rgba(255,255,255,.22);
  border-radius:8px;
  background: rgba(0,0,0,.18);
  color: var(--text);
  display:inline-block;
  margin:0 2px;
}

.pill{
  font-size:12px;
  color: var(--muted);
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background: rgba(255,255,255,.03);
}

.small{
  font-size:12px;
  color:var(--muted);
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  color: var(--text);
  opacity:.95;
  white-space: nowrap;
}

.controls{
  display:grid;
  gap:10px;
}

.controlLine{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background: rgba(0,0,0,.10);
}

.controlLine label{
  font-size:12px;
  color:var(--muted);
  min-width: 9.5em;
}

.controlLine input[type="range"]{
  width: 55%;
  accent-color: var(--accent);
}

.controlLine input[type="color"]{
  width: 44px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
}

.canvasWrap{
  position:relative;
  width:100%;
  aspect-ratio: 1.25 / 1;
  background: rgba(0,0,0,.14);
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
}

canvas#editor{
  width:100%;
  height:100%;
  display:block;
  touch-action: none;
  background: transparent;
}

.dropOverlay{
  position:absolute;
  inset:0;
  display:none;
  place-items:center;
  background: rgba(122,162,255,.12);
  border:2px dashed rgba(122,162,255,.55);
  color: var(--text);
  font-size:14px;
  letter-spacing:.2px;
  z-index:3;
}

.dropOverlay.show{ display:grid; }

.previews{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}

@media (max-width: 520px){
  .previews{ grid-template-columns: 1fr; }
}

.prevBox{
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background: rgba(0,0,0,.10);
}

.prevTop{
  padding:8px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  background: rgba(0,0,0,.08);
  font-size:12px;
  color:var(--muted);
}

canvas.preview{
  width:100%;
  aspect-ratio: 1/1;
  display:block;
  background: transparent;
}

.footerNote{
  font-size:12px;
  color: var(--muted);
  border-top:1px solid var(--line);
  padding:12px 14px;
  background: rgba(0,0,0,.07);
}

a{ color:var(--accent); }

@media (max-width: 920px){
  .card .head{
    align-items:flex-start;
  }
}
