@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/sora/sora-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/sora/sora-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono/ibm-plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono/ibm-plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono/ibm-plex-mono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono/ibm-plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --black: #000000;
  --red: #a21316;
  --mint: #9cc9b7;
  --mint-soft: #e8f4ef;
  --mint-strong: #7fb59f;
  --white: #ffffff;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.22);
  --text: var(--black);
  --muted: rgba(0, 0, 0, 0.55);
  --accent: var(--red);
  --accent-soft: var(--mint-soft);
  --danger: var(--red);
  --ok: #1f6b4f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
  --radius: 22px;
  --font-display: "Sora", sans-serif;
  --font-body: "Sora", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1100px 680px at 8% -10%, rgba(156, 201, 183, 0.45), transparent 55%),
    radial-gradient(900px 560px at 100% 0%, rgba(162, 19, 22, 0.08), transparent 48%),
    linear-gradient(165deg, #f7fbf9 0%, #eef6f2 48%, #f8faf9 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 18%, transparent 72%);
  opacity: 0.8;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app {
  position: relative;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.brand {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: rise 0.7s ease both;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.4vw, 3.9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--black);
}

.brand h1 span {
  display: block;
  color: var(--red);
  font-weight: 700;
}

.brand p {
  margin: 0;
  max-width: 28ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  text-align: right;
}

.tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  animation: rise 0.7s ease 0.08s both;
}

.tab {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tab:hover {
  color: var(--black);
}

.tab.is-active {
  background: var(--red);
  color: var(--white);
  transform: translateY(-1px);
}

.panel {
  animation: rise 0.55s ease both;
}

.panel[hidden] {
  display: none !important;
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(0, 0, 0, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f3f9f6);
  min-height: 280px;
  padding: 2rem;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.25s ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--red);
  background: linear-gradient(180deg, #ffffff, #eaf4ef);
  transform: translateY(-2px);
}

.dropzone.is-dragover {
  box-shadow: 0 0 0 4px rgba(156, 201, 183, 0.45), var(--shadow);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--mint);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--black);
  animation: floaty 3.4s ease-in-out infinite;
}

.drop-icon svg {
  width: 30px;
  height: 30px;
}

.dropzone h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--black);
}

.dropzone p {
  margin: 0;
  color: var(--muted);
}

.dropzone .hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.45);
}

.decode-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.decode-box label {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.decode-box textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--black);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
}

.decode-box textarea:focus {
  outline: 2px solid rgba(156, 201, 183, 0.7);
  border-color: var(--mint-strong);
}

.decode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--red);
  color: var(--white);
}

.btn-primary:hover {
  background: #8b1013;
}

.btn-ghost {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--line-strong);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.status {
  margin-top: 1rem;
  min-height: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

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

.results {
  display: none;
  margin-top: 1.5rem;
  animation: rise 0.5s ease both;
}

.results.is-visible {
  display: grid;
  gap: 1rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--black);
  font-size: 0.82rem;
}

.chip strong {
  color: var(--red);
  font-weight: 700;
}

.chip.warn strong {
  color: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
}

.preview {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(45deg, #dcebe4 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #dcebe4 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #dcebe4 75%) 0 0 / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #dcebe4 75%) 0 0 / 16px 16px,
    #f4faf7;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  min-height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 1rem;
}

.preview img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.preview-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.outputs {
  display: grid;
  gap: 0.85rem;
}

.output {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.04);
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--mint-soft);
}

.output-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--black);
}

.output-head span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-body);
}

.copy-btn {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  background: var(--mint);
  color: var(--black);
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.copy-btn:hover {
  background: var(--mint-strong);
}

.copy-btn.is-copied {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.output pre {
  margin: 0;
  padding: 0.9rem 1rem 1.1rem;
  max-height: 140px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--black);
  white-space: pre-wrap;
  word-break: break-all;
}

.download-row {
  display: none;
}

.download-row.is-visible {
  display: block;
}

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

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 820px) {
  .brand {
    flex-direction: column;
    align-items: start;
  }

  .brand p {
    text-align: left;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .preview {
    min-height: 180px;
  }
}
