:root {
  --bg: #0f1115;
  --card: #161a22;
  --muted: #8b93a7;
  --text: #e6e9f2;
  --accent: #7c9cff;
  --accent-2: #26c281;
  --danger: #ff6b6b;
  --warning: #ffb020;
  --border: #232838;
}
html[data-theme="light"] {
  --bg: #f6f7fb;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #0f172a;
  --accent: #3b82f6;
  --accent-2: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  background: radial-gradient(
      1200px 600px at 20% -10%,
      rgba(124, 156, 255, 0.12),
      transparent 60%
    ),
    radial-gradient(
      1000px 500px at 120% 0%,
      rgba(38, 194, 129, 0.1),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  width: min(900px, 96vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(124, 156, 255, 0.12), transparent);
  justify-content: space-between;
}
.header-left {
  display: flex;
  gap: 12px;
  align-items: center;
}
.header h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.2px;
}
.sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.content {
  padding: 20px 24px 24px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 800px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.drop {
  border: 1px dashed var(--border);
  background: rgba(124, 156, 255, 0.05);
  padding: 16px;
  border-radius: 12px;
  transition: 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.drop:hover {
  border-color: var(--accent);
}
.drop.dragover {
  border-color: var(--accent);
  background: rgba(124, 156, 255, 0.12);
}
.drop .title {
  font-weight: 600;
  font-size: 14px;
}
.drop .hint {
  color: var(--muted);
  font-size: 12px;
}
.file-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  overflow: hidden;
}
.status {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.status.ok {
  background: rgba(38, 194, 129, 0.1);
  border-color: rgba(38, 194, 129, 0.35);
}
.status.err {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.35);
}
.status.warn {
  background: rgba(255, 176, 32, 0.1);
  border-color: rgba(255, 176, 32, 0.35);
}

.actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
button {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
  font-size: 14px;
}
button.secondary {
  background: transparent;
  color: var(--text);
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.muted {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.muted.center {
  justify-self: center;
}

input[type="file"] {
  display: none;
}
.file-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(124, 156, 255, 0.15);
  border: 1px solid var(--border);
  cursor: pointer;
  width: max-content;
}
.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(124, 156, 255, 0.12);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* Simple Header Description */
.header-description {
  text-align: center;
  padding: 40px 24px;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.header-description h1 {
  margin: 0 0 16px 0;
  font-size: 28px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: -0.5px;
  align-self: flex-start;
  width: 100%;
  text-align: center;
}
.header-description p {
  margin: 0 0 24px 0;
  line-height: 1.7;
  color: var(--text);
  font-size: 16px;
  opacity: 0.9;
  align-self: flex-start;
  width: 100%;
  text-align: center;
}
.lang-toggle-btn {
  position: absolute;
  top: 40px;
  right: 24px;
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(124, 156, 255, 0.12);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s ease;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-toggle-btn:hover {
  background: rgba(124, 156, 255, 0.2);
  border-color: var(--accent);
}

@media (max-width: 768px) {
  .header-description {
    padding: 30px 20px;
  }
  .header-description h1 {
    font-size: 24px;
  }
  .header-description p {
    font-size: 15px;
  }
  .lang-toggle-btn {
    position: static;
    margin: 0 auto;
  }
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(124, 156, 255, 0.1);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  line-height: 1;
}
.model-chip .icon {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}
.model-chip strong {
  font-weight: 700;
}
#model-indicator {
  font-weight: 700;
  color: var(--accent);
  margin-left: 2px;
}
#remote-model-select {
  background-color: #000;   /* พื้นหลังสีดำ */
  color: #fff;              /* ตัวหนังสือสีขาว */
  border: 1px solid #444;   /* เส้นขอบ (ปรับได้) */
  padding: 0.5rem;
  border-radius: 6px;       /* ทำมุมโค้ง (ถ้าต้องการ) */
}
