/* Clancy Studio Reviews — Minimal / Clean / Modern Flat */
:root {
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #172136;
  --text: #e2e8f0;
  --head: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --grid: rgba(255, 255, 255, 0.05);
  --star-off: #334155;
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.35);
  --danger: #ef4444;
  --ok: #22c55e;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --card-2: #f8fafc;
  --text: #334155;
  --head: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.1);
  --grid: rgba(255, 255, 255, 0.95); /* white grid lines on #F1F5F9 */
  --star-off: #cbd5e1;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  line-height: 1.6;
  transition: background-color 0.2s, color 0.2s;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hl { color: var(--accent); }
.muted { color: var(--muted); }

/* header */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid transparent; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; color: var(--head); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; min-width: 0; }
.brand img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a { padding: 8px 12px; border-radius: 10px; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.nav a:hover { background: var(--card); }
.nav a.active { color: var(--accent); font-weight: 600; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--card); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* hero */
.hero { padding: 40px 0 8px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; background: var(--card); border: 1px solid var(--border); }
.badge svg { width: 14px; height: 14px; fill: var(--accent); stroke: none; }
.hero h1 { margin: 16px 0 10px; font-size: clamp(34px, 6vw, 56px); line-height: 1.1; color: var(--head); letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); font-size: 17px; max-width: 560px; }
.search { margin: 28px 0 32px; position: relative; }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 48px; padding: 0 20px 0 48px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.section-title { font-size: 14px; color: var(--muted); margin: 0 0 14px; font-weight: 500; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding-bottom: 56px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 8px 8px 14px; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; display: block; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card .thumb { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--card-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { margin: 12px 8px 4px; font-size: 15px; color: var(--head); }
.card .row { display: flex; align-items: center; justify-content: space-between; margin: 0 8px; }
.rate-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rate-line b { color: var(--accent); }
.arrow { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.arrow svg { width: 14px; height: 14px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 0; }
.skeleton { height: 230px; border-radius: 16px; background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* stars */
.stars { --p: 0%; position: relative; display: inline-block; line-height: 1; letter-spacing: 2px; font-size: 15px; color: var(--star-off); white-space: nowrap; }
.stars::before { content: '★★★★★'; }
.stars i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p); overflow: hidden; color: var(--accent); font-style: normal; }
.stars i::before { content: '★★★★★'; }
.stars.lg { font-size: 26px; }

/* product page */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); padding: 22px 0 16px; flex-wrap: wrap; }
.crumbs a { color: var(--accent); }
.p-head { display: flex; gap: 24px; align-items: center; padding-bottom: 28px; }
.p-head .pic { width: 144px; height: 144px; flex: none; border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--border); }
.p-head .pic img { width: 100%; height: 100%; object-fit: cover; }
.p-head h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 34px); color: var(--head); line-height: 1.2; }
.p-score { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.p-score .big { font-size: 38px; font-weight: 700; color: var(--head); line-height: 1; }
.p-head p { margin: 8px 0 0; color: var(--muted); max-width: 560px; }
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; padding-bottom: 56px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.list-head h2 { margin: 0; font-size: 20px; color: var(--head); }
.list-head h2 small { font-size: 14px; color: var(--muted); font-weight: 400; }
select, .select { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); outline: none; }
.review { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; display: flex; gap: 14px; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, var(--card-2)); display: grid; place-items: center; color: var(--accent); }
.review .rb { flex: 1; min-width: 0; }
.review .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--head); font-weight: 600; }
.review .top time { font-weight: 400; font-size: 12px; color: var(--muted); }
.review p { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.review.new { animation: pop 0.5s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); background: color-mix(in srgb, var(--accent) 18%, var(--card)); } }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.write { position: sticky; top: 88px; }
.write h3 { margin: 0 0 14px; color: var(--head); font-size: 17px; }
.write label, .field label { display: block; font-size: 13px; margin: 14px 0 6px; font-weight: 500; color: var(--head); }
.rate { display: flex; gap: 4px; }
.rate button { background: none; border: 0; padding: 2px; font-size: 30px; line-height: 1; cursor: pointer; color: var(--star-off); }
.rate button.on { color: var(--accent); }
textarea, .field input[type='text'], .field input[type='url'], .field select { width: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--card-2); padding: 10px 12px; outline: none; resize: vertical; }
textarea { min-height: 130px; }
textarea:focus, .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn:hover { background: var(--accent-h); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { background: var(--danger); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.more { text-align: center; margin: 8px 0; }

/* footer */
.site-footer { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; }
.f-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--head); }
.f-brand img { width: 26px; height: 26px; object-fit: contain; }
.f-text { font-size: 12px; color: var(--muted); text-align: center; flex: 1; min-width: 200px; }
.socials { display: flex; gap: 6px; }
.socials a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.socials a:hover { background: var(--card); color: var(--accent); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--head); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

/* admin */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 28px 0 56px; align-items: start; }
.tabs { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 88px; }
.tabs button { text-align: left; background: none; border: 0; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.tabs button:hover { background: var(--card); }
.tabs button.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.admin-wrap h1 { margin: 0 0 4px; font-size: 24px; color: var(--head); }
.admin-wrap .sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.field { margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.logo-prev { display: flex; align-items: center; gap: 14px; }
.logo-prev img { width: 56px; height: 56px; object-fit: contain; border: 1px dashed var(--border); border-radius: 12px; padding: 4px; background: var(--card-2); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg label { margin: 0; padding: 8px 18px; cursor: pointer; font-weight: 500; }
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); }
.seg label:has(input:checked) { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .pimg { width: 56px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--card-2); }
.tbl .acts { white-space: nowrap; text-align: right; }
.tbl .txt { max-width: 340px; overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.tag.off { background: var(--card-2); color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.stat .n { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 22px; font-weight: 700; color: var(--head); display: flex; align-items: baseline; gap: 8px; }
.stat .v small { white-space: nowrap; font-size: 12px; color: var(--muted); font-weight: 400; }
.toolbar { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.modal { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal.open { display: flex; }
.modal .box { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; color: var(--head); }
.check { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.scroll-x { overflow-x: auto; }

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .layout { grid-template-columns: 1fr; }
  .write { position: static; }
  .admin-wrap { grid-template-columns: 1fr; }
  .tabs { flex-direction: row; overflow-x: auto; position: static; }
  .tabs button { white-space: nowrap; }
}
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; }
  .site-header .container { height: 64px; }
  .brand { font-size: 16px; }
  .brand img { width: 34px; height: 34px; }
  .nav a .lbl { display: none; }
  .p-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .p-head .pic { width: 100%; height: 180px; }
  .hero { padding-top: 24px; }
  .site-footer .container { justify-content: center; }
  .tbl .hide-s { display: none; }
}
