:root {
  --g1: #667eea;
  --g2: #764ba2;
  --g3: #f64f59;
  --g4: #c471ed;
  --g5: #12c2e9;
  --accent: #ffd700;
  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Kanit", sans-serif;
  background: #0f0c29;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 12s ease-in-out infinite alternate;
}
.orb1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #667eea, #764ba2);
  top: -200px;
  left: -150px;
  animation-delay: 0s;
}
.orb2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #f64f59, #c471ed);
  bottom: -150px;
  right: -100px;
  animation-delay: -4s;
}
.orb3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #12c2e9, #667eea);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, 30px) scale(1.1);
  }
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 2px;
  text-align: center;
  line-height: 1.2;
}
.loader-logo span {
  background: linear-gradient(90deg, #ffd700, #f64f59, #c471ed, #667eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loader-sub {
  font-family: "Sarabun", sans-serif;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.loader-bar-wrap {
  width: 260px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  overflow: hidden;
}
.loader-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #667eea, #c471ed, #ffd700);
  animation: loadBar 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes loadBar {
  0% {
    width: 0%;
  }
  60% {
    width: 75%;
  }
  100% {
    width: 100%;
  }
}

.loader-dots {
  display: flex;
  gap: 8px;
}
.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--white);
  opacity: 0.3;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.loader-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes dotPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.4);
  }
}

#app {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease 0.1s, transform 0.7s ease 0.1s;
}
#app.show {
  opacity: 1;
  transform: translateY(0);
}

#app-error {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f0c29, #302b63);
  color: var(--white);
  text-align: center;
  font-family: "Sarabun", sans-serif;
  line-height: 1.6;
}
#app-error.visible {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#app-error code {
  font-size: 0.85rem;
  opacity: 0.85;
  word-break: break-all;
}

header {
  position: relative;
  z-index: 20;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(15, 12, 41, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea, #c471ed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.5px;
}
.brand-name span {
  background: linear-gradient(90deg, #667eea, #c471ed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Sarabun", sans-serif;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}
.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.refresh-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--white);
  padding: 6px 14px;
  font-family: "Kanit", sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.refresh-btn:disabled {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}
.refresh-btn svg {
  width: 13px;
  height: 13px;
}

.iframe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

.iframe-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #667eea, #c471ed, #f64f59, #ffd700);
  z-index: 5;
}
