:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #eef0f4;
  --muted: #8b93a3;
  --accent: #c6f432;
  --accent-ink: #141a00;
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Kanit', system-ui, sans-serif;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; background: rgba(15,17,21,.92); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background:
  linear-gradient(135deg, var(--accent) 0 48%, transparent 48% 52%, #6ef0be 52%); }
.games { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.games button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; font-size: 14px;
}
.games button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 24px;
  max-width: 1320px; margin: 0 auto; padding: 20px;
}
.preview { position: sticky; top: 76px; align-self: start; }
.canvas-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; justify-content: center;
}
#poster { width: 100%; max-height: calc(100vh - 200px); object-fit: contain; border-radius: 8px; display: block; }
.preview-bar { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--text); }
.primary {
  margin-left: auto; border: 0; border-radius: 10px; padding: 10px 22px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
}
.primary:disabled { opacity: .6; cursor: progress; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 13px 6px; color: var(--muted); font-size: 15px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.badge { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--panel-2); font-size: 12px; }
.tab { padding: 16px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; cursor: pointer; margin-bottom: 14px;
}
.drop span { color: var(--muted); font-size: 13px; }
.drop.over { border-color: var(--accent); background: rgba(198,244,50,.06); }

.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
input[type=search], .form input, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 11px; font-size: 13px; color: var(--muted);
}
.chips button i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--muted)); margin-right: 6px; }
.chips button.on { color: var(--text); border-color: var(--text); }

.pick-list { max-height: calc(100vh - 330px); min-height: 300px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.hero { margin-bottom: 14px; }
.hero-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; position: sticky; top: 0; background: var(--panel); padding: 4px 0; z-index: 1; }
.hero-head span { color: var(--muted); font-size: 13px; }
.hero-head button { margin-left: auto; border: 0; background: none; color: var(--accent); font-size: 13px; padding: 2px 4px; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.skin {
  position: relative; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: var(--panel-2);
  aspect-ratio: 360 / 502;
}
.skin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.skin .tag {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; line-height: 1.3; padding: 10px 4px 3px;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.skin .tag::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tc, transparent); margin-right: 4px; }
.skin.on { border-color: var(--accent); }
.skin.on::after {
  content: '✓'; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; display: grid; place-items: center;
}

.toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; padding: 6px 11px; font-size: 13px; }
.toolbar .danger { color: var(--danger); margin-left: auto; }
.arrange { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.thumb {
  position: relative; border-radius: 9px; overflow: hidden; background: var(--panel-2); aspect-ratio: 360 / 502;
  border: 2px solid var(--tc, var(--line)); touch-action: none; cursor: grab;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb .num { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.7); border-radius: 6px; padding: 0 5px; }
.thumb button {
  position: absolute; top: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(0,0,0,.65); font-size: 13px; line-height: 22px;
}
.thumb .x { right: 3px; }
.thumb .star { left: 3px; color: #888; }
.thumb .star.on { color: #ffd34d; }
.sortable-ghost { opacity: .35; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.form .wide { grid-column: 1 / -1; }
.form input { color: var(--text); font-size: 15px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 5px 10px 5px 5px; font-size: 13px;
}
.swatches button i { width: 26px; height: 26px; border-radius: 7px; }
.swatches button.on { border-color: var(--accent); }
.form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; grid-column: 1 / -1; }
.form .check input { width: 18px; height: 18px; accent-color: var(--accent); }

.hint { color: var(--muted); font-size: 13px; margin: 10px 0; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 16px 28px; }

/* preview extras */
.ghost { border: 1px solid var(--accent); background: none; color: var(--accent); border-radius: 10px; padding: 10px 16px; font-weight: 600; }
.ghost:disabled { opacity: .6; cursor: progress; }
.preview-bar .primary { margin-left: 0; }
.preview-bar .ghost { margin-left: auto; }
.pager { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.pager button { border: 0; background: var(--panel-2); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; }
.pager span { font-size: 13px; min-width: 56px; text-align: center; }
.share-box { margin-top: 12px; background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; }
.share-box p { margin: 0 0 8px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-row input { flex: 1 1 220px; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.share-row button, .share-row a { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px 14px; color: var(--text); text-decoration: none; font-size: 14px; }

/* arrange options */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.tip { background: rgba(198,244,50,.08); border-radius: 10px; padding: 8px 10px; }
.tip button { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 2px 10px; margin-left: 6px; font-size: 13px; font-weight: 600; }

/* layout icons */
.lay { width: 26px; height: 26px; border-radius: 6px; background: var(--panel-2); position: relative; overflow: hidden; }
.lay::before, .lay::after { content: ''; position: absolute; background: var(--muted); border-radius: 2px; }
.lay-classic::before { left: 3px; right: 3px; top: 3px; height: 7px; }
.lay-classic::after { left: 3px; right: 3px; top: 12px; bottom: 3px; opacity: .45; }
.lay-side::before { left: 3px; top: 3px; bottom: 3px; width: 8px; }
.lay-side::after { left: 13px; right: 3px; top: 3px; bottom: 3px; opacity: .45; }
.lay-minimal::before { left: 3px; right: 3px; top: 4px; height: 2px; }
.lay-minimal::after { left: 3px; right: 3px; top: 9px; bottom: 3px; opacity: .45; }

/* SEO intro */
.about { max-width: 820px; margin: 12px auto 0; padding: 0 20px; color: var(--muted); }
.about h1 { color: var(--text); font-size: 22px; margin: 16px 0 6px; }
.about ol { padding-left: 20px; }
.about b { color: var(--text); }
.about a { color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px; gap: 14px; }
  .preview { position: static; }
  #poster { max-height: none; }
  .canvas-wrap { padding: 8px; }
  .pick-list { max-height: 60vh; }
  .top { padding: 10px 16px; }
  .games { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .games button { white-space: nowrap; }
}
@media (max-width: 520px) {
  .seg button { padding: 7px 8px; font-size: 12px; }
  .preview-bar .primary, .preview-bar .ghost { flex: 1 1 40%; margin-left: 0; }
  .opts { grid-template-columns: 1fr; }
}
.pager[hidden], .share-box[hidden] { display: none; }
