:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #5b6478;
  --line: #dde3ee;
  --accent: #2f54eb;
  --accent-dark: #1f3bb0;
  --danger: #c62828;
  --ok: #1b7f3a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Noto Sans Myanmar", "Padauk", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(120deg, #1d2b64 0%, #2f54eb 60%, #3f7bfa 100%);
  color: #fff;
  padding: 34px 20px 30px;
}

.app-header-inner { max-width: 920px; margin: 0 auto; }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-btn {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.lang-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lang-btn:active { transform: scale(0.97); }

.app-header h1 {
  margin: 0 6px 6px 0;
  font-size: 30px;
  letter-spacing: 0.2px;
}

.app-header .desc { margin: 4px 0 0; font-size: 16px; opacity: 0.95; }

main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* Error banner */
.error-box {
  background: #fdecea;
  border: 1px solid #f5b5ae;
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
}
.error-box .err-close {
  float: right;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #b9c4dc;
  border-radius: var(--radius);
  padding: 34px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  outline: none;
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--accent); background: #f6f8ff; }
.drop-zone.dragover { border-color: var(--accent); background: #eef2ff; }

.drop-icon { font-size: 38px; line-height: 1; margin-bottom: 10px; }

.my-line { font-size: 16px; font-weight: 600; }
.en-line { font-size: 13px; color: var(--muted); margin-top: 2px; }
.formats {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  background: #f2f4fa;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  padding: 4px 12px;
}

/* Pending chips */
.pending-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pending-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f7fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px 6px 6px;
  font-size: 13px;
}
.pending-list img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  background: #e6eaf3;
}
.pending-list .p-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-list button {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 15px; padding: 0 2px; line-height: 1;
}
.pending-list button:hover { color: var(--danger); }

/* Buttons */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.05s ease, background 0.12s ease;
  font-family: inherit;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-dark); }

.btn-secondary { background: #e8edfb; color: var(--accent-dark); }
.btn-secondary:not(:disabled):hover { background: #dce4f8; }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:not(:disabled):hover { background: #f2f4fa; color: var(--ink); }
.btn-ghost.danger:hover { color: var(--danger); border-color: #f0b9b4; }

#extractBtn { margin-top: 16px; width: 100%; padding: 14px; font-size: 16px; }
#extractBtn .spin {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 12px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.status.ok { color: var(--ok); }

/* Results */
.results-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.results-head h2 { margin: 0 0 2px; font-size: 19px; }
.results-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }

#cards { display: flex; flex-direction: column; gap: 12px; }

.sec {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fbfcfe;
}
.sec header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #f1f4fb;
  border-bottom: 1px solid var(--line);
}
.sec .badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sec header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sec .rm {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
}
.sec .rm:hover { color: var(--danger); background: #fdecea; }

.sec textarea {
  width: 100%;
  border: 0;
  resize: vertical;
  min-height: 150px;
  max-height: 70vh;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  outline: none;
}
.sec textarea:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--accent); }

.edit-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* Export style panel */
/* (the site's own --accent variables above are unrelated) */
.style-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fc;
  overflow: hidden;
}
.style-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #222);
  cursor: pointer;
}
.style-toggle:hover { background: #eef1f8; }
.style-toggle .chev { transition: transform 0.15s ease; font-size: 11px; opacity: 0.7; }
.style-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.style-body { padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.style-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; flex-wrap: wrap; }
.style-label { font-size: 12.5px; color: var(--muted); min-width: 64px; }
.style-row input[type="range"] { flex: 1 1 140px; accent-color: #1d2b64; }
.size-val { font-size: 12.5px; color: var(--muted); min-width: 52px; }
.link-btn {
  border: none; background: none;
  font: inherit; font-size: 12.5px;
  color: var(--accent-dark, #1f3bb0);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: var(--accent, #2f54eb); }

/* Footer */
.app-footer {
  border-top: 1px solid var(--line);
  background: #e8ebf3;
  padding: 18px 20px 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.app-footer p { margin: 2px 0; }
.foot-pow { opacity: 0.85; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #222a3d;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 50;
  max-width: min(92vw, 560px);
  text-align: center;
}

/* Word → PDF converter */
.conv-card h2 { margin: 0 0 2px; font-size: 19px; }
.conv-card .en-line { margin: 0 0 14px; }
.conv-drop { padding: 22px 14px; }
.conv-drop .drop-icon { font-size: 30px; margin-bottom: 6px; }
.conv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.conv-file-name {
  font-size: 13px;
  color: var(--muted);
  flex: 1 1 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .app-header { padding: 24px 16px 22px; }
  .app-header h1 { font-size: 23px; }
  .results-head { flex-direction: column; }
  .results-head .actions { width: 100%; }
  .results-head .actions .btn { flex: 1 1 45%; }
  .conv-actions .btn { flex: 1 1 45%; }
}
