:root {
  --bg-main: #f8f6ef;
  --bg-soft: #f3efe4;
  --text-main: #182026;
  --text-soft: #52606d;
  --accent: #007e85;
  --accent-strong: #005f64;
  --accent-warm: #f1833a;
  --ok: #177245;
  --err: #b22e2e;
  --border: rgba(24, 32, 38, 0.12);
  --shadow: 0 18px 45px rgba(20, 32, 37, 0.12);
  --font-ui: "Segoe UI Variable Display", "Avenir Next", "Trebuchet MS", sans-serif;
  --font-code: "JetBrains Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: 78px;
  font-family: var(--font-ui);
  color: var(--text-main);
  background:
    radial-gradient(circle at 9% 15%, rgba(0, 126, 133, 0.14), transparent 36%),
    radial-gradient(circle at 85% 22%, rgba(241, 131, 58, 0.17), transparent 34%),
    linear-gradient(140deg, var(--bg-main), var(--bg-soft));
  position: relative;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

.bg-shape-a {
  width: 380px;
  height: 380px;
  left: -120px;
  top: 40%;
  background: rgba(0, 126, 133, 0.11);
  animation: driftA 10s ease-in-out infinite alternate;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  right: -100px;
  top: 12%;
  background: rgba(241, 131, 58, 0.14);
  animation: driftB 9s ease-in-out infinite alternate;
}

@keyframes driftA {
  from { transform: translateY(-12px); }
  to { transform: translateY(18px); }
}

@keyframes driftB {
  from { transform: translateY(16px); }
  to { transform: translateY(-14px); }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fixed-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  padding: 10px 12px;
  background: rgba(248, 246, 239, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.fixed-nav-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.fixed-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fixed-links a {
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.fixed-links a:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.fixed-links a.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.page-search {
  margin-left: auto;
  min-width: 260px;
  max-width: 420px;
  width: 38%;
}

.page-search input {
  width: 100%;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-main);
  font-family: var(--font-ui);
}

.page-search input:focus {
  outline: 2px solid rgba(0, 126, 133, 0.2);
  border-color: rgba(0, 126, 133, 0.35);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 18px 52px;
  position: relative;
  z-index: 1;
}

.shell-wide {
  max-width: 1320px;
}

.hero {
  margin-bottom: 18px;
  animation: reveal 560ms ease-out both;
}

.hero-tag {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1 {
  margin: 8px 0 6px;
  font-size: clamp(1.5rem, 2.3vw, 2.35rem);
}

.hero p {
  margin: 0;
  color: var(--text-soft);
}

.card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(7px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  margin-top: 14px;
  box-shadow: var(--shadow);
  animation: reveal 560ms ease-out both;
}

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

h2 {
  margin: 0;
  font-size: 1.14rem;
}

.home-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.nav-tile {
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-decoration: none;
  color: var(--text-main);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  padding: 16px;
  transition: transform .16s ease, border-color .16s ease;
}

.nav-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 126, 133, 0.5);
}

.nav-tile strong {
  font-size: 1.03rem;
}

.nav-tile span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.tool-grid > .card {
  margin-top: 0;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card > .split + .btn-row {
  margin-top: 12px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  cursor: pointer;
  transition: transform .16s ease, opacity .2s ease;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.split-large {
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.panel > span {
  font-size: 0.9rem;
  color: var(--text-soft);
}

textarea,
.code-output,
.text-input,
input[type="file"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-main);
}

textarea,
.code-output,
.text-input {
  padding: 12px;
  line-height: 1.55;
  font-size: 0.93rem;
}

textarea,
.code-output {
  min-height: 170px;
  resize: vertical;
  font-family: var(--font-code);
}

.json-editor {
  min-height: 70vh;
  max-height: 78vh;
}

.text-input {
  min-height: 44px;
  font-family: var(--font-code);
}

input[type="file"] {
  min-height: 42px;
  padding: 8px;
  font-family: var(--font-ui);
}

textarea:focus,
.text-input:focus,
input[type="file"]:focus {
  outline: 2px solid rgba(0, 126, 133, 0.2);
  border-color: rgba(0, 126, 133, 0.35);
}

.code-output {
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.file-panel {
  margin-top: 12px;
}

.image-preview-wrap {
  margin-top: 12px;
  min-height: 150px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.image-preview-wrap img {
  max-width: 100%;
  max-height: 280px;
  display: block;
}

.status {
  min-height: 1.2em;
  margin: 11px 2px 2px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}

.search-empty {
  margin: 12px 2px 0;
  color: var(--text-soft);
}

.is-hidden {
  display: none !important;
}

.json-key { color: #9f3e00; }
.json-string { color: #0d6d73; }
.json-number { color: #5655b8; }
.json-boolean { color: #aa2f62; }
.json-null { color: #6e7488; }

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

@media (max-width: 900px) {
  body {
    padding-top: 126px;
  }

  .fixed-nav-inner {
    flex-wrap: wrap;
  }

  .page-search {
    width: 100%;
    max-width: none;
    min-width: 0;
    order: 3;
  }

  .split,
  .split-large,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .json-editor {
    min-height: 45vh;
    max-height: none;
  }

  textarea,
  .code-output {
    min-height: 180px;
  }
}
