/* Ember War Admin - RO classic look (white windows, light title bars with a blue ball, pill buttons) */
:root {
  --bg-top: #141826; --bg-bottom: #3B1F1A;
  --win-border: #8C8C8C; --title-top: #FAFAFA; --title-bottom: #DCDCDC; --title-line: #B4B4B4;
  --btn-top: #FFFFFF; --btn-bottom: #E2E2E2; --btn-border: #9E9E9E;
  --hover-bottom: #D9E8F8; --hover-border: #6E9BCB;
  --text: #1F1F1F; --muted: #6B7280; --field: #A8A8A8; --accent: #2563EB;
  --ember-top: #F6A06A; --ember-bottom: #D9541E; --ember-border: #8A2E0C;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 13px Tahoma, "Leelawadee UI", "Segoe UI", "Noto Sans Thai", sans-serif;
  background: linear-gradient(var(--bg-top), var(--bg-bottom)) fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 18px 20px 40px; }
header.top { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.logo { font: bold 34px Georgia, "Times New Roman", serif; color: #FFB15C; letter-spacing: 1px;
  text-shadow: -2px -2px 0 #5A1E0E, 2px -2px 0 #5A1E0E, -2px 2px 0 #5A1E0E, 2px 2px 0 #5A1E0E; }
.sub { color: #E8E1D0; margin-bottom: 6px; }
.spacer { flex: 1; }
nav.tabs { display: flex; gap: 4px; margin-bottom: -1px; position: relative; z-index: 1; }
nav.tabs a {
  padding: 6px 16px; background: #E9E9E9; border: 1px solid #BDBDBD; border-bottom: none;
  border-radius: 4px 4px 0 0; color: var(--text);
}
nav.tabs a.on { background: #fff; border-color: #9E9E9E; font-weight: bold; }
nav.tabs a:hover { text-decoration: none; background: #F4F8FD; }

/* RO window */
.win { background: #fff; border: 1px solid var(--win-border); border-radius: 3px;
  box-shadow: 2px 3px 8px rgba(0,0,0,.35); margin-bottom: 16px; overflow: hidden; }
.win > .title {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  background: linear-gradient(var(--title-top), var(--title-bottom)); border-bottom: 1px solid var(--title-line);
}
.win > .title::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 40% 30%, #fff 0 18%, #93C5FD 30%, #2563EB 75%); border: 1px solid #1E3A8A;
}
.win > .body { padding: 12px; }
.win > .bottom { background: #EFEFEF; border-top: 1px solid #C8C8C8; padding: 6px 10px; display: flex; gap: 6px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* pill buttons */
.btn, button {
  display: inline-block; font: inherit; color: var(--text); cursor: pointer; padding: 4px 16px; min-height: 24px;
  background: linear-gradient(var(--btn-top), var(--btn-bottom)); border: 1px solid var(--btn-border); border-radius: 12px;
}
.btn:hover, button:hover { background: linear-gradient(#fff, var(--hover-bottom)); border-color: var(--hover-border); text-decoration: none; }
.btn:active, button:active { background: linear-gradient(#D6D6D6, #EDEDED); }
.btn.small, button.small { padding: 1px 10px; min-height: 20px; font-size: 12px; }
.btn.ember, button.ember { color: #fff; font-weight: bold; text-shadow: 0 1px 1px #7C2D12;
  background: linear-gradient(var(--ember-top), var(--ember-bottom)); border-color: var(--ember-border); }
.btn.ember:hover, button.ember:hover { background: linear-gradient(#FFB88A, #EA6A30); }
button.danger:hover { border-color: #B91C1C; background: linear-gradient(#fff, #FDE2E2); }
form.inline { display: inline; }

/* fields */
input[type=text], input[type=password], input[type=date], select, textarea {
  font: inherit; color: var(--text); border: 1px solid var(--field); border-radius: 2px; padding: 5px 7px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
label.row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
label.row > span:first-child { width: 120px; font-weight: bold; flex: none; }
label.row input[type=text] { flex: 1; }

/* tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; background: #F2F2F2; border-bottom: 1px solid #C8C8C8; padding: 5px 8px; font-weight: bold; }
table.list td { border-bottom: 1px solid #EEE; padding: 5px 8px; vertical-align: middle; }
table.list tr:hover td { background: #F2F7FD; }
td.num, th.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.crumbs { margin-bottom: 10px; }
.crumbs a, .crumbs span { margin-right: 4px; }
.stat { font-size: 22px; font-weight: bold; }
.ball { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; border: 1px solid rgba(0,0,0,.4); }
.ball.on { background: radial-gradient(circle at 40% 30%, #fff 0 15%, #86EFAC 30%, #15803D 80%); }
.ball.warn { background: radial-gradient(circle at 40% 30%, #fff 0 15%, #FDE68A 30%, #D97706 80%); }

/* flash messages */
.flash { padding: 8px 12px; border-radius: 3px; margin-bottom: 10px; border: 1px solid; }
.flash.ok { background: #ECFDF5; border-color: #6EE7B7; color: #065F46; }
.flash.error { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.dirty { background: #FFFBEB; border: 1px solid #FCD34D; color: #92400E; padding: 8px 12px; border-radius: 3px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }

/* news */
.tag { font-weight: bold; }
.preview { border: 1px solid var(--field); border-radius: 2px; padding: 10px; min-height: 120px; line-height: 1.6; }
.bbhelp code { background: #F3F4F6; padding: 0 4px; border-radius: 2px; }
.login { max-width: 360px; margin: 80px auto; }
.ball.off { background: radial-gradient(circle at 40% 30%, #fff 0 15%, #FCA5A5 30%, #B91C1C 80%); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } }
code { background: #F3F4F6; padding: 0 4px; border-radius: 2px; }
table.kv input[type=text] { width: 100%; }

/* ---- launcher editor (sidebar | sections | live preview) ---- */
.wrap.wide { max-width: 1440px; }
.editor { display: grid; grid-template-columns: 190px 1fr 520px; gap: 14px; align-items: start; }
@media (max-width: 1300px) { .editor { grid-template-columns: 180px 1fr; } .pv-col { grid-column: 1 / -1; } }
.side { border: 1px solid #BDBDBD; border-radius: 3px; background: #F7F7F7; overflow: hidden; position: sticky; top: 10px; }
.side-h { background: linear-gradient(#FAFAFA, #DCDCDC); border-bottom: 1px solid #B4B4B4; padding: 4px 8px; font-weight: bold; }
.side-i { display: flex; gap: 8px; align-items: center; padding: 7px 10px; color: var(--text); border-bottom: 1px solid #E5E5E5; }
.side-i .ic { width: 20px; text-align: center; }
.side-i:hover { background: #EAF2FC; text-decoration: none; }
.side-i.on { background: linear-gradient(#fff, #D9E8F8); border-left: 3px solid var(--accent); font-weight: bold; }
.sec h3 { margin: 4px 0 10px; font-size: 14px; border-bottom: 1px dotted #C8C8C8; padding-bottom: 4px; }
.sec h3 ~ h3 { margin-top: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-bottom: 12px; }
.card { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 8px; cursor: pointer;
  border: 1px solid #C8C8C8; border-radius: 4px; background: #fff; }
.card:hover { border-color: var(--hover-border); background: #F7FBFF; }
.card input[type=radio] { position: absolute; top: 6px; right: 6px; }
.card:has(input:checked) { border: 2px solid var(--accent); padding: 7px; background: #EFF6FF; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.card small { color: var(--muted); }
.demo { height: 60px; border-radius: 3px; background: #2A2033; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 4px; }
.img-demo { font-size: 26px; background: repeating-linear-gradient(45deg, #ddd 0 8px, #eee 8px 16px); }
.mini-win { width: 120px; border: 1px solid #8C8C8C; border-radius: 2px; background: #fff; }
.mini-title, .pv-nt { font-size: 10px; padding: 1px 4px; display: flex; gap: 3px; align-items: center; border-bottom: 1px solid #B4B4B4; color: #1F1F1F; }
.mini-title i, .pv-nt i { width: 7px; height: 7px; border-radius: 50%; background: #2563EB; display: inline-block; }
.mini-body { height: 26px; }
.pbar { width: 130px; height: 14px; border: 1px solid #8C8C8C; border-radius: 7px; background: #fff; overflow: hidden; }
.pfill { width: 62%; height: 100%; }
.pbtn { padding: 6px 18px; border: 2px solid; border-radius: 16px; font-weight: bold; font-size: 13px; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.fx-demo { background: linear-gradient(#141826, #3B1F1A); }
.upl { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
img.thumb { width: 40px; height: 26px; object-fit: cover; vertical-align: middle; border: 1px solid #ccc; }
pre.json { background: #1E1E2A; color: #C6F6D5; padding: 10px; border-radius: 3px; max-height: 420px; overflow: auto; font-size: 12px; }
input[type=color] { width: 54px; height: 26px; padding: 1px; border: 1px solid var(--field); }

/* live preview: a launcher at half size (1000x620 -> 500x310) */
.pv-col { position: sticky; top: 10px; }
.pv { position: relative; width: 500px; height: 310px; border: 1px solid #555; border-radius: 3px; overflow: hidden;
  box-shadow: 2px 3px 8px rgba(0,0,0,.35); font-size: 11px; margin: 6px 0; }
#pv-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pv-head { position: absolute; left: 14px; top: 8px; z-index: 2; }
.pv-logo { font: bold 26px Georgia, serif; line-height: 1.1;
  text-shadow: -1px -1px 0 #5A1E0E, 1px -1px 0 #5A1E0E, -1px 1px 0 #5A1E0E, 1px 1px 0 #5A1E0E; }
.pv-logo img { display: block; }
.pv-sub { color: #E8E1D0; font-size: 10px; }
.pv-links { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.pv-links span { background: linear-gradient(#fff, #E2E2E2); border: 1px solid #9E9E9E; border-radius: 8px; padding: 1px 7px; font-size: 10px; }
.pv-news { position: absolute; z-index: 2; left: 14px; top: 72px; overflow: hidden; width: 300px; height: 160px; background: #fff; border: 1px solid #8C8C8C; border-radius: 2px; }
.pv-nb { padding: 8px; }
.pv-nb .ln { height: 6px; background: #E5E7EB; border-radius: 3px; margin-bottom: 9px; }
.pv-nb .ln.s { width: 65%; }
.pv-notice { position: absolute; left: 0; right: 0; top: 244px; height: 18px; background: rgba(0,0,0,.45); overflow: hidden; white-space: nowrap; }
.pv-notice span { display: inline-block; padding-left: 100%; line-height: 18px; animation: tick 14s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }
.pv-foot { position: absolute; left: 0; right: 0; bottom: 0; height: 42px; background: rgba(239,239,239,.95); border-top: 1px solid #C8C8C8;
  display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.pv-pbar { flex: 1; position: relative; height: 14px; border: 1px solid #8C8C8C; border-radius: 7px; background: #fff; overflow: hidden; }
.pv-pbar span { position: absolute; inset: 0; text-align: center; font-size: 9px; line-height: 13px; color: #1F1F1F; }
.pv-pfill { width: 64%; height: 100%; }
.pv-btn { padding: 5px 16px; border: 2px solid; border-radius: 14px; font-weight: bold; font-size: 12px; text-shadow: 0 1px 1px rgba(0,0,0,.35); white-space: nowrap; }

#pv-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-dim { position: absolute; inset: 0; pointer-events: none; }
.pv-banner { height: 40px; background: #ddd center/cover no-repeat; border-bottom: 1px solid #B4B4B4; transition: background-image .4s; }
.pv-links, .pv-notice, .pv-foot { z-index: 2; }
.card.preset { cursor: pointer; }
.card.preset.picked { border: 2px solid var(--accent); padding: 7px; background: #EFF6FF; }
.pv-logo-mini { font: bold 17px Georgia, serif; text-shadow: -1px -1px 0 #5A1E0E, 1px 1px 0 #5A1E0E; }
.pbtn.sm { padding: 2px 12px; font-size: 11px; }
label.radio { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; font-weight: normal; }
.editor.two { grid-template-columns: 190px 1fr; }
.gal-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.gal-pick label { border: 1px solid #C8C8C8; border-radius: 3px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; font-size: 11px; position: relative; }
.gal-pick label:has(input:checked) { border: 2px solid var(--accent); padding: 3px; background: #EFF6FF; }
.gal-pick input { position: absolute; top: 6px; left: 6px; }
.gal-pick img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.gal-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-prev iframe, .site-prev iframe { width: 100%; border: 1px solid #8C8C8C; border-radius: 3px; }
.yt-prev iframe { max-width: 480px; aspect-ratio: 16/9; }
.site-prev iframe { height: 720px; background: #111; }
.vbars { display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.vbars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.vbars i { width: 100%; max-width: 26px; background: linear-gradient(#93C5FD, #2563EB); border: 1px solid #1E3A8A; border-radius: 2px 2px 0 0; }
.vbars small { font-size: 10px; color: var(--muted); }
