/* =========================================================================
   GDMA Vote — theme stylesheet (v1.2)
   Colours, fonts and corner radius come from Backend > Appearance
   (CSS variables --gdma-*). Extra rules can go in Backend > Appearance > Custom CSS.
   Design: rounded, borderless surfaces. No animations or transitions.
   ========================================================================= */

:root {
  --gdma-radius-in: max(0px, calc(var(--gdma-radius) - 6px)); /* images & boxes inside a card */
  --gdma-soft: color-mix(in srgb, var(--gdma-text) 7%, transparent);   /* soft fill on surfaces */
  --gdma-line: color-mix(in srgb, var(--gdma-text) 9%, transparent);   /* hairline when a line is needed */
  --gdma-accent-soft: color-mix(in srgb, var(--gdma-accent) 16%, transparent);
  --gdma-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.gdma-lock-zoom { touch-action: pan-x pan-y; } /* no double-tap or pinch zoom (ระบบจัดการเว็บไซต์ > ตั้งค่าทั่วไป) */
body.gdma-body {
  margin: 0;
  background: var(--gdma-bg);
  color: var(--gdma-text);
  font-family: var(--gdma-font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  letter-spacing: var(--gdma-ls, 0);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--gdma-font-heading); font-weight: 700; line-height: 1.25; margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--gdma-accent); outline-offset: 2px; }

.gdma-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gdma-skip { position: absolute; left: -999px; top: 8px; background: var(--gdma-accent); color: var(--gdma-accent-text); padding: 8px 12px; z-index: 100; }
.gdma-skip:focus { left: 8px; }

/* page wrapper: content never wider than --gdma-max (Backend > รูปแบบ > ความกว้างสูงสุดของเว็บ, default 960px) */
.gdma-container { width: 100%; max-width: calc(var(--gdma-max, 960px) + var(--gdma-gutter, 25px) * 2); margin: 0 auto; padding: 0 var(--gdma-gutter, 25px); }
.gdma-narrow { } /* same width as the page wrapper so headings line up */
.gdma-center { text-align: center; }
.gdma-muted { color: var(--gdma-muted); }
.gdma-small { font-size: 13px; }
.gdma-lead { font-size: 17px; max-width: 640px; }
.gdma-mb0 { margin-bottom: 0; }
.gdma-main { flex: 1; }

/* ------------------------------------------------------------------ header */
.gdma-header { position: sticky; top: 0; z-index: 40; background: var(--gdma-bg); }
/* after scrolling: frosted glass (see app.js). No transition by design. */
.gdma-header.is-scrolled { background: color-mix(in srgb, var(--gdma-bg) 62%, transparent); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: 0 1px 0 var(--gdma-line); }
.gdma-header.is-scrolled .gdma-nav.is-open { background: color-mix(in srgb, var(--gdma-bg) 92%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.gdma-header-inner { display: flex; align-items: center; gap: 12px; padding-top: var(--gdma-gutter, 25px); padding-bottom: var(--gdma-gutter, 25px); }
.gdma-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.gdma-logo { height: var(--gdma-logo-h); width: auto; }
.gdma-brand-name { font-family: var(--gdma-font-heading); font-weight: 700; letter-spacing: var(--gdma-ls, 0); font-size: 15px; }

.gdma-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--gdma-bg); padding: 0; box-shadow: 0 12px 24px rgba(0,0,0,.35); }
.gdma-nav.is-open { display: block; }
.gdma-nav-list { list-style: none; margin: 0; padding: 0; }
.gdma-nav-list a { display: block; padding: 14px var(--gdma-gutter, 25px); border-radius: 0; font-size: 16px; }   /* mobile menu: full width rows, no outer margin */
.gdma-nav > .gdma-lang { margin: 12px var(--gdma-gutter, 25px) 16px; }
.gdma-nav-list a.is-active { color: var(--gdma-accent); background: var(--gdma-soft); }

.gdma-tools { display: flex; align-items: center; gap: 10px; }

.gdma-lang { display: inline-flex; padding: 4px; gap: 2px; background: var(--gdma-surface); border-radius: var(--gdma-radius-tab); }
.gdma-lang a { padding: 5px 12px; font-size: 12px; font-weight: 700; letter-spacing: var(--gdma-ls, 0); color: var(--gdma-muted); border-radius: var(--gdma-radius-tab); }
.gdma-lang a.is-active { background: var(--gdma-text); color: var(--gdma-bg); }

@media (min-width: 900px) {
  .gdma-menu-btn { display: none !important; }
  .gdma-nav { display: flex !important; position: static; padding: 0; align-items: center; gap: 20px; background: none; box-shadow: none; margin-right: 8px; }
  .gdma-nav > .gdma-lang { margin: 0; }
  .gdma-nav-list { display: flex; gap: 4px; margin: 0; }
  .gdma-nav-list a { padding: 8px 14px; font-size: 15px; border-radius: var(--gdma-radius-tab); }
}

/* icon buttons (user, menu) */
/* all header icons share one size and a round background */
.gdma-icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; padding: 0; border-radius: 50%; background: var(--gdma-surface); color: var(--gdma-text); font-size: 18px; line-height: 1; cursor: pointer; flex: none; }
.gdma-icon-btn i { width: 1.15em; text-align: center; }
.gdma-icon-btn-user { overflow: visible; }
.gdma-icon-btn-user img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.gdma-icon-btn[aria-expanded="true"] { background: var(--gdma-soft); }

/* tooltip (data-tip) — appears below the icon, no animation */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--gdma-surface); color: var(--gdma-text); font-size: 13px; font-weight: 400; line-height: 1;
  padding: 8px 12px; border-radius: var(--gdma-radius); white-space: nowrap; pointer-events: none; z-index: 60; box-shadow: var(--gdma-shadow);
}
[data-gdma-dropdown].is-open [data-tip]::after { display: none; }

/* user dropdown */
.gdma-usermenu { position: relative; }
.gdma-dropdown { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; background: var(--gdma-surface); border-radius: var(--gdma-radius); padding: 8px; box-shadow: var(--gdma-shadow); z-index: 70; }
.gdma-dropdown[hidden] { display: none; }
.gdma-dropdown-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; }
.gdma-dropdown-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.gdma-dropdown a, .gdma-dropdown button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: var(--gdma-radius-in); font-size: 15px; text-align: left; cursor: pointer; }
.gdma-dropdown a:hover, .gdma-dropdown button:hover, .gdma-dropdown a:focus-visible, .gdma-dropdown button:focus-visible { background: var(--gdma-soft); }
.gdma-dropdown i { width: 18px; text-align: center; color: var(--gdma-muted); }
.gdma-dropdown form { margin: 0; }
.gdma-dropdown-sep { margin-top: 6px !important; padding-top: 6px; box-shadow: 0 -1px 0 var(--gdma-line); }

/* ------------------------------------------------------------------ avatar */
.gdma-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: var(--gdma-soft); color: var(--gdma-accent); font-weight: 700; flex: none; }
.gdma-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gdma-avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.gdma-avatar-md { width: 40px; height: 40px; font-size: 16px; }
.gdma-avatar-lg { width: 80px; height: 80px; font-size: 28px; margin: 0 auto 16px; }
.gdma-avatar-xl { width: 96px; height: 96px; font-size: 34px; }

/* ----------------------------------------------------------------- buttons */
.gdma-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--gdma-accent); color: var(--gdma-accent-text); border: 0; border-radius: var(--gdma-radius-btn); padding: var(--gdma-btn-py, 16px) 24px; font-weight: 700; font-size: 15px; cursor: pointer; line-height: 1.2; text-align: center; }
.gdma-btn:disabled, .gdma-btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.gdma-btn-sm { padding: calc(var(--gdma-btn-py, 16px) - 4px) 20px; font-size: 14px; }
.gdma-btn-xs { padding: 8px 16px; font-size: 13px; }
.gdma-btn-lg { padding: calc(var(--gdma-btn-py, 16px) + 2px) 40px; font-size: 16px; }
.gdma-btn-block { width: 100%; }
.gdma-btn-outline { background: transparent; color: var(--gdma-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gdma-text) 28%, transparent); }
.gdma-btn-soft { background: var(--gdma-soft); color: var(--gdma-text); }
.gdma-btn-provider { font-weight: 400; font-size: 15px; padding: 14px 18px; background: var(--gdma-surface); color: var(--gdma-text); }
.gdma-linkbtn { background: none; border: 0; padding: 4px 0; color: var(--gdma-muted); text-decoration: underline; cursor: pointer; }
.gdma-link-arrow { color: var(--gdma-accent); font-size: 14px; font-weight: 700; }

/* ------------------------------------------------------- home banner slider */
.gdma-banner { position: relative; }
.gdma-banner-full { padding: 0; }
.gdma-banner-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--gdma-radius); background: var(--gdma-surface); }
.gdma-banner-track::-webkit-scrollbar { display: none; }
.gdma-banner-slide { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: var(--gdma-banner-ratio, 1/1); display: block; }
.gdma-banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.gdma-banner-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.gdma-banner-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--gdma-soft); cursor: pointer; }
.gdma-banner-dots button.is-active { background: var(--gdma-accent); width: 22px; border-radius: 999px; }

/* ------------------------------------------------------------------ badges */
.gdma-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--gdma-radius); background: var(--gdma-soft); color: var(--gdma-muted); white-space: nowrap; }
.gdma-badge-open { background: var(--gdma-accent-soft); color: var(--gdma-accent); }

/* ------------------------------------------------------------------ alerts */
.gdma-alert { margin: 16px 0 0; padding: 14px 18px; border-radius: var(--gdma-radius); font-size: 14px; background: var(--gdma-surface); }
.gdma-alert-error { background: color-mix(in srgb, #e05a5a 16%, var(--gdma-surface)); }
.gdma-alert-success { background: var(--gdma-accent-soft); }

/* -------------------------------------------------------------------- hero */
.gdma-hero { text-align: center; }
.gdma-hero .gdma-countdown:first-child { margin-top: 0; }
.gdma-hero.has-image { background: linear-gradient(rgba(0,0,0,.55), var(--gdma-bg)), var(--gdma-hero-img) center / cover no-repeat; }
.gdma-eyebrow { color: var(--gdma-accent); font-size: 13px; font-weight: 700; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; margin-bottom: 12px; }
.gdma-hero-title { font-size: clamp(36px, 9vw, 80px); letter-spacing: var(--gdma-ls, 0); }
.gdma-hero-text { color: var(--gdma-muted); font-size: 17px; max-width: 560px; margin: 16px auto 0; }
.gdma-hero-actions { margin-top: 32px; }


/* --------------------------------------------------------------- countdown */
.gdma-countdown { margin-top: 32px; }
.gdma-countdown-label { font-size: 13px; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; color: var(--gdma-muted); margin-bottom: 10px; }
.gdma-countdown-units { display: inline-grid; grid-template-columns: repeat(4, minmax(60px, 1fr)); gap: 8px; }
.gdma-cd-unit { border-radius: var(--gdma-radius); padding: 12px 6px; text-align: center; background: var(--gdma-surface); }
.gdma-cd-num { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.gdma-cd-lbl { display: block; font-size: 11px; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; color: var(--gdma-muted); margin-top: 4px; }
.gdma-countdown-lg .gdma-cd-num { font-size: 32px; }
.gdma-countdown-lg .gdma-countdown-units { grid-template-columns: repeat(4, minmax(70px, 1fr)); }
.gdma-countdown-ended { color: var(--gdma-muted); font-size: 15px; }
@media (min-width: 600px) { .gdma-countdown-lg .gdma-cd-num { font-size: 44px; } .gdma-countdown-lg .gdma-countdown-units { grid-template-columns: repeat(4, 112px); gap: 12px; } .gdma-countdown-lg .gdma-cd-unit { padding: 18px 8px; } }

/* --------------------------------------------------------------- sections */
/* every section is separated by the same gap (Backend > รูปแบบ > ระยะห่างระหว่าง Section) */
.gdma-section { padding: var(--gdma-gap, 30px) 0 0; }
.gdma-main > .gdma-section:last-child { padding-bottom: var(--gdma-gap, 30px); }
.gdma-section-tight { padding: var(--gdma-gap, 30px) 0 0; }
.gdma-section-flush { padding-top: var(--gdma-gap, 30px); }
.gdma-section-title { font-size: 14px; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; color: var(--gdma-muted); font-weight: 400; margin-bottom: 20px; }
.gdma-page-head { padding: var(--gdma-gap, 30px) 0 0; }
.gdma-page-head .gdma-page-title { margin-bottom: 0; }
.gdma-page-head p:last-child { margin-bottom: 0; }
.gdma-page-title { font-size: clamp(28px, 6vw, 48px); letter-spacing: var(--gdma-ls, 0); margin: 10px 0 12px; }
.gdma-back { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--gdma-muted); margin-bottom: 16px; }
.gdma-empty { color: var(--gdma-muted); padding: 48px 16px; text-align: center; background: var(--gdma-surface); border-radius: var(--gdma-radius); }

/* ------------------------------------------------------- category cards */
.gdma-cat-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .gdma-cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .gdma-cat-grid { grid-template-columns: repeat(3, 1fr); } }
.gdma-cat-card { display: block; border-radius: var(--gdma-radius); overflow: hidden; background: var(--gdma-surface); }
.gdma-cat-media { aspect-ratio: 16 / 9; background: var(--gdma-soft); display: flex; align-items: center; justify-content: center; }
.gdma-cat-media img { width: 100%; height: 100%; object-fit: cover; }
.gdma-cat-mark { width: 40px; height: 40px; border: 1.5px solid var(--gdma-accent); border-radius: 50%; opacity: .6; }
.gdma-cat-body { padding: 18px 20px 20px; }
.gdma-cat-name { display: block; font-size: 18px; margin: 10px 0 4px; font-weight: 700; }

.gdma-cat-list { display: grid; gap: 10px; }
.gdma-cat-row { display: grid; grid-template-columns: 56px 1fr; grid-template-areas: "thumb info" "thumb badge"; align-items: center; gap: 4px 14px; padding: 12px; background: var(--gdma-surface); border-radius: var(--gdma-radius); }
.gdma-cat-no { display: none; }
.gdma-cat-thumb { grid-area: thumb; width: 56px; height: 56px; border-radius: var(--gdma-radius-in); overflow: hidden; background: var(--gdma-soft); display: flex; align-items: center; justify-content: center; }
.gdma-cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gdma-cat-thumb .gdma-cat-mark { width: 18px; height: 18px; }
.gdma-cat-info { grid-area: info; min-width: 0; }
.gdma-cat-info .gdma-cat-name { margin: 0; font-size: 17px; }
.gdma-cat-info .gdma-small { display: block; }
.gdma-cat-row .gdma-badge { grid-area: badge; justify-self: start; }
@media (min-width: 700px) {
  .gdma-cat-row { grid-template-columns: 40px 72px 1fr auto; grid-template-areas: "no thumb info badge"; padding: 14px 20px 14px 14px; gap: 4px 18px; }
  .gdma-cat-no { display: block; grid-area: no; color: var(--gdma-muted); font-variant-numeric: tabular-nums; font-size: 14px; text-align: center; }
  .gdma-cat-thumb { width: 72px; height: 72px; }
  .gdma-cat-row .gdma-badge { justify-self: end; }
}

/* ----------------------------------------------------------- category head */
.gdma-cat-head { display: flex; flex-direction: column; gap: 8px; }
.gdma-cat-head .gdma-countdown { margin-top: 8px; }
@media (min-width: 900px) { .gdma-cat-head { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 32px; } .gdma-cat-head .gdma-countdown { margin: 0; text-align: right; } }
.gdma-vote-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-top: 24px; padding: 14px 20px; border-radius: var(--gdma-radius); background: var(--gdma-surface); font-size: 15px; }
.gdma-vote-status strong { color: var(--gdma-accent); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- nominees */
.gdma-nominee-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .gdma-nominee-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1000px) { .gdma-nominee-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
.gdma-nominee { display: flex; flex-direction: column; border-radius: var(--gdma-radius); overflow: hidden; background: var(--gdma-surface); padding: 8px; }
.gdma-nominee.is-mine { box-shadow: inset 0 0 0 2px var(--gdma-accent); }
.gdma-nominee-media { position: relative; aspect-ratio: 1 / 1; background: var(--gdma-soft); border-radius: var(--gdma-radius-in); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.gdma-nominee-media img { width: 100%; height: 100%; object-fit: cover; }
.gdma-nominee-initial { font-size: 48px; color: var(--gdma-accent); font-family: var(--gdma-font-heading); font-weight: 700; }
.gdma-rank { position: absolute; top: 8px; left: 8px; min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--gdma-accent); color: var(--gdma-accent-text); border-radius: var(--gdma-radius); font-size: 13px; font-weight: 700; }
.gdma-nominee-body { padding: 12px 6px 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.gdma-nominee-name { font-size: 15px; }
.gdma-nominee-sub { font-size: 13px; color: var(--gdma-muted); }
.gdma-vote-spacer { flex: 1 0 var(--gdma-vote-gap, 20px); min-height: var(--gdma-vote-gap, 20px); }
.gdma-mine-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; width: 100%; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--gdma-accent); text-align: left; cursor: pointer; }
.gdma-mine-tag[hidden] { display: none; }
.gdma-mine-view { font-weight: 400; color: var(--gdma-muted); text-decoration: underline; text-underline-offset: 3px; }
.gdma-mine-view i { font-size: 9px; text-decoration: none; }
.gdma-nominee.is-mine { cursor: pointer; }
.gdma-modal-receipt { font-size: 14px; font-weight: 700; color: var(--gdma-accent); word-break: break-all; }
.gdma-modal-time { font-size: 12px; color: var(--gdma-muted); }
.gdma-bar { height: 6px; background: var(--gdma-soft); border-radius: var(--gdma-radius); overflow: hidden; margin-top: 4px; }
.gdma-bar span { display: block; height: 100%; background: var(--gdma-accent); }
@media (min-width: 700px) { .gdma-nominee { padding: 10px; } .gdma-nominee-body { padding: 14px 8px 8px; } .gdma-nominee-name { font-size: 17px; } }

/* ------------------------------------------------------------------- tabs */
.gdma-tabs { display: inline-flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding: 4px; background: var(--gdma-surface); border-radius: var(--gdma-radius-tab); max-width: 100%; scrollbar-width: none; }
.gdma-tabs::-webkit-scrollbar { display: none; }
.gdma-tabs a { padding: 8px 16px; white-space: nowrap; font-size: 14px; color: var(--gdma-muted); border-radius: var(--gdma-radius-tab); }
.gdma-tabs a.is-active { background: var(--gdma-text); color: var(--gdma-bg); font-weight: 700; }

/* --------------------- winners (on the History page) — layout like Melon MMA results */
.gdma-histo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--gdma-gap, 30px); }
.gdma-histo-title { font-size: 28px; }
.gdma-page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.gdma-select { position: relative; }
.gdma-select-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 120px; padding: 10px 14px 10px 16px; background: var(--gdma-surface); color: var(--gdma-text); border: 0; border-radius: var(--gdma-radius); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.gdma-select-btn i { font-size: 11px; color: var(--gdma-muted); }
.gdma-select.is-open .gdma-select-btn i { transform: rotate(180deg); color: var(--gdma-accent); }
.gdma-select-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 100%; margin: 0; padding: 6px 0; list-style: none; background: var(--gdma-surface); border-radius: var(--gdma-radius); box-shadow: 0 16px 40px rgba(0,0,0,.5); max-height: 280px; overflow-y: auto; }
.gdma-select-list[hidden] { display: none; }
.gdma-select-list li { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 16px; font-size: 15px; color: var(--gdma-muted); cursor: pointer; outline: none; }
.gdma-select-list li i { font-size: 12px; color: var(--gdma-accent); visibility: hidden; }
.gdma-select-list li:hover, .gdma-select-list li:focus-visible { background: var(--gdma-soft); color: var(--gdma-text); }
.gdma-select-list li[aria-selected="true"] { color: var(--gdma-accent); font-weight: 700; }
.gdma-select-list li[aria-selected="true"] i { visibility: visible; }
.gdma-histo-banner { width: 100%; height: auto; margin-bottom: var(--gdma-gap, 30px); }
.gdma-histo-edition { font-size: 34px; font-weight: 800; line-height: 1.15; color: var(--gdma-accent); margin-bottom: var(--gdma-gap, 30px); }
.gdma-histo-list { --cols: 3; --gx: 14px; --gy: 28px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gy) var(--gx); }
.gdma-histo-grand { --cols: 2; --gx: 16px; --gy: 32px; }
@media (min-width: 700px) { .gdma-histo-list { --cols: 4; --gx: 24px; --gy: 40px; } }
/* rows chosen in the admin panel ("แสดงในบรรทัดที่"): each row on its own line, starting from the left */
.gdma-histo-list.gdma-histo-row { display: flex; flex-wrap: wrap; justify-content: flex-start; }
.gdma-histo-row > .gdma-histo-item { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gx)) / var(--cols)); }
.gdma-histo-row + .gdma-histo-row { margin-top: var(--gy); }
.gdma-histo-group { margin-top: calc(var(--gdma-gap, 30px) * 2); }
.gdma-histo-sec { font-size: 26px; font-weight: 700; margin-bottom: 20px; }
.gdma-histo-item { text-align: center; min-width: 0; }
.gdma-histo-thumb { aspect-ratio: 1 / 1; overflow: hidden; background: var(--gdma-surface); display: flex; align-items: center; justify-content: center; }
.gdma-histo-thumb.is-circle { border-radius: 50%; }
.gdma-histo-thumb.is-square { border-radius: 0; }
.gdma-histo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gdma-histo-initial { font-size: 32px; font-weight: 700; color: var(--gdma-accent); }
.gdma-histo-category { margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--gdma-accent); line-height: 1.35; }
.gdma-histo-artist { margin-top: 4px; font-size: 14px; font-weight: 700; line-height: 1.3; word-break: break-word; }
.gdma-histo-work { margin-top: 2px; font-size: 11px; color: var(--gdma-muted); line-height: 1.35; }
.gdma-histo-grand .gdma-histo-category { margin-top: 14px; font-size: 13px; }
.gdma-histo-grand .gdma-histo-artist { font-size: 17px; }
.gdma-histo-grand .gdma-histo-work { font-size: 12px; }

/* -------------------------------------------------------------- auth pages */
.gdma-auth { display: flex; justify-content: center; }
.gdma-auth-box { width: 100%; max-width: 420px; text-align: center; background: var(--gdma-surface); border-radius: var(--gdma-radius); padding: 36px 24px 28px; }
.gdma-auth-logo { height: 56px; width: auto; margin: 0 auto 24px; }
.gdma-auth-title { font-size: 28px; margin-bottom: 8px; }
.gdma-auth-buttons { display: grid; gap: 10px; margin: 24px 0; }
.gdma-auth-box .gdma-btn-provider { background: var(--gdma-soft); }
.gdma-divider { display: flex; align-items: center; gap: 12px; color: var(--gdma-muted); font-size: 13px; margin: 8px 0 16px; }
.gdma-divider::before, .gdma-divider::after { content: ""; flex: 1; height: 1px; background: var(--gdma-line); }
.gdma-welcome .gdma-auth-box { padding-top: 32px; }

/* ------------------------------------------------------------------- forms */
.gdma-form { display: grid; gap: 8px; text-align: left; margin-bottom: 16px; }
.gdma-form .gdma-btn { margin-top: 10px; }
.gdma-label { font-size: 13px; color: var(--gdma-muted); margin-top: 6px; }
.gdma-input { width: 100%; padding: 14px 16px; background: var(--gdma-soft); border: 0; border-radius: var(--gdma-radius-in); color: var(--gdma-text); font: inherit; }
.gdma-input:focus { outline: 2px solid var(--gdma-accent); outline-offset: 0; }
.gdma-panel .gdma-input, .gdma-auth-box .gdma-input { background: var(--gdma-bg); }
.gdma-input-count { position: relative; }
.gdma-input-count .gdma-input { padding-right: 60px; }
.gdma-count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--gdma-muted); font-variant-numeric: tabular-nums; }
.gdma-input.is-invalid { outline: 2px solid #c25656; }
.gdma-file { font-size: 14px; color: var(--gdma-muted); max-width: 100%; }
/* custom file picker: Thai button text ("เลือกไฟล์") + chosen file name */
.gdma-file-pick { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.gdma-file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.gdma-file-pick .gdma-btn { flex: none; }
.gdma-file-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; color: var(--gdma-muted); }
.gdma-file-pick input[type=file]:focus-visible + .gdma-btn { outline: 2px solid var(--gdma-accent); outline-offset: 2px; }
.gdma-file::file-selector-button { font: inherit; font-size: 13px; border: 0; border-radius: var(--gdma-radius-btn); padding: 8px 14px; margin-right: 10px; background: var(--gdma-soft); color: var(--gdma-text); cursor: pointer; }
.gdma-inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }

/* --------------------------------------------------------------- user page */
.gdma-profile { position: relative; text-align: center; }
.gdma-profile-cover { height: 180px; background-color: var(--gdma-cover, var(--gdma-surface));
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.10) 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, rgba(255,255,255,.08) 0 2px, transparent 3px),
                    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.18));
  background-size: 36px 36px, 36px 36px, auto; }
.gdma-profile-main { position: relative; margin-top: -70px; padding-bottom: 8px; }
.gdma-profile-avatar { display: inline-flex; align-items: center; justify-content: center; width: 132px; height: 132px; border-radius: 50%; overflow: hidden; background: var(--gdma-surface); box-shadow: 0 0 0 6px var(--gdma-bg); color: var(--gdma-accent); font-size: 48px; font-weight: 700; }
.gdma-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gdma-profile-name { font-size: 28px; margin: 18px 0 4px; word-break: break-all; }
.gdma-profile-since { color: var(--gdma-muted); font-size: 14px; }
.gdma-profile-stats { display: inline-flex; margin: 18px 0 8px; background: var(--gdma-surface); border-radius: var(--gdma-radius); }
.gdma-profile-stats > div { display: flex; flex-direction: column; align-items: center; padding: 12px 24px; min-width: 120px; }
.gdma-profile-stats > div + div { box-shadow: -1px 0 0 var(--gdma-line); }
.gdma-profile-stats strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.gdma-profile-stats span { font-size: 12px; color: var(--gdma-muted); }
.gdma-tabs-center { display: flex; width: fit-content; margin: 16px auto 24px; }
.gdma-profile-body { max-width: 720px; margin: 0 auto; }
.gdma-profile-logout { max-width: 720px; margin: 32px auto 0; padding-top: 24px; box-shadow: 0 -1px 0 var(--gdma-line); }
.gdma-panel { border-radius: var(--gdma-radius); padding: 24px; margin-bottom: 16px; background: var(--gdma-surface); text-align: left; }
.gdma-panel-title { font-size: 14px; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; color: var(--gdma-muted); font-weight: 400; margin-bottom: 16px; }
.gdma-account-name { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; }
.gdma-account-name i { width: 20px; text-align: center; color: var(--gdma-muted); }
.gdma-accounts li > .gdma-account-name { flex: 1; min-width: 0; }
.gdma-accounts li > .gdma-badge, .gdma-accounts li > .gdma-btn { flex: none; }
.gdma-account-name > .gdma-ellipsis { flex: 1; }
.gdma-ellipsis { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gdma-avatar-actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.gdma-avatar-actions form { margin: 0; }
#gdma-avatar-form { margin-bottom: 6px; }
.gdma-accounts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.gdma-accounts li { min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--gdma-radius-in); background: var(--gdma-bg); }
.gdma-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gdma-history li { display: grid; grid-template-columns: 48px 1fr; gap: 4px 14px; align-items: center; padding: 10px; border-radius: var(--gdma-radius); background: var(--gdma-surface); }
.gdma-history li > .gdma-small { grid-column: 2; }
.gdma-history-thumb { grid-row: span 2; width: 48px; height: 48px; border-radius: var(--gdma-radius-in); overflow: hidden; background: var(--gdma-soft); display: flex; align-items: center; justify-content: center; color: var(--gdma-accent); }
.gdma-history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gdma-history-main { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 700px) { .gdma-history li { grid-template-columns: 48px 1fr auto; padding: 10px 18px 10px 10px; } .gdma-history-thumb { grid-row: auto; } .gdma-history li > .gdma-small { grid-column: auto; } }
.gdma-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }

/* ------------------------------------------------- award criteria (Melon MMA info style) */
.gdma-crit-title { font-size: 24px; margin-bottom: var(--gdma-gap, 30px); }
.gdma-crit-intro { color: var(--gdma-muted); margin: calc(var(--gdma-gap, 30px) * -0.5) 0 var(--gdma-gap, 30px); line-height: 1.7; }
.gdma-crit-group + .gdma-crit-group { margin-top: var(--gdma-gap, 30px); }
.gdma-crit-sec { position: relative; margin: 0; padding: 12px 20px; font-size: 15px; font-weight: 700; color: var(--gdma-accent-text); border-radius: var(--gdma-radius);
  background: linear-gradient(115deg, var(--gdma-accent) 0 calc(100% - 150px), var(--gdma-text) calc(100% - 150px) calc(100% - 140px), var(--gdma-accent) calc(100% - 140px) calc(100% - 110px), var(--gdma-bg) calc(100% - 110px) calc(100% - 70px), var(--gdma-accent) calc(100% - 70px) calc(100% - 26px), var(--gdma-text) calc(100% - 26px)); }
.gdma-crit-list { list-style: none; margin: 0; padding: 8px 20px; background: var(--gdma-surface); border-radius: var(--gdma-radius); }
.gdma-crit-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 18px 0; }
.gdma-crit-item + .gdma-crit-item { border-top: 1px solid var(--gdma-border); }
.gdma-crit-name strong { display: block; font-size: 16px; line-height: 1.4; }
.gdma-crit-en { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--gdma-accent); }
.gdma-crit-desc { margin: 0; font-size: 14px; color: var(--gdma-muted); line-height: 1.6; }
.gdma-crit-note { margin: 4px 0 0; font-size: 12px; color: var(--gdma-muted); opacity: .85; }
.gdma-crit-judge { font-size: 14px; color: var(--gdma-text); line-height: 1.6; }
.gdma-crit-label { display: block; font-size: 11px; color: var(--gdma-muted); margin-bottom: 2px; }
.gdma-crit-plus { color: var(--gdma-muted); }
.gdma-crit-part { white-space: nowrap; }
@media (min-width: 700px) {
  .gdma-crit-sec { padding: 14px 32px; font-size: 16px; }
  .gdma-crit-list { padding: 16px 32px; }
  .gdma-crit-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.15fr); gap: 32px; padding: 22px 0; }
  .gdma-crit-item + .gdma-crit-item { border-top: 0; }
  .gdma-crit-name strong { font-size: 18px; }
  .gdma-crit-label { display: none; }
}

/* ------------------------------------------------------------------- prose */
.gdma-prose { font-size: 17px; line-height: 1.8; }
.gdma-prose h2 { font-size: 22px; margin: 1.6em 0 .6em; }
.gdma-prose h3 { font-size: 18px; margin: 1.4em 0 .5em; }
.gdma-prose a { color: var(--gdma-accent); text-decoration: underline; }
.gdma-prose img { border-radius: var(--gdma-radius); margin: 1.2em 0; }
.gdma-prose blockquote { margin: 1.4em 0; padding: 16px 20px; border-radius: var(--gdma-radius); background: var(--gdma-surface); color: var(--gdma-muted); }
/* content written with the rich text editor */
.gdma-prose > :first-child { margin-top: 0; }
.gdma-prose p { margin: 0 0 1em; }
.gdma-prose h4 { font-size: 17px; margin: 1.2em 0 .4em; }
.gdma-prose ul, .gdma-prose ol { margin: 0 0 1em; padding-left: 1.4em; }
.gdma-prose li { margin: .25em 0; }
.gdma-prose img { height: auto; }
.gdma-prose hr { border: 0; border-top: 1px solid var(--gdma-border); margin: 2em 0; }
.gdma-prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 15px; display: block; overflow-x: auto; }
.gdma-prose td, .gdma-prose th { border: 1px solid var(--gdma-border); padding: 8px 12px; text-align: left; vertical-align: top; }
.gdma-prose th { background: var(--gdma-surface); }
.gdma-prose iframe, .gdma-prose video { display: block; max-width: 100%; margin: 1.2em auto; border: 0; }
.gdma-prose iframe[src*="youtube"], .gdma-prose iframe[src*="vimeo"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.gdma-prose sup, .gdma-prose sub { font-size: .75em; }

/* ------------------------------------------------------------------ footer */
.gdma-footer { padding: var(--gdma-gap, 30px) 0; margin-top: var(--gdma-gap, 30px); font-size: 13px; background: color-mix(in srgb, var(--gdma-surface) 50%, var(--gdma-bg)); text-align: center; }
.gdma-footer-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gdma-footer-name { font-weight: 700; }
.gdma-footer-copy { color: var(--gdma-muted); font-size: 11px; }
.gdma-social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gdma-social a { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--gdma-surface); color: var(--gdma-text); font-size: 17px; }
.gdma-social [data-tip]:hover::after { top: auto; bottom: calc(100% + 10px); }


/* ------------------------------------------------- notices (toasts) */
/* fade in, stay (Backend > รูปแบบ > ระยะเวลาแสดงข้อความแจ้งเตือน), fade out — see app.js */
.gdma-toasts { position: fixed; left: 0; right: 0; top: calc(44px + var(--gdma-gutter, 25px) * 2 + 8px); z-index: 80; padding: 0 var(--gdma-gutter, 25px); pointer-events: none; display: grid; gap: 8px; justify-items: center; }
.gdma-toast { width: 100%; max-width: 560px; padding: 14px 18px; background: var(--gdma-surface); color: var(--gdma-text); border-radius: var(--gdma-radius); box-shadow: var(--gdma-shadow); font-size: 14px; opacity: 0; transform: translateY(-6px); transition: opacity .5s ease, transform .5s ease; pointer-events: auto; }
.gdma-toast-success { box-shadow: inset 3px 0 0 var(--gdma-accent), var(--gdma-shadow); }
.gdma-toast-error { box-shadow: inset 3px 0 0 #d06464, var(--gdma-shadow); }
.gdma-toast.is-in { opacity: 1; transform: none; }
.gdma-toast.is-out { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .gdma-toast { transition: none; } }

/* ------------------------------------------------------------------- modal */
/* Pop-up in the centre of the screen on every device. No animation. */
.gdma-modal[hidden] { display: none; }
.gdma-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gdma-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .75); }
.gdma-modal-box { position: relative; width: 100%; max-width: 380px; max-height: calc(100vh - 32px); overflow: auto; background: var(--gdma-surface); border-radius: var(--gdma-radius); padding: 32px 22px 22px; text-align: center; box-shadow: var(--gdma-shadow); }
/* every line in a pop-up is the same distance apart (ระบบจัดการเว็บไซต์ > รูปแบบ > ระยะห่างใน Pop-up) */
.gdma-modal-body { display: flex; flex-direction: column; gap: var(--gdma-modal-gap, 16px); }
.gdma-modal-body > * { margin-top: 0; margin-bottom: 0; }
.gdma-modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--gdma-soft); border: 0; font-size: 16px; color: var(--gdma-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.gdma-modal-img { width: 100%; max-width: 220px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--gdma-radius); margin: 0 auto; background: var(--gdma-soft); }
.gdma-modal-img-ph { width: 120px; height: 120px; margin: 0 auto; display: flex; align-items: center; justify-content: center; border-radius: var(--gdma-radius); background: var(--gdma-soft); color: var(--gdma-accent); font-size: 44px; font-weight: 700; }
.gdma-modal-kicker { font-size: 13px; font-weight: 700; letter-spacing: var(--gdma-ls, 0); text-transform: uppercase; color: var(--gdma-accent); }
.gdma-modal-title { font-size: 22px; line-height: 1.3; margin: 0; }
.gdma-modal-sub { color: var(--gdma-muted); font-size: 14px; }
.gdma-modal-award { padding: 14px; border-radius: var(--gdma-radius-in); background: var(--gdma-bg); }
.gdma-modal-award-lbl { display: block; font-size: 12px; color: var(--gdma-muted); margin-bottom: 2px; }
.gdma-modal-award-name { font-weight: 700; }
.gdma-modal-note { font-size: 13px; color: var(--gdma-muted); }
.gdma-modal-check { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--gdma-accent-soft); color: var(--gdma-accent); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.gdma-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gdma-modal-actions > :only-child { grid-column: span 2; }
.gdma-modal-actions .gdma-btn { padding-left: 8px; padding-right: 8px; white-space: nowrap; gap: 8px; }
.gdma-modal-actions .gdma-btn i { font-size: .9em; }
.gdma-modal-desc { font-size: 14px; text-align: left; }
.gdma-turnstile { display: flex; justify-content: center; }
.gdma-modal-msg { font-size: 14px; }
.gdma-modal-msg:empty { display: none; }
.gdma-modal-msg.is-error { color: #e08a8a; }
body.gdma-no-scroll { overflow: hidden; }

/* ---------------------------------------- content protection (Backend toggles) */
/* text cannot be highlighted (right-click still works); form fields stay editable */
.gdma-no-select { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.gdma-no-select input, .gdma-no-select textarea, .gdma-no-select [contenteditable] { -webkit-user-select: text; user-select: text; }
/* images cannot be clicked, dragged, long-pressed or right-clicked (links around them still work) */
.gdma-protect-img img { pointer-events: none; -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* -------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
