@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800;900;1000&family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Patrick+Hand&display=swap');

:root {
  font-family: 'DM Sans', 'IBM Plex Sans Thai', sans-serif;
  color: #1e3a8a;
  background: #faf8fc;
  font-synthesis: none;
  --paper: #faf8fc;
  --ink: #1e3a8a;
  --blue: #243fe2;
  --purple: #a855f7;
}
body { margin: 0; background: radial-gradient(#e2dfeb .8px, transparent .8px) 0 0 / 19px 19px, var(--paper); color: #17203b; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), select { cursor: pointer; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--purple); outline-offset: 2px; border-color: var(--ink); }
input::placeholder, textarea::placeholder { color: #888099; }
input, textarea, select { min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select { background: #fff; color: #17203b; border: 1.5px solid #b8afcf; border-radius: 3px; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue); flex-shrink: 0; }
input[type=file] { max-width: 100%; color: #6d6c80; }
input[type=file]::file-selector-button { border: 1px solid var(--ink); background: #f0e8fb; color: var(--ink); padding: 8px 12px; margin-right: 12px; }
textarea { resize: vertical; }
.portal main { padding-top: 30px; padding-bottom: 64px; }
.portal h1, .portal h2, .portal h3 { color: #111827; line-height: 1.5; }
.portal .rounded-2xl, .portal .rounded-xl { border-radius: 4px; }
.portal .rounded-lg { border-radius: 3px; }
.portal .glass-card { background: #fffdfd; border: 2px solid var(--ink); box-shadow: 4px 4px 0 #dedbe9; backdrop-filter: none; }
.portal .glass-card.bg-lavender { background: #f4eefb; }
.portal .glass-card.bg-success-soft { background: #edf6ee; }
.portal .glass-card.bg-warning-soft { background: #faf6e8; }
.portal .glass-card.bg-danger-soft { background: #fff0f3; }
.portal :is(button,a)[class*='bg-']:not([data-pick-code]) { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transition: transform .15s, box-shadow .15s, background-color .15s; }
.portal :is(button,a)[class*='bg-']:not([data-pick-code]):hover:not(:disabled) { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.portal :is(button,a)[class*='bg-']:not([data-pick-code]):active:not(:disabled) { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.portal .bg-primary, .portal .bg-success-strong, .portal .bg-danger-strong, .portal .bg-warning-strong { color: #fff; }
.portal :is(.bg-primary,.bg-success-strong,.bg-danger-strong,.bg-warning-strong) :is(.text-ink,.text-muted) { color: inherit; }
.portal button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.portal .checkerboard-bg { background-color: #faf8fc; background-image: linear-gradient(45deg,#e8e3f1 25%,transparent 25%),linear-gradient(-45deg,#e8e3f1 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e8e3f1 75%),linear-gradient(-45deg,transparent 75%,#e8e3f1 75%); background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; }
.portal .asset-card-selected { border-color: var(--blue) !important; box-shadow: 3px 3px 0 var(--blue); background: #f0e8fb !important; }
.portal [data-pick-code] { border-width: 2px; border-radius: 3px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.portal [data-pick-code]:hover { border-color: var(--blue); transform: translateY(-2px); }
.countdown-digit { font-variant-numeric: tabular-nums; }
.portal .countdown-digit { font-family: 'DM Sans', monospace; font-weight: 700; letter-spacing: .4px; }
.portal-skip { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 10px 18px; background: var(--blue); color: white; }
.portal-skip:focus { top: 12px; }
.portal-header { position: sticky; top: 0; z-index: 40; background: #faf8fcf5; border-bottom: 1px solid #dbd8e5; backdrop-filter: blur(12px); }
.portal-header-inner { max-width: 1280px; margin: auto; min-height: 86px; padding: 16px 28px; display: flex; align-items: center; gap: 24px; }
.portal-brand { display: flex; align-items: center; gap: 20px; color: #111827; flex-shrink: 0; }
.portal-brand > span:last-child { font-size: 8px; letter-spacing: 1.2px; line-height: 1.8; }
.portal-logo { font: 900 21px/.74 'DM Sans',sans-serif; letter-spacing: -2px; position: relative; }
.portal-logo > span { color: var(--blue); }
.portal-logo i { position: absolute; color: var(--purple); right: -12px; top: 11px; font-size: 14px; font-style: normal; }
.portal-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.portal-nav a { font-size: 13px; padding: 8px 12px; color: var(--ink); border: 2px solid transparent; transition: background-color .15s, transform .15s, box-shadow .15s; }
.portal-nav a:hover { background: #f0e8fb; }
.portal-nav a[aria-current=page] { border-color: var(--ink); background: #f0e8fb; box-shadow: 3px 3px 0 var(--ink); font-weight: 600; }
.portal-logout { color: #a33151; border: 2px solid #a33151; box-shadow: 2px 2px 0 #a33151; padding: 7px 12px; font-size: 12px; font-weight: 600; background: #fffdfd; transition: transform .15s, box-shadow .15s; }
.portal-logout:hover { transform: translate(1px,1px); box-shadow: 1px 1px 0 #a33151; }
.portal-auth { display: flex; align-items: center; flex-shrink: 0; }
.fb-login-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; font-size: 12px; font-weight: 700; color: #fff !important; background: var(--blue); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); border-radius: 3px; white-space: nowrap; transition: transform .15s, box-shadow .15s, background-color .15s; text-decoration: none; }
.fb-login-btn:hover { background: var(--ink); transform: translate(1.5px, 1.5px); box-shadow: 1.5px 1.5px 0 var(--ink); }
.fb-user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 5px; background: #fffdfd; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); border-radius: 3px; max-width: 100%; }
.fb-avatar { width: 26px; height: 26px; border-radius: 999px; object-fit: cover; border: 1.5px solid var(--ink); flex-shrink: 0; }
.fb-avatar-fallback { display: inline-flex; align-items: center; justify-content: center; background: #f0e8fb; color: var(--ink); font-size: 11px; font-weight: 800; }
.fb-user-name { font-size: 12px; font-weight: 700; color: #17203b; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-logout-btn { padding: 3px 8px; font-size: 11px; font-weight: 700; color: #a33151; background: #fff0f3; border: 1.5px solid #a33151; border-radius: 3px; white-space: nowrap; transition: background-color .15s; }
.fb-logout-btn:hover { background: #ffe0e8; }
.upload-dropzone { position: relative; border: 2px dashed #8b83b0; background: #fff; border-radius: 4px; cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s, transform .15s; }
.upload-dropzone:hover, .upload-dropzone:focus-visible { border-color: var(--blue); background: #f7f3fd; }
.upload-dropzone.dropzone-active { border-style: solid; border-color: var(--blue); background: #efe7fc; box-shadow: 4px 4px 0 var(--blue); transform: translate(-1px, -1px); }
.upload-dropzone.dropzone-has-file { border-style: solid; border-color: #246145; background: #f4fbf5; }
.upload-dropzone .dropzone-overlay-hint { pointer-events: none; }
.portal-intro { display: grid; grid-template-columns: minmax(0,1fr) 210px; align-items: center; gap: 32px; min-height: 245px; margin: 4px 0 38px; border-bottom: 1px solid #dbd8e5; padding-bottom: 26px; }
.portal-eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 2px; margin-bottom: 16px; }
.portal-intro h1 { font-size: clamp(26px,3.2vw,43px); font-weight: 800; line-height: 1.4; letter-spacing: -.8px; max-width: 750px; }
.portal-intro h1 > span { color: var(--purple); margin-left: 10px; font-size: .85em; display: inline-block; transform: rotate(12deg); }
.portal-description { color: #6d6c80; font-size: 14px; line-height: 1.9; margin-top: 12px; max-width: 590px; }
.portal-intro-art { position: relative; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding-bottom: 6px; }
.portal-intro-art img { width: 165px; height: 165px; object-fit: contain; animation: portal-bob 4s ease-in-out infinite; }
.portal-intro-art > span { font: 19px/1.15 'Patrick Hand', cursive; text-align: center; color: #81758f; transform: rotate(-5deg); }
.portal-intro-compact { min-height: 215px; }
.portal-intro-compact .portal-intro-art img { height: 148px; width: 148px; }
.portal-clock { color: #6d6c80; font-size: 11px; margin-top: 14px; }
.portal-login-mark { display: inline-block; color: var(--purple); font-size: 40px; line-height: 1; margin-bottom: 16px; }
.portal #login-view { margin-top: 0; margin-bottom: 32px; }
.portal #tab-zone-a, .portal #tab-zone-b { min-height: 110px; border-radius: 3px; }
.portal #tab-zone-a.bg-lavender, .portal #tab-zone-b.bg-success-soft { box-shadow: 4px 4px 0 var(--ink); }
.portal #picker-status-bar { top: 86px; box-shadow: 3px 3px 0 #d9d5e8; }
.portal #admin-modal { background: #17203b88; }
.portal #admin-modal > div { box-shadow: 6px 6px 0 var(--ink); }
.portal #tgdc-toast-container { max-width: min(24rem,calc(100vw - 32px)); right: 16px; }
.portal table { min-width: 700px; }
.portal th { color: var(--ink); font-weight: 700; white-space: nowrap; }
.portal td { vertical-align: top; }
.portal pre, .portal code { overflow-wrap: anywhere; }
.portal-footer { max-width: 1280px; width: calc(100% - 56px); margin: 0 auto; padding: 26px 0; border-top: 1px solid #dbd8e5; display: flex; justify-content: space-between; gap: 16px; color: #6d6c80; font-size: 10px; }
.portal-footer a { font-weight: 700; color: var(--ink); letter-spacing: .5px; }
.portal-footer span { color: var(--purple); margin: 0 6px; }
@keyframes portal-bob { 0%,100% {transform:translateY(0) rotate(-2deg)} 50% {transform:translateY(-7px) rotate(1deg)} }
@media(max-width:700px) {
 .portal-header-inner { flex-wrap: wrap; gap: 14px; padding: 16px 20px; }
 .portal-nav { order: 3; width: 100%; margin: 0; gap: 4px; }
 .portal-nav a { font-size: 12px; padding: 6px 9px; }
 .portal-logout { margin-left: auto; }
 .portal-auth { margin-left: auto; max-width: 100%; }
 .fb-login-btn { font-size: 11px; padding: 6px 10px; }
 .fb-user-name { max-width: 96px; }
 .portal-intro { grid-template-columns: minmax(0,1fr) 105px; gap: 12px; min-height: 215px; margin-bottom: 28px; }
 .portal-intro h1 { font-size: 27px; }
 .portal-eyebrow { font-size: 9px; letter-spacing: 1px; }
 .portal-description { font-size: 12px; }
 .portal-intro-art img, .portal-intro-compact .portal-intro-art img { width: 100px; height: 112px; }
 .portal-intro-art > span { font-size: 14px; }
 .portal #picker-status-bar { position: static; }
 .portal-footer { flex-direction: column; width: calc(100% - 40px); }
 .portal .glass-card { padding: 20px; }
 .portal .glass-card:has(table) { padding: 0; }
}
@media(max-width:380px) {
 .portal-intro { grid-template-columns: minmax(0,1fr) 82px; gap: 8px; }
 .portal-intro-art img, .portal-intro-compact .portal-intro-art img { width: 78px; height: 92px; }
 .portal-intro-art > span { font-size: 12px; }
 .portal-intro h1 { font-size: 24px; }
 .portal-nav a { padding: 6px 7px; }
}
@media(prefers-reduced-motion:reduce) {
 *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.preview-ribbon { position: fixed; right: 16px; bottom: 16px; z-index: 90; padding: 7px 12px; border: 2px solid #1e3a8a; background: #f0e8fb; color: #1e3a8a; box-shadow: 3px 3px 0 #1e3a8a; font-size: 11px; font-weight: 700; letter-spacing: .2px; pointer-events: none; user-select: none; }
@media(max-width: 600px){ .preview-ribbon { right: 10px; bottom: 10px; padding: 5px 9px; font-size: 10px; } }
