:root {
  --bg: #0b0d13;
  --bg-alt: #111520;
  --surface: #161b28;
  --surface-hover: #1d2334;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(168, 85, 247, 0.5);
  --text: #f3f5fa;
  --text-muted: #9aa4b8;
  --accent: #9333ea;
  --accent-soft: #a855f7;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.bg-screentone {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    radial-gradient(circle at 18% 8%, rgba(147, 51, 234, 0.16), transparent 45%),
    radial-gradient(circle at 86% 22%, rgba(34, 211, 238, 0.1), transparent 40%),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 18px 18px;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.12em 0.38em;
  border-radius: 6px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 13, 19, 0.85);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
  flex-wrap: wrap;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}

.brand-icon {
  border-radius: 8px;
}

.brand-name {
  font-size: 1.08rem;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.28);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-badge.online {
  color: var(--green);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}

.status-badge.offline {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  padding: 0.62rem 1.05rem;
  font-size: 0.9rem;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.44rem 0.85rem;
  font-size: 0.84rem;
}

.btn-lg {
  padding: 0.78rem 1.4rem;
  font-size: 0.96rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7e22ce);
  color: #fff;
  box-shadow: 0 10px 26px rgba(147, 51, 234, 0.3);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

/* Main */
.app-main {
  padding: 2rem 0 4rem;
}

.hero-compact {
  margin-bottom: 1.4rem;
}

.hero-compact h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -0.02em;
}

.hero-compact p {
  margin: 0;
  color: var(--text-muted);
  max-width: 72ch;
}

/* Backend bar */
.backend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.32);
  margin-bottom: 1.25rem;
}

.backend-bar[hidden] {
  display: none;
}

.backend-bar-text strong {
  display: block;
  color: var(--amber);
  font-size: 0.92rem;
}

.backend-bar-text span {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.backend-form {
  display: flex;
  gap: 0.5rem;
  flex: 1 1 280px;
  max-width: 420px;
}

.backend-form input {
  flex: 1;
}

/* Workspace Card */
.workspace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.5rem;
  align-items: start;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: #0d111b;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.58rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(168, 85, 247, 0.4);
  border-radius: 12px;
  background: #0e121d;
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.dropzone-inner strong {
  color: var(--text);
  font-size: 0.98rem;
}

.dropzone-inner span {
  font-size: 0.82rem;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.file-chip {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.25rem 0.55rem;
  border-radius: 7px;
  background: rgba(147, 51, 234, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.32);
  color: #e9d5ff;
}

/* Options */
.options-col {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.options-grid[hidden] {
  display: none;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.35rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent-soft);
}

/* Status banner */
.status-banner {
  margin-top: 1.15rem;
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #cffafe;
  font-size: 0.9rem;
}

.status-banner.error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.status-banner[hidden] {
  display: none;
}

/* Output Sections */
.output-section {
  margin-top: 2rem;
}

.output-section[hidden] {
  display: none;
}

.output-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.output-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.muted-text {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.psd-font-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.psd-font-picker input {
  width: 155px;
  padding: 0.36rem 0.55rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

/* Reader Strip */
/* Editor Workspace */
.editor-workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.25rem;
  align-items: start;
}

.editor-canvas-pane,
.editor-regions-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.page-tab {
  border: 1px solid var(--border);
  background: #0e121d;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
}

.page-tab.active {
  border-color: var(--accent-soft);
  color: #fff;
  background: rgba(147, 51, 234, 0.25);
}

.editor-preview-wrap {
  background: #090c12;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
}

.editor-preview-wrap img {
  max-width: 100%;
  max-height: 760px;
  height: auto;
  display: inline-block;
}

.editor-page-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.regions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.regions-header h3 {
  margin: 0;
  font-size: 1rem;
}

.regions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.region-row {
  background: #0f131f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}

.region-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
}

.region-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #e9d5ff;
  background: rgba(147, 51, 234, 0.28);
  padding: 0.1rem 0.42rem;
  border-radius: 5px;
}

.region-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.region-size-wrap input {
  width: 68px;
  padding: 0.28rem 0.45rem;
  font-size: 0.8rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

@media (max-width: 960px) {
  .workspace-grid,
  .editor-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}


#translation-file {
  width: 100%;
}

.unplaced-script {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.unplaced-script summary {
  cursor: pointer;
}
