:root {
  --bg: #0f0c29;
  --bg-2: rgba(19, 23, 44, 0.88);
  --bg-3: rgba(31, 37, 66, 0.82);
  --border: rgba(143, 154, 208, 0.28);
  --text: #e9eeff;
  --dim: #9da9d4;
  --primary: #64ffda;
  --primary-2: #4facfe;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(900px 580px at 15% -10%, rgba(79, 172, 254, 0.25), transparent 60%),
    radial-gradient(860px 520px at 85% 0%, rgba(100, 255, 218, 0.18), transparent 65%),
    linear-gradient(135deg, #0f0c29 0%, #1f1b45 45%, #161730 100%);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.brand-wrap {
  min-width: 0;
}

.brand {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand span {
  color: var(--primary);
}

.desc {
  margin-top: 4px;
  color: var(--dim);
  font-size: 12px;
}

.top-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mapping-panel {
  position: absolute;
  right: 14px;
  top: 56px;
  z-index: 60;
  width: min(520px, calc(100vw - 28px));
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  padding: 10px;
  box-shadow: 0 12px 36px rgba(5, 8, 20, 0.45);
}

.mapping-title {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
}

.sep {
  width: 1px;
  height: 22px;
  background: var(--border);
}

select,
button {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1d2447cc;
  color: var(--text);
  padding: 0 12px;
}

select {
  min-width: 180px;
}

button {
  cursor: pointer;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  color: #0f1833;
  border: none;
  font-weight: 600;
}

.ghost-btn {
  background: rgba(79, 172, 254, 0.14);
  color: #b9dcff;
  border: 1px solid rgba(79, 172, 254, 0.35);
}

.file-name {
  color: var(--dim);
  font-size: 12px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  color: var(--dim);
  font-size: 12px;
  min-height: 16px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-bar {
  padding: 0 12px 8px;
  background: rgba(16, 21, 40, 0.72);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 4;
}

.hint {
  color: var(--dim);
  font-size: 12px;
  margin: 0;
  min-height: 18px;
}

.tiny {
  font-size: 11px;
  min-height: 0;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#resultWrap {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: flex;
  gap: 10px;
}

.input-pane,
.output-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pane-label {
  font-size: 11px;
  color: var(--dim);
  padding: 0 2px 2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.pane-hint {
  font-size: 10px;
  color: rgba(157, 169, 212, 0.55);
}

.input-drop-zone {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  transition: box-shadow 0.15s;
}

.input-drop-zone.drag-over {
  box-shadow: 0 0 0 2px var(--primary);
}

.input-box {
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0f22cc;
  color: #dce5ff;
  padding: 12px;
  font-family: "Consolas", "Cascadia Code", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.15s;
}

.input-box:focus {
  border-color: rgba(79, 172, 254, 0.5);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.result {
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0f22cc;
  color: #dce5ff;
  padding: 12px;
  font-family: "Consolas", "Cascadia Code", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  select {
    min-width: 130px;
  }

  .file-name {
    max-width: 180px;
  }

  #resultWrap {
    flex-direction: column;
  }

  .input-pane,
  .output-pane {
    min-height: 200px;
  }
}

@media (max-width: 580px) {
  .brand {
    font-size: 18px;
  }

  .desc {
    display: none;
  }

  .mapping-panel {
    top: 52px;
  }

  .file-name {
    max-width: 120px;
  }

  .status {
    white-space: normal;
  }
}
