:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #0f1117;
  color: #e6e9ef;
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 12px;
}

.toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
}

.made-by-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #b7c1d7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  position: relative;
  z-index: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.made-by-btn:hover {
  background: #1b202b;
  border-color: #4b5570;
  color: #d7e0f3;
}

.toolbar-logo {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  opacity: 0.98;
  pointer-events: none;
  user-select: none;
}

.toolbar-logo img {
  height: 300%;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.45));
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.lang-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.lang-select select {
  border: 1px solid #3d4458;
  background: #171a22;
  color: #e6e9ef;
  border-radius: 6px;
  padding: 6px 8px;
}

.link-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #3a4154;
  background: #161a23;
  color: #9aa3b8;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.link-toggle svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.link-toggle:hover {
  background: #1b202b;
  border-color: #48516a;
}

.link-toggle.is-active {
  border-color: #4f6d9a;
  background: #1a2538;
  color: #b9d4ff;
  box-shadow: inset 0 0 0 1px rgba(120, 164, 230, 0.18);
}

.link-toggle:not(.is-active) {
  border-color: #3d4458;
  background: #171a22;
  color: #9aa3b8;
}

.diff-toggle {
  height: 34px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9aa3b8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.diff-toggle:hover {
  background: #1b202b;
  border-color: #4b5570;
}

.diff-toggle.is-active {
  border-color: #6a5f9a;
  background: #211d33;
  color: #d6c9ff;
}

.convert-btn {
  height: 34px;
  min-width: 72px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9aa3b8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.convert-btn:hover {
  background: #1b202b;
  border-color: #4b5570;
}

.convert-btn.is-success {
  border-color: #3a8a66;
  background: #163327;
  color: #9ce7c2;
}

.editors {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid #272d3c;
  border-radius: 8px;
  overflow: hidden;
  background: #11141b;
  position: relative;
}

.panel.is-drag-over {
  border-color: #58a6ff;
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.3) inset;
}

.panel.is-drag-over > *:not(.drop-overlay) {
  opacity: 0.28;
  filter: blur(1px);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(15, 17, 23, 0.22);
}

.drop-overlay svg {
  width: 92px;
  height: 92px;
  fill: #8bc0ff;
  filter: drop-shadow(0 0 16px rgba(88, 166, 255, 0.45));
  opacity: 0.95;
}

.panel.is-drag-over .drop-overlay {
  display: flex;
}

.panel-title {
  padding: 8px 10px;
  font-size: 13px;
  color: #b5bdd1;
  border-bottom: 1px solid #272d3c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-language-select {
  height: 28px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #e6e9ef;
  border-radius: 6px;
  padding: 0 28px 0 8px;
  font-size: 12px;
  line-height: 28px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aa3b8' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.panel-language-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border: 1px solid #3d4458;
}

.panel-language-select:focus,
.panel-language-select:focus-visible,
.panel-language-select:active {
  outline: none;
  box-shadow: none;
  border: 1px solid #3d4458;
}

.tree-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9aa3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tree-action:hover {
  background: #1b202b;
  border-color: #4b5570;
  color: #c4cde2;
}

.wrap-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9aa3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wrap-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.wrap-toggle:hover {
  background: #1b202b;
  border-color: #4b5570;
}

.wrap-toggle.is-active {
  border-color: #4f6d9a;
  background: #1a2538;
  color: #b9d4ff;
}

.magic-format-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #bca7ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.magic-format-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.magic-format-btn:hover {
  background: #211d33;
  border-color: #6a5f9a;
  color: #d6c9ff;
}

.copy-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9fb6d8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.copy-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.copy-btn:hover {
  background: #1b2330;
  border-color: #56719d;
  color: #c5dcff;
}

.copy-btn.is-success {
  border-color: #3a8a66;
  background: #163327;
  color: #9ce7c2;
}

.download-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #d1b480;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.download-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.download-btn:hover {
  background: #2a2316;
  border-color: #9b7a3f;
  color: #ffe2aa;
}

.download-btn.is-success {
  border-color: #3a8a66;
  background: #163327;
  color: #9ce7c2;
}

.upload-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #b8c98f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.upload-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.upload-btn:hover {
  background: #1f2817;
  border-color: #7f9653;
  color: #def0b4;
}

.upload-btn.is-success {
  border-color: #3a8a66;
  background: #163327;
  color: #9ce7c2;
}

.hidden-file-input {
  display: none;
}

.editor {
  min-height: 0;
  width: 100%;
  height: 100%;
}

.preview-toggle {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #3d4458;
  background: #171a22;
  color: #9aa3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.preview-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.preview-toggle:hover {
  background: #1b202b;
  border-color: #4b5570;
}

.preview-toggle.is-active {
  border-color: #4f6d9a;
  background: #1a2538;
  color: #b9d4ff;
}

.preview {
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #0f1117;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.is-hidden {
  display: none;
}

.monaco-editor .diff-line-changed {
  background: rgba(121, 97, 199, 0.25) !important;
}

.monaco-editor .diff-line-gutter {
  border-left: 2px solid #8d78d8;
}

.monaco-editor .diff-inline-changed {
  background: rgba(168, 85, 247, 0.35);
  border-radius: 3px;
}

.monaco-editor .diff-peer-focus-line {
  background: rgba(88, 166, 255, 0.22) !important;
}

.monaco-editor .diff-peer-focus-gutter {
  border-left: 2px solid #58a6ff;
}

.monaco-editor .diff-self-focus-line {
  background: rgba(149, 116, 255, 0.28) !important;
}

.monaco-editor .diff-self-focus-gutter {
  border-left: 2px solid #9574ff;
}

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

@media (max-width: 760px) {
  .toolbar-logo {
    display: none;
  }
}
