:root {
  --bg: #020617;
  --card: #020617;
  --card-elevated: #020617;
  --border: #1e293b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.2);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --danger: #f97373;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #0f172a 0, #020617 50%, #000 100%);
  overflow-x: hidden;
  height: auto; /* вместо жёсткого 100% */
  min-height: 100%;
}

body {
  display: block;
  align-items: stretch;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 1200px;
  margin: 16px auto;
  padding: 20px 24px 24px;
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.09), transparent 40%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.12), #020617);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
}

.logo .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #e0f2fe, #38bdf8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}

.logo-text {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-title {
  flex: 1;
  margin-left: 16px;
}

.app-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.03em;
}

.app-title p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.btn.primary {
  background: radial-gradient(circle at 20% 0, #e0f2fe, #38bdf8);
  color: #0b1120;
  box-shadow: 0 14px 35px rgba(56, 189, 248, 0.45);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 45px rgba(56, 189, 248, 0.6);
}

.btn.ghost {
  background: rgba(15, 23, 42, 0.9);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.btn.ghost:hover {
  border-color: rgba(248, 250, 252, 0.8);
  color: #e5e7eb;
}

.status {
  min-width: 180px;
  font-size: 12px;
  color: var(--muted);
}

.status.ok,
.status.success {
  color: #4ade80;
}

.status.error {
  color: var(--danger);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.panel {
  background: rgba(15, 23, 42, 0.92);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(30, 64, 175, 0.75);
  box-shadow: 0 14px 45px rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-header span {
  font-size: 13px;
  font-weight: 500;
}

.panel-header small {
  font-size: 11px;
  color: var(--muted);
}

textarea {
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 180px;
  max-height: 40vh;
  overflow: auto;
}

textarea::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.app-footer {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: flex-end;
  padding-bottom: 12px;
}

/* File controls */
.file-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-input-label {
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--muted);
}

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

/* --- Footer unified with FixTools.dev main site --- */

.app-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Social links */
.social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0;
}

.social-link {
  color: var(--accent);
  opacity: 0.75;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    filter 0.2s ease;
}

.social-link:hover {
  opacity: 1;
  transform: translateY(-2px);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
}

/* SVG icon */
.icon {
  width: 22px;
  height: 22px;
  display: block;
}

/* Light theme */

body.theme-light {
  background: radial-gradient(circle at top left, #e5f2ff 0, #f8fafc 50%, #e5e7eb 100%);
  color: #0f172a;
}

body.theme-light .app {
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.06), rgba(248, 250, 252, 0.9)),
    radial-gradient(circle at bottom right, rgba(191, 219, 254, 0.4), #f8fafc);
  border-color: rgba(148, 163, 184, 0.4);
}

body.theme-light .panel {
  background: #f9fafb;
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}

body.theme-light textarea {
  background: #f9fafb;
  color: #0f172a;
}

body.theme-light .logo {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(148, 163, 184, 0.5);
}

body.theme-light .logo-text,
body.theme-light .app-title p,
body.theme-light .status,
body.theme-light .file-name {
  color: #4b5563;
}

body.theme-light .btn.ghost {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(148, 163, 184, 0.7);
  color: #111827;
}

body.theme-light .btn.ghost:hover {
  border-color: #0ea5e9;
}

.status.ok {
  color: #4ade80;
}

/* Mobile */
@media (max-width: 750px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* убираем горизонтальный скролл полностью */
  }

  .app {
    width: 100%;
    max-width: 100%;
    margin: 12px 8px 24px;
    padding: 16px;
    box-sizing: border-box;
    border-radius: 18px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-title {
    margin-left: 0;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel {
    border-radius: 18px;
    margin: 0;
    overflow: hidden;
  }

  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 140px;
    max-height: 32vh;
  }

  .buttons {
    justify-content: flex-start;
  }
}