:root {
  color-scheme: dark;
  --bg: #10151f;
  --panel: #1b2230;
  --panel-soft: #222a39;
  --text: #f5f7ff;
  --muted: #aeb8cc;
  --accent: #55d6be;
  --accent-strong: #ffcf5a;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top left, rgba(85, 214, 190, 0.2), transparent 34%),
    linear-gradient(135deg, #10151f 0%, #202335 50%, #151b22 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.workspace {
  width: min(1120px, 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel {
  background: rgba(27, 34, 48, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel,
.controls-panel {
  padding: 18px;
}

.drop-zone {
  min-height: 168px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 2px dashed rgba(85, 214, 190, 0.5);
  border-radius: 8px;
  background: rgba(85, 214, 190, 0.06);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.drop-zone strong {
  color: var(--text);
  font-size: 1.15rem;
}

.drop-zone.is-active {
  border-color: var(--accent-strong);
  background: rgba(255, 207, 90, 0.1);
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #06211c;
  font-size: 2rem;
  font-weight: 700;
}

.preview-frame {
  margin-top: 18px;
  min-height: 370px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.06) 75%);
  background-color: #151b24;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.preview-frame img {
  max-width: 100%;
  max-height: 520px;
  display: block;
}

.empty-preview {
  color: var(--muted);
}

.controls-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.file-facts,
.result-box {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-facts span,
.result-box span {
  color: var(--muted);
  font-size: 0.9rem;
}

.control-row,
.split-row label {
  display: grid;
  gap: 8px;
}

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

label {
  color: var(--muted);
  font-weight: 700;
}

select,
input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111824;
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preset-grid button,
.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.primary-button,
.download-button {
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #08231f;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.download-button {
  background: var(--accent-strong);
  color: #241a02;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
  }

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

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

  .preview-frame {
    min-height: 260px;
  }
}
/* THOFI PWA Background 2026-07-02 */
html {
  background: #05000c;
}

body {
  position: relative !important;
  isolation: isolate !important;
  background-color: #05000c !important;
  background-image: none !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 18%, rgba(123, 92, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(5, 0, 12, 0.78), rgba(5, 0, 12, 0.9)),
    url("thofi-site-bg.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.9;
}

body > * {
  position: relative;
  z-index: 1;
}
