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

:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #121a2d;
  --panel-2: #0d1425;
  --line: #27334d;
  --text: #edf2ff;
  --muted: #98a6c4;
  --accent: #8b9cff;
  --accent-2: #b2bbff;
  --danger: #ff7285;
  --green: #4bd5a1;
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(75, 97, 190, .19), transparent 34rem),
    radial-gradient(ellipse at 100% 25%, rgba(57, 179, 164, .09), transparent 28rem),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 42px 0 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent-2); font-size: 11px; letter-spacing: .15em; font-weight: 700; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.03em; }
.subtitle { margin: 10px 0 0; color: var(--muted); }
.local-badge { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #294d4a; border-radius: 999px; padding: 9px 13px; color: #a7f0d6; background: rgba(34, 118, 99, .12); font-size: 12px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px #4bd5a1; }
main { display: grid; gap: 18px; padding-bottom: 34px; }
.panel { border: 1px solid var(--line); border-radius: 20px; padding: 24px; background: linear-gradient(145deg, rgba(20, 29, 49, .97), rgba(15, 22, 39, .97)); box-shadow: 0 14px 35px rgba(0, 0, 0, .12); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; color: #c8d2e8; font-size: 13px; font-weight: 500; }
.field input, .field textarea, .search-input {
  width: 100%; border: 1px solid #303d59; border-radius: 11px; padding: 12px 13px; outline: none;
  color: var(--text); background: #0a1120; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 156, 255, .12); }
.field textarea { resize: vertical; min-height: 150px; line-height: 1.65; }
.input-suffix { display: flex; align-items: center; gap: 10px; }
.input-suffix input { min-width: 0; }
.input-suffix span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hint { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; color: var(--text); font-weight: 600; font-size: 13px; transition: transform .15s, opacity .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { color: #10162c; background: linear-gradient(135deg, #b7c1ff, #8495ff); box-shadow: 0 6px 18px rgba(117, 136, 255, .18); }
.button-secondary { border-color: #35415c; background: #1a253c; }
.button-ghost { border-color: #303b54; background: transparent; color: #b8c4df; }
.button-danger { color: #ff9eaa; border-color: #5b2b3a; background: rgba(126, 38, 58, .18); }
.button-small { padding: 7px 10px; font-size: 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status-text { color: var(--muted); font-size: 12px; }
.list-heading { align-items: flex-end; }
.list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { width: 200px; padding: 9px 12px; font-size: 13px; }
.empty-state { border: 1px dashed #34415d; border-radius: 16px; text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state h3 { margin: 12px 0 4px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }
.empty-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--accent-2); background: #222d4a; font-size: 26px; }
.games-list { display: grid; gap: 15px; }
.game-card { border: 1px solid #2a3650; border-radius: 15px; overflow: hidden; background: rgba(8, 14, 27, .5); }
.game-card-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid #26314a; }
.game-title-wrap { min-width: 0; }
.game-title { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.updated-at { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-actions { display: flex; gap: 7px; flex-shrink: 0; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.text-box { min-width: 0; border: 1px solid #26324b; border-radius: 12px; background: #0b1221; overflow: hidden; }
.calculated-box { border-color: #33406a; }
.text-box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #26324b; color: #b6c3df; font-size: 11px; font-weight: 600; }
.calculated-box .text-box-head { color: #c2caff; }
.text-copy { padding: 4px 8px; border: 1px solid #35415c; border-radius: 6px; background: #18233a; color: #d7dfff; font-size: 10px; }
pre { margin: 0; padding: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: #c6d0e5; font: 12px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; min-height: 48px; }
.calculated-output { color: #eef0ff; }
footer { padding: 0 0 28px; text-align: center; color: #64728f; font-size: 11px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid #3b4c6a; border-radius: 12px; background: #18233a; color: var(--text); box-shadow: 0 12px 35px #0005; font-size: 13px; }
@media (max-width: 760px) {
  .app-shell { width: min(100% - 22px, 600px); }
  .topbar { align-items: flex-start; flex-direction: column; padding-top: 28px; }
  .panel { padding: 17px; border-radius: 16px; }
  .settings-grid, .comparison-grid { grid-template-columns: 1fr; }
  .list-heading { align-items: stretch; flex-direction: column; }
  .list-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .search-input { width: 100%; grid-column: 1 / -1; }
  .game-card-head { align-items: flex-start; }
}
@media (max-width: 430px) {
  .section-heading { align-items: flex-start; }
  .game-card-head { flex-direction: column; }
  .card-actions { width: 100%; }
  .card-actions .button { flex: 1; }
  .list-tools .button { padding-inline: 8px; }
}

/* WorkOS-inspired polish: atmospheric glow, restrained motion, luminous borders */
:root {
  --bg: #08090d;
  --panel: rgba(17, 18, 25, .78);
  --panel-2: #101117;
  --line: rgba(255,255,255,.11);
  --text: #f6f6f8;
  --muted: #9a9ba8;
  --accent: #c3ff6b;
  --accent-2: #d5ff9c;
}
body {
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 16% 2%, rgba(167, 255, 90, .13), transparent 28rem),
    radial-gradient(ellipse at 90% 13%, rgba(115, 90, 255, .16), transparent 32rem),
    radial-gradient(ellipse at 70% 70%, rgba(60, 215, 190, .06), transparent 34rem),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: auto, auto, auto, 46px 46px, 46px 46px;
  background-position: center top;
}
body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .22;
  pointer-events: none;
  animation: ambient-drift 17s ease-in-out infinite alternate;
}
body::before { top: 14%; left: -190px; background: #b5ff55; }
body::after { top: 42%; right: -210px; background: #7165ff; animation-delay: -7s; }
@keyframes ambient-drift { from { transform: translate3d(0,-18px,0) scale(.9); } to { transform: translate3d(65px,38px,0) scale(1.12); } }
.app-shell { position: relative; }
.topbar { padding-top: 62px; padding-bottom: 34px; animation: fade-up .7s cubic-bezier(.2,.75,.2,1) both; }
h1 { font-size: clamp(42px, 7vw, 76px); letter-spacing: -.065em; font-weight: 700; }
.topbar h1 {
  background: linear-gradient(100deg, #fff 12%, #d8ff9c 47%, #a4a7ff 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(193,255,107,.08));
}
.eyebrow { color: #d5ff9c; letter-spacing: .19em; }
.subtitle { font-size: 14px; }
.local-badge { color: #d8ffad; border-color: rgba(195,255,107,.25); background: rgba(195,255,107,.06); backdrop-filter: blur(12px); }
.dot { background: #c3ff6b; box-shadow: 0 0 16px rgba(195,255,107,.8); }
.panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 20px;
  border-color: rgba(255,255,255,.105);
  background: linear-gradient(145deg, rgba(23,24,32,.88), rgba(13,14,20,.82));
  box-shadow: 0 22px 70px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.035);
  backdrop-filter: blur(18px);
  animation: fade-up .65s cubic-bezier(.2,.75,.2,1) both;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.panel:nth-child(2) { animation-delay: .08s; }
.panel:nth-child(3) { animation-delay: .16s; }
.panel::before {
  content: "";
  position: absolute;
  inset: 0 22% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(205,255,145,.45), transparent);
  opacity: .7;
  pointer-events: none;
}
.panel:hover { border-color: rgba(195,255,107,.2); box-shadow: 0 24px 75px rgba(0,0,0,.24), 0 0 35px rgba(195,255,107,.025); }
.section-heading h2 { letter-spacing: -.025em; }
.field { color: #d0d0da; }
.field input, .field textarea, .search-input {
  border-color: rgba(255,255,255,.13);
  border-radius: 11px;
  background: rgba(5,6,10,.72);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input:hover, .field textarea:hover, .search-input:hover { border-color: rgba(255,255,255,.25); }
.field input:focus, .field textarea:focus, .search-input:focus {
  border-color: rgba(195,255,107,.7);
  background: rgba(8,10,12,.95);
  box-shadow: 0 0 0 3px rgba(195,255,107,.09), 0 0 24px rgba(195,255,107,.045);
}
.button { position: relative; overflow: hidden; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.2), transparent 75%);
  transform: translateX(-130%);
  transition: transform .55s ease;
  pointer-events: none;
}
.button:hover::after { transform: translateX(130%); }
.button-primary { color: #10120b; background: linear-gradient(110deg, #d7ff9c, #baff68 55%, #e5ffbf); box-shadow: 0 5px 24px rgba(195,255,107,.13); }
.button-primary:hover { box-shadow: 0 7px 30px rgba(195,255,107,.25); }
.button-secondary { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.055); }
.button-secondary:hover, .button-ghost:hover { border-color: rgba(195,255,107,.32); background: rgba(195,255,107,.07); }
.button-ghost { border-color: rgba(255,255,255,.12); color: #d0d0da; }
.button-danger { border-color: rgba(255,114,133,.24); background: rgba(255,80,105,.07); }
.empty-state { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.015); }
.empty-icon { color: #d5ff9c; background: rgba(195,255,107,.09); border: 1px solid rgba(195,255,107,.15); }
.game-card {
  border-color: rgba(255,255,255,.11);
  background: linear-gradient(135deg, rgba(24,25,33,.8), rgba(10,11,16,.82));
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  animation: fade-up .45s ease both;
}
.game-card:hover { transform: translateY(-3px); border-color: rgba(195,255,107,.32); box-shadow: 0 18px 42px rgba(0,0,0,.22), 0 0 28px rgba(195,255,107,.035); }
.game-card-head { border-bottom-color: rgba(255,255,255,.09); }
.text-box { border-color: rgba(255,255,255,.1); background: rgba(4,5,9,.5); }
.calculated-box { border-color: rgba(195,255,107,.19); }
.text-box-head { border-bottom-color: rgba(255,255,255,.08); }
.calculated-box .text-box-head { color: #d5ff9c; }
.text-copy { border-color: rgba(195,255,107,.2); background: rgba(195,255,107,.06); color: #e1ffbc; transition: background .2s ease, border-color .2s ease; }
.text-copy:hover { background: rgba(195,255,107,.13); border-color: rgba(195,255,107,.42); }
pre { color: #c6c6d0; }
.calculated-output { color: #f4f8eb; }
.toast { border-color: rgba(195,255,107,.28); background: rgba(19,22,20,.94); box-shadow: 0 12px 40px #0008, 0 0 24px rgba(195,255,107,.06); backdrop-filter: blur(18px); }
footer { color: #70717d; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media (max-width: 760px) {
  .topbar { padding-top: 36px; }
  h1 { font-size: clamp(38px, 11vw, 56px); }
}
