:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #ededeb;
  --ink: #111111;
  --ink-invert: #ffffff;
  --muted: #686868;
  --line: #d9d9d4;
  --strong-line: #b9b9b2;
  --shadow: 0 24px 80px rgba(17, 17, 17, 0.10);
  --radius: 8px;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --ink: #f4f4f1;
  --ink-invert: #111111;
  --muted: #b8b8b0;
  --line: #333333;
  --strong-line: #555555;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, Arial, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.topbar,
.app-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.topnav a,
.icon-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}

.topnav a {
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.icon-link {
  width: 42px;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-toggle {
  display: none;
}

.android-download-link {
  display: none;
}

.mobile-tool-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: stretch;
  padding: 12px;
  background: rgba(17, 17, 17, 0.42);
}

.mobile-tool-menu[hidden] {
  display: none;
}

.mobile-tool-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  width: min(420px, 100%);
  max-height: calc(100vh - 24px);
  margin-left: auto;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mobile-tool-head h2 {
  margin: 0;
  font-size: 30px;
}

.mobile-tool-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.mobile-tool-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.mobile-tool-button.active {
  color: var(--ink-invert);
  background: var(--ink);
}

.android-app-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 17, 17, 0.52);
}

.download-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(17, 17, 17, 0.52);
}

.download-modal[hidden] {
  display: none;
}

.download-dialog {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.download-dialog h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.download-dialog p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.modal-download-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.modal-download-actions .download-link {
  width: 100%;
  min-height: 48px;
  color: var(--ink-invert);
  background: var(--ink);
  border-color: var(--ink);
}

.android-app-modal[hidden] {
  display: none;
}

.android-app-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.android-app-dialog img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.android-app-dialog h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.android-app-dialog p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  gap: 42px;
  align-items: center;
  width: min(1160px, calc(100% - 32px));
  min-height: calc(100vh - 96px);
  margin: 0 auto;
  padding: 46px 0 84px;
}

.hero-copy h1 {
  margin: 12px 0 18px;
  font-size: clamp(64px, 12vw, 150px);
  line-height: 0.86;
  letter-spacing: 0;
}

.hero-text {
  width: min(620px, 100%);
  margin: 0;
  color: var(--ink);
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.22;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.btn-primary {
  color: var(--ink-invert);
  background: var(--ink);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.58;
}

.btn-secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.hero-panel {
  min-height: 520px;
  display: grid;
  place-items: center;
}

.mock-window {
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid #c9c9c3;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mock-titlebar {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.mock-titlebar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.38;
}

.mock-chat {
  display: grid;
  gap: 14px;
  padding: 28px;
}

.bubble {
  width: fit-content;
  max-width: 86%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
}

.bubble.user {
  justify-self: end;
  color: var(--ink-invert);
  background: var(--ink);
  border-color: var(--ink);
}

.bubble.app {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.quick-grid span {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 800;
}

.section,
.workflow,
.footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.section {
  padding: 76px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h2,
.workflow h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

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

.tool-card {
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-card .material-symbols-rounded {
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: var(--ink-invert);
  background: var(--ink);
  border-radius: var(--radius);
}

.tool-card h3 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.tool-card p,
.tool-header p,
.result-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.workflow {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 24px;
  align-items: center;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ink-invert);
}

.workflow .eyebrow,
.workflow p {
  color: #cfcfca;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.workflow-steps div {
  display: grid;
  gap: 18px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
}

.workflow-steps strong {
  font-size: 42px;
}

.workflow-steps span {
  color: #e6e6e2;
  font-weight: 700;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 34px 0;
  color: var(--muted);
  font-weight: 700;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.footer-links a:hover {
  color: var(--ink);
}

.app-footer {
  padding-top: 0;
}

.legal-page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 34px;
}

.legal-hero {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.legal-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(42px, 8vw, 82px);
  line-height: 0.95;
  letter-spacing: 0;
}

.legal-hero p,
.legal-content p {
  color: var(--muted);
  line-height: 1.7;
}

.legal-content {
  display: grid;
  gap: 8px;
  padding-top: 28px;
}

.legal-content h2 {
  margin: 24px 0 0;
  font-size: 22px;
}

.legal-content p {
  margin: 0;
}

.legal-content a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.sidebar,
.tool-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 110px);
  min-height: 620px;
  padding: 18px;
  overflow: auto;
}

.sidebar h1 {
  margin: 0 0 22px;
  font-size: 36px;
  letter-spacing: 0;
}

.tab-list {
  display: grid;
  gap: 8px;
}

.tab-button {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  text-align: left;
}

.tab-button.active,
.tab-button:hover {
  border-color: var(--line);
  background: var(--ink);
  color: var(--ink-invert);
}

.tool-surface {
  min-height: 620px;
  padding: 24px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.tool-header h2 {
  margin: 0 0 8px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1;
  letter-spacing: 0;
}

.tool-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--ink-invert);
  background: var(--ink);
  border-radius: var(--radius);
}

body.no-tool-selected .tool-surface {
  display: grid;
  align-content: start;
}

body.no-tool-selected .tool-header {
  border-bottom: 0;
}

body.no-tool-selected .tool-header h2 {
  max-width: 420px;
}

body.no-tool-selected .tool-icon {
  color: var(--ink);
  background: transparent;
  border: 0;
}

.tool-form {
  display: grid;
  gap: 18px;
  padding-top: 22px;
}

.drop-zone {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed var(--strong-line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}

.drop-zone.drag-over {
  border-color: var(--ink);
  background: var(--surface-2);
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-zone .material-symbols-rounded {
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.drop-zone strong {
  font-size: 20px;
}

.drop-zone small,
.status-bar,
.field small {
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.file-item strong,
.file-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item small {
  color: var(--muted);
}

.remove-file {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

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

.field {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.field label {
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--surface);
}

.field input[type="range"] {
  padding: 0;
}

.page-organizer {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.page-organizer[hidden] {
  display: none;
}

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

.organizer-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

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

.organizer-actions {
  display: flex;
  gap: 8px;
}

.mini-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.page-thumb {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: grab;
  text-align: left;
}

.page-thumb:active {
  cursor: grabbing;
}

.page-thumb.dragging {
  opacity: 0.45;
}

.page-thumb.selected {
  border-color: var(--ink);
  background: var(--surface);
}

.page-thumb img {
  width: 100%;
  height: 136px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.page-thumb span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.page-thumb strong {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  color: var(--ink-invert);
  background: var(--ink);
  border-radius: var(--radius);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 6px;
}

.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ink-invert);
}

.result-panel p,
.result-panel .eyebrow {
  color: #d8d8d4;
}

.result-panel h3 {
  margin: 0 0 8px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.download-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

@media (max-width: 980px) {
  .hero,
  .workflow {
    grid-template-columns: 1fr;
  }

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

  .hero {
    min-height: auto;
  }

  .hero-panel {
    min-height: 420px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 680px) {
  body.menu-open {
    overflow: hidden;
  }

  .topnav {
    display: none;
  }

  .app-shell {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(14px);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  body.android-device .android-download-link {
    display: inline-flex;
  }

  .workspace {
    width: 100%;
    padding: 0;
  }

  .sidebar {
    display: none;
  }

  .tool-surface {
    min-height: calc(100vh - 63px);
    border-width: 0;
    border-radius: 0;
  }

  body.no-tool-selected .tool-surface {
    min-height: calc(100vh - 63px);
    padding-top: 42px;
    align-content: start;
  }

  body.no-tool-selected .tool-header {
    position: relative;
    min-height: 210px;
    align-items: flex-start;
  }

  body.no-tool-selected .tool-icon {
    position: absolute;
    top: -28px;
    right: 42px;
    width: 34px;
    height: 34px;
    font-size: 34px;
    transform: rotate(32deg);
  }

  .tool-grid,
  .settings,
  .workflow-steps,
  .thumbnail-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 28px;
  }

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

  .workflow {
    padding: 24px;
  }

  .tool-surface {
    padding: 16px;
  }

  .tool-header,
  .status-bar,
  .result-panel,
  .organizer-head {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions {
    justify-content: stretch;
  }

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

  .footer-links {
    justify-content: flex-start;
  }

  .download-link,
  .status-bar .btn {
    width: 100%;
  }
}
