:root {
  --accent: #eb7e16;
  --accent-strong: #c55e0d;
  --accent-soft: #fff1e2;
  --accent-soft-2: #ffe5cb;
  --canvas: #f6f2ed;
  --surface: #ffffff;
  --surface-2: #f6f1eb;
  --surface-3: #fff9f2;
  --line: #e1d6c8;
  --line-strong: #cdb9a0;
  --text: #261b14;
  --muted: #75685f;
  --disabled: #bcaea2;
  --danger: #bc4736;
  --success: #1f8f52;
  --warning: #c87614;
  --shadow: 0 20px 40px rgba(66, 40, 20, 0.08);
  --shadow-soft: 0 14px 28px rgba(66, 40, 20, 0.06);
  --toolbar-height: 64px;
  --radius: 16px;
  --control-h: 36px;
  --toolbar-font: 0.84rem;
  --toolbar-icon: 22px;
  --toolbar-bg: rgba(255, 255, 255, 0.97);
  --toolbar-border: rgba(225, 214, 200, 0.92);
  --status-bg: rgba(255, 255, 255, 0.94);
  --brand-mark-bg: linear-gradient(180deg, rgba(243, 154, 53, 0.22), rgba(235, 126, 22, 0.09));
  --brand-title: #61422a;
  --button-text: #67584e;
  --button-hover-text: #30241d;
  --drop-inner-bg: #fff;
  --dialog-bg: linear-gradient(180deg, #fffdfb 0%, #fff6ee 100%);
  --tutorial-card-bg: #fff;
  --chip-bg: var(--surface-3);
  --log-bg: #241a14;
  --log-text: #fff2e6;
  --notice-bg: #241a14;
  --notice-text: #fff6ee;
  color-scheme: light;
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}
body.theme-dark {
  --canvas: #1a1411;
  --surface: #241c18;
  --surface-2: #312621;
  --surface-3: #392d27;
  --line: #54443a;
  --line-strong: #725d51;
  --text: #f7ece3;
  --muted: #d1b7a6;
  --disabled: #8b7466;
  --shadow: 0 24px 42px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 16px 28px rgba(0, 0, 0, 0.22);
  --toolbar-bg: rgba(30, 23, 20, 0.97);
  --toolbar-border: rgba(84, 68, 58, 0.92);
  --status-bg: rgba(30, 23, 20, 0.94);
  --brand-mark-bg: linear-gradient(180deg, rgba(255, 232, 211, 0.18), rgba(255, 196, 142, 0.08));
  --brand-title: #fff4ea;
  --button-text: #ebd7cb;
  --button-hover-text: #fff5ec;
  --drop-inner-bg: #241c18;
  --dialog-bg: linear-gradient(180deg, #2b211c 0%, #221915 100%);
  --tutorial-card-bg: #241c18;
  --chip-bg: #332822;
  --log-bg: #120e0c;
  --log-text: #ffe9d6;
  --notice-bg: #120e0c;
  --notice-text: #fff1e2;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  overflow: hidden;
}

button,
input,
summary,
.file-label {
  font: inherit;
}

button,
summary,
.file-label,
a {
  -webkit-tap-highlight-color: transparent;
}

.sprite,
.sr-only,
.file-input {
  position: absolute;
}

.sprite,
.file-input {
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  margin: -1px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-width: 300px;
}

.toolbar {
  align-items: stretch;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  min-height: var(--toolbar-height);
  position: relative;
  z-index: 20;
}

.brand-group,
.tool-group {
  align-items: center;
  display: flex;
  min-height: var(--toolbar-height);
}

.brand-group {
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  width: fit-content;
}

.brand-mark {
  align-items: center;
  align-self: stretch;
  background: var(--brand-mark-bg);
  display: flex;
  justify-content: center;
  width: 58px;
}

.brand-image {
  width: 31px;
  height: 31px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.16));
}

.brand-copy {
  display: grid;
  gap: 0.2rem;
  padding: 0 8px 0 10px;
}

.brand-topline {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.brand-topline strong {
  color: var(--brand-title);
  font-size: clamp(0.92rem, 1.32vw, 1.06rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-help-button {
  color: var(--accent-strong);
  margin-left: -0.04rem;
}

.brand-bottomline {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.7rem;
  gap: 0.32rem;
  line-height: 1.35;
}

.brand-sep {
  color: #b4a59a;
}

.brand-bottomline a,
.help-links a {
  align-items: center;
  color: var(--accent-strong);
  display: inline-flex;
  gap: 0.32rem;
  text-decoration: none;
}

.brand-bottomline a:hover,
.help-links a:hover {
  text-decoration: underline;
}

.brand-bottomline a svg,
.help-links a svg {
  width: 0.9rem;
  height: 0.9rem;
}

.tool-group {
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
  gap: 0.28rem;
  padding: 6px 8px;
}

.brand-group img,
.tool-button svg,
button svg,
summary svg,
.menu-panel svg,
.drop-illustration svg,
.density-option svg {
  display: block;
}

.tool-button svg,
button svg,
summary svg,
.menu-panel svg,
.drop-illustration svg,
.density-option svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
}

.tool-button,
.icon-button,
.menu-panel button,
.primary-action,
.density-option {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--button-text);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--toolbar-font);
  font-weight: 650;
  gap: 0.48rem;
  justify-content: center;
  min-height: var(--control-h);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.file-label {
  text-decoration: none;
}

.tool-button {
  padding: 0 6px;
}

.icon-button {
  aspect-ratio: 1;
  padding: 0;
  width: var(--control-h);
}

.split-action {
  display: inline-flex;
  position: relative;
  gap: 0.14rem;
}

.split-action-icon .menu-trigger {
  width: calc(var(--control-h) - 8px);
}

.split-main {
  flex: 0 0 auto;
}

.menu-trigger {
  color: var(--muted);
}

.menu-trigger svg {
  width: calc(var(--toolbar-icon) - 4px);
  height: calc(var(--toolbar-icon) - 4px);
}

.tool-button svg,
.icon-button svg,
.menu-panel svg,
.density-option svg {
  flex: 0 0 auto;
  width: var(--toolbar-icon);
  height: var(--toolbar-icon);
}

.tool-button span,
.density-option span {
  white-space: nowrap;
}

.tool-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.menu-panel button:hover:not(:disabled),
.density-option:hover,
.split-action.is-open > .split-main,
.split-action.is-open > .menu-trigger {
  background: var(--surface-2);
  border-color: rgba(197, 94, 13, 0.13);
  color: var(--button-hover-text);
}

.tool-button:focus-visible,
.icon-button:focus-visible,
.menu-button summary:focus-visible,
.menu-panel button:focus-visible,
.density-option:focus-visible,
.dropzone:focus-visible,
.dialog-close:focus-visible {
  outline: 2px solid rgba(235, 126, 22, 0.32);
  outline-offset: 2px;
}

.tool-button:active:not(:disabled),
.icon-button:active:not(:disabled),
.menu-panel button:active:not(:disabled),
.primary-action:active,
.density-option:active {
  transform: translateY(1px);
}

.danger:hover:not(:disabled) {
  color: var(--danger);
}

button:disabled,
.menu-panel button:disabled {
  color: var(--disabled);
  cursor: not-allowed;
}

.page-picker,
.zoom-picker {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  gap: 0.42rem;
  min-height: var(--control-h);
}

.page-picker input,
.zoom-picker input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  height: var(--control-h);
  padding: 0 0.55rem;
  text-align: center;
}

.page-picker input {
  width: 56px;
}

.zoom-picker input {
  width: 66px;
}

.page-picker input:disabled,
.zoom-picker input:disabled {
  color: var(--disabled);
}

.menu-button {
  position: relative;
}

.menu-button summary {
  list-style: none;
}

.menu-button summary::-webkit-details-marker {
  display: none;
}

.chevron {
  color: #977760;
  font-size: 0.82rem;
  margin-left: -0.1rem;
}

.menu-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.25rem;
  left: 0;
  max-width: min(300px, calc(100vw - 16px));
  min-width: 210px;
  padding: 0.45rem;
  position: absolute;
  top: calc(100% + 0.5rem);
  z-index: 30;
}

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

.toolbar-menu-panel {
  min-width: 248px;
}

.menu-panel button {
  border-radius: 10px;
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 0.75rem;
  width: 100%;
}

.density-switch,
.language-switch {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid rgba(197, 94, 13, 0.13);
  border-radius: 14px;
  display: inline-flex;
  gap: 0.22rem;
  padding: 0.15rem;
}

.density-caption {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  padding: 0 0.3rem 0 0.36rem;
  text-transform: uppercase;
}

.density-option {
  border-radius: 10px;
  color: #7a6658;
  min-height: calc(var(--control-h) - 10px);
  padding: 0 0.4rem;
}

.density-option[aria-pressed="true"] {
  background: #ffffff;
  border-color: rgba(235, 126, 22, 0.2);
  box-shadow: var(--shadow-soft);
  color: var(--accent-strong);
}

.workspace {
  background:
    radial-gradient(circle at 8% 4%, rgba(243, 154, 53, 0.16), transparent 26rem),
    radial-gradient(circle at 92% 10%, rgba(235, 126, 22, 0.08), transparent 18rem),
    linear-gradient(180deg, #fcf7f0 0%, #f4eee8 100%);
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 3.2vw, 48px);
  position: relative;
}

.dropzone {
  align-items: center;
  background:
    linear-gradient(var(--drop-inner-bg), var(--drop-inner-bg)) padding-box,
    repeating-linear-gradient(135deg, rgba(235, 126, 22, 0.6) 0 10px, rgba(251, 183, 106, 0.42) 10px 20px) border-box;
  border: 2px dashed transparent;
  border-radius: 28px;
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 0.8rem;
  justify-items: center;
  margin: min(8vh, 70px) auto;
  max-width: 650px;
  min-height: min(58vh, 450px);
  padding: clamp(32px, 4vw, 50px) 28px;
  text-align: center;
}

.dropzone.is-hidden {
  display: none;
}

.dropzone.is-dragging,
.workspace.is-dragging .dropzone {
  background:
    linear-gradient(var(--surface-3), var(--surface-3)) padding-box,
    repeating-linear-gradient(135deg, rgba(235, 126, 22, 0.94) 0 10px, rgba(251, 183, 106, 0.62) 10px 20px) border-box;
  transform: translateY(-1px);
}

.drop-illustration {
  align-items: center;
  background: linear-gradient(180deg, rgba(255, 241, 226, 0.95), rgba(255, 229, 203, 0.8));
  border-radius: 50%;
  color: var(--accent-strong);
  display: flex;
  height: 84px;
  justify-content: center;
  width: 84px;
}

.drop-illustration svg {
  width: 42px;
  height: 42px;
}

.dropzone h2 {
  margin: 0;
  font-size: clamp(1.38rem, 2vw, 1.75rem);
  letter-spacing: -0.03em;
}

.dropzone p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin: 0;
  max-width: 30rem;
}

.primary-action {
  background: linear-gradient(180deg, #f09128 0%, #de6d10 100%);
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(224, 109, 16, 0.18);
  color: #fff;
  min-width: 146px;
  padding: 0 1rem;
}

.primary-action:hover {
  filter: brightness(1.02);
}

.pages-grid {
  display: none;
  flex-wrap: wrap;
  gap: clamp(18px, 2vw, 34px);
  justify-content: center;
  align-items: flex-start;
  padding-bottom: 1rem;
}

.pages-grid.has-pages {
  display: flex;
}

.page-card {
  --thumb-width: 210px;
  --card-width: 273px;
  align-items: center;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 24px;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0.42rem;
  inline-size: min(var(--card-width), min(calc(100vw - 4rem), 100%));
  max-width: min(calc(100vw - 4rem), 100%);
  padding: 0.36rem 0.38rem 0.22rem;
  position: relative;
  width: min(var(--card-width), min(calc(100vw - 4rem), 100%));
}

.page-card:hover {
  background: rgba(255, 255, 255, 0.52);
}

.page-card.is-selected {
  background:
    linear-gradient(color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-3) 90%, transparent)) padding-box,
    linear-gradient(180deg, rgba(235, 126, 22, 0.95), rgba(248, 169, 81, 0.85)) border-box;
  box-shadow: 0 16px 28px rgba(197, 94, 13, 0.12);
}

.page-card.is-dragging {
  opacity: 0.66;
}

.page-card.is-drop-before::before,
.page-card.is-drop-after::after {
  background: linear-gradient(180deg, #f09128, #de6d10);
  border-radius: 999px;
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  width: 5px;
}

.page-card.is-drop-before::before {
  left: -3px;
}

.page-card.is-drop-after::after {
  right: -3px;
}

.page-meta,
.page-number {
  display: block;
  inline-size: min(100%, calc(var(--card-width) - 0.76rem));
  max-inline-size: 100%;
  text-align: center;
}

.page-meta {
  color: var(--muted);
  display: -webkit-box;
  font-size: 0.78rem;
  line-height: 1.35;
  min-height: 2.2em;
  max-height: 2.7em;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-number {
  font-size: 0.8rem;
  font-weight: 800;
  color: #5d4b3f;
}

.page-canvas-wrap {
  align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  block-size: calc(var(--thumb-height) + 0.88rem);
  border-radius: 20px;
  box-shadow: 0 16px 26px rgba(55, 35, 20, 0.08);
  display: flex;
  inline-size: min(100%, calc(var(--thumb-width) + 0.88rem));
  justify-content: center;
  max-width: min(calc(100vw - 5rem), 100%);
  min-height: calc(var(--thumb-height) + 0.88rem);
  padding: 0.44rem;
  position: relative;
  width: min(100%, calc(var(--thumb-width) + 0.88rem));
}

.page-canvas-wrap canvas {
  background: #fff;
  border: 1px solid rgba(190, 180, 170, 0.72);
  display: block;
  height: auto !important;
  max-height: 100%;
  max-width: 100%;
  width: auto !important;
}

.page-thumb-state {
  align-items: center;
  backdrop-filter: blur(3px);
  background: rgba(255, 248, 241, 0.5);
  border-radius: 16px;
  color: #6d5647;
  display: inline-flex;
  flex-direction: column;
  gap: 0.48rem;
  inset: 0.7rem;
  justify-content: center;
  padding: 0.8rem;
  pointer-events: none;
  position: absolute;
  text-align: center;
}

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

.page-thumb-state-icon {
  animation: thumb-tick 1.25s linear infinite;
  border: 2px solid rgba(128, 90, 61, 0.2);
  border-radius: 999px;
  display: block;
  height: 1.5rem;
  position: relative;
  width: 1.5rem;
}

.page-thumb-state-icon::before,
.page-thumb-state-icon::after {
  background: currentColor;
  border-radius: 999px;
  content: "";
  left: 50%;
  position: absolute;
  top: 50%;
  transform-origin: 0 0;
}

.page-thumb-state-icon::before {
  height: 0.48rem;
  transform: translate(-1px, -100%) rotate(0deg);
  width: 2px;
}

.page-thumb-state-icon::after {
  height: 2px;
  transform: translate(0, -1px) rotate(35deg);
  width: 0.42rem;
}

.page-thumb-state-text {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
  max-width: 12rem;
}

.page-thumb-state.is-error {
  background: rgba(255, 240, 236, 0.5);
  color: #ad4626;
}

.page-thumb-state.is-error .page-thumb-state-icon {
  animation: none;
  border-color: rgba(173, 70, 38, 0.24);
}

.page-thumb-state.is-error .page-thumb-state-icon::before,
.page-thumb-state.is-error .page-thumb-state-icon::after {
  border-radius: 999px;
  height: 2px;
  left: 50%;
  top: 50%;
  transform-origin: center;
  width: 0.8rem;
}

.page-thumb-state.is-error .page-thumb-state-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.page-thumb-state.is-error .page-thumb-state-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

@keyframes thumb-tick {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.statusbar {
  align-items: center;
  background: var(--status-bg);
  border-top: 1px solid var(--toolbar-border);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  justify-content: space-between;
  padding: 0.7rem 1rem 0.8rem;
}

.statusbar-progress {
  align-items: center;
  display: inline-flex;
  flex: 1 1 18rem;
  gap: 0.55rem;
  min-width: 0;
}

.statusbar span {
  font-size: 0.84rem;
  line-height: 1.45;
}

#statusText {
  min-width: 0;
}

.status-stop-btn {
  align-items: center;
  background: linear-gradient(180deg, #d9342b, #b8221b);
  border: 1px solid rgba(131, 17, 12, 0.44);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(176, 34, 27, 0.2);
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  height: 1.35rem;
  justify-content: center;
  padding: 0;
  width: 1.35rem;
}

.status-stop-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.status-stop-btn:disabled {
  cursor: wait;
  opacity: 0.58;
}

.status-stop-btn > span {
  background: currentColor;
  border-radius: 2px;
  display: block;
  height: 0.45rem;
  width: 0.45rem;
}

.statusbar-controls {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.statusbar-switch .density-option > span {
  display: none;
}

.statusbar-switch .density-option {
  min-width: calc(var(--control-h) - 8px);
  padding: 0;
  width: calc(var(--control-h) - 8px);
}

.statusbar-switch .density-caption {
  padding-right: 0.42rem;
}

.dialog-panel {
  width: min(92vw, 42rem);
  border: none;
  box-sizing: border-box;
  padding: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.dialog-panel::backdrop {
  background: rgba(38, 25, 15, 0.52);
}

body.bucket-mode-open .app-shell {
  filter: blur(7px) saturate(0.86);
  pointer-events: none;
  user-select: none;
}

.dialog-card {
  background: var(--dialog-bg);
  border: 1px solid var(--toolbar-border);
  border-radius: 28px;
  box-shadow: 0 26px 48px rgba(38, 25, 15, 0.18);
  overflow: hidden;
}

.dialog-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--toolbar-border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1.15rem 1.15rem 0.95rem;
}

.dialog-brand {
  align-items: flex-start;
  display: flex;
  gap: 0.8rem;
}

.dialog-brand-mark {
  align-items: center;
  background: linear-gradient(180deg, rgba(243, 154, 53, 0.22), rgba(235, 126, 22, 0.09));
  border-radius: 16px;
  display: flex;
  height: 2.9rem;
  justify-content: center;
  width: 2.9rem;
}

.dialog-brand-mark img {
  width: 1.8rem;
  height: 1.8rem;
  object-fit: contain;
}

.dialog-brand-copy {
  display: grid;
  gap: 0.18rem;
  line-height: 1.35;
  min-width: 0;
}

.help-brand-copy {
  gap: 0.42rem;
}

.help-brand-topline {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.help-site-inline {
  align-items: center;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 0.82rem;
  gap: 0.28rem;
  text-decoration: none;
}

.help-site-inline:hover {
  text-decoration: underline;
}

.help-site-inline svg {
  width: 0.9rem;
  height: 0.9rem;
}

.help-inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.dialog-brand-copy strong {
  font-size: 0.98rem;
  font-weight: 800;
}

.dialog-brand-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.dialog-close {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  height: 2.2rem;
  justify-content: center;
  width: 2.2rem;
}

.dialog-close:hover {
  border-color: rgba(197, 94, 13, 0.24);
  background: var(--surface-2);
}

.dialog-body {
  padding: 1.15rem;
}

.dialog-body p {
  margin: 0 0 0.95rem;
  font-size: 0.9rem;
  line-height: 1.58;
}

.help-hotkeys {
  margin: 0 0 1rem;
}

.help-hotkeys h3 {
  font-size: 0.9rem;
  margin: 0 0 0.55rem;
}

.help-hotkeys-list {
  display: grid;
  gap: 0.42rem;
  margin: 0;
  padding: 0;
}

.help-hotkeys-list li {
  align-items: flex-start;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(120px, 190px) 1fr;
  list-style: none;
  line-height: 1.5;
}

.help-hotkeys-list kbd {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.77rem;
  font-weight: 700;
  padding: 0.22rem 0.45rem;
}

.help-steps {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

.help-steps li {
  line-height: 1.5;
}

.help-actions,
.update-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
}

.tool-button-prominent {
  background: linear-gradient(180deg, #f09128 0%, #de6d10 100%);
  border-color: transparent;
  color: #fff;
}

.tool-button-prominent:hover {
  background: linear-gradient(180deg, #f39a35 0%, #e57615 100%);
  color: #fff;
}

.help-links {
  margin-top: 1rem;
}

.tutorial-dialog {
  width: min(94vw, 38rem);
}

.tutorial-card {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tutorial-close-form {
  position: absolute;
  right: 1rem;
  top: 1rem;
  z-index: 2;
}

.tutorial-slide-frame {
  background:
    radial-gradient(circle at 15% 18%, rgba(243, 154, 53, 0.12), transparent 16rem),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-3) 96%, transparent));
  border-bottom: 1px solid var(--toolbar-border);
  padding: 1.2rem;
}

.tutorial-slide {
  min-height: 18rem;
}

.tutorial-slide-card {
  background: var(--tutorial-card-bg);
  border: 1px solid var(--toolbar-border);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 1rem;
  min-height: 100%;
  padding: 1.4rem;
}

.tutorial-badge {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 800;
  justify-self: start;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.6rem;
  text-transform: uppercase;
}

.tutorial-hero {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(168px, 0.8fr);
}

.tutorial-copy h3 {
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.tutorial-copy p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.tutorial-art {
  align-items: center;
  background: linear-gradient(180deg, rgba(255, 241, 226, 0.9), rgba(255, 229, 203, 0.85));
  border: 1px solid rgba(235, 126, 22, 0.14);
  border-radius: 22px;
  display: flex;
  justify-content: center;
  min-height: 10rem;
  padding: 1rem;
}

.tutorial-art-stack,
.tutorial-art-flow,
.tutorial-art-save {
  display: grid;
  gap: 0.6rem;
  width: 100%;
}

.tutorial-paper {
  background: #fff;
  border: 1px solid rgba(197, 94, 13, 0.18);
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(82, 49, 22, 0.08);
  min-height: 4rem;
}

.tutorial-art-stack .tutorial-paper:nth-child(1) {
  transform: translateX(0.2rem) rotate(-4deg);
}

.tutorial-art-stack .tutorial-paper:nth-child(2) {
  transform: rotate(2deg);
}

.tutorial-art-stack .tutorial-paper:nth-child(3) {
  transform: translateX(-0.2rem) rotate(5deg);
}

.tutorial-flow-line {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}

.tutorial-mini-page,
.tutorial-mini-card {
  background: #fff;
  border: 1px solid rgba(197, 94, 13, 0.18);
  border-radius: 12px;
  height: 3.4rem;
  width: 2.45rem;
}

.tutorial-arrow {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 800;
}

.tutorial-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tutorial-chip {
  background: var(--chip-bg);
  border: 1px solid rgba(197, 94, 13, 0.12);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.34rem 0.62rem;
}

.tutorial-points {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.1rem;
}

.tutorial-points li {
  line-height: 1.48;
}

.tutorial-footer {
  align-items: center;
  background: var(--surface);
  display: grid;
  gap: 0.85rem;
  grid-template-columns: auto 1fr auto;
  padding: 1rem;
}

.tutorial-nav-button {
  min-width: 7rem;
}

.tutorial-checkbox {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  gap: 0.45rem;
  justify-content: center;
}

.tutorial-checkbox input {
  accent-color: var(--accent);
}

.update-status {
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.update-status[data-status="idle"] {
  color: var(--muted);
}

.update-status[data-status="running"] {
  color: var(--accent-strong);
}

.update-status[data-status="success"] {
  color: var(--success);
}

.update-status[data-status="warning"] {
  color: var(--warning);
}

.update-status[data-status="error"] {
  color: var(--danger);
}

.update-log {
  margin: 0 0 1rem;
  min-height: 11rem;
  max-height: 19rem;
  overflow: auto;
  padding: 0.85rem 1rem;
  border: 1px solid var(--toolbar-border);
  border-radius: 16px;
  background: var(--log-bg);
  color: var(--log-text);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.runtime-debug-dialog {
  width: min(96vw, 74rem);
}

.runtime-debug-card {
  overflow: hidden;
}

.runtime-debug-log {
  margin: 0 0 1rem;
  min-height: 16rem;
  max-height: 58vh;
  overflow: auto;
  padding: 0.95rem 1rem;
  border: 1px solid var(--toolbar-border);
  border-radius: 16px;
  background: var(--log-bg);
  color: var(--log-text);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-dialog {
  width: min(98vw, 1440px);
}

.preview-dialog::backdrop {
  background: rgba(14, 10, 7, 0.78);
  backdrop-filter: blur(8px);
}

.preview-card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: min(94vh, 980px);
  min-height: 0;
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.17s ease, opacity 0.17s ease;
}

.preview-dialog.is-visible .preview-card {
  transform: scale(1);
  opacity: 1;
}

.preview-dialog.is-closing .preview-card {
  transform: scale(0.94);
  opacity: 0;
}

.preview-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--toolbar-border);
  display: grid;
  gap: 0.8rem;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  padding: 0.95rem 1rem;
}

.preview-title-group {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.preview-title-group strong,
.preview-title-group span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-title-group strong {
  font-size: 0.96rem;
}

.preview-title-group span {
  color: var(--muted);
  font-size: 0.78rem;
}

.preview-rotate-group,
.preview-zoom-group {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.preview-zoom-picker {
  justify-content: center;
}

.preview-nav-button {
  width: 2.6rem;
  height: 2.6rem;
}

.preview-next-icon {
  transform: rotate(180deg);
}

.preview-close-form {
  justify-self: end;
}

.compress-card {
  max-width: 34rem;
}

.compress-body {
  display: grid;
  gap: 1rem;
}

.compress-note {
  color: rgba(74, 52, 39, 0.86);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
}

.compress-toggle {
  align-items: start;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: auto 1fr;
}

.compress-toggle input {
  margin: 0.2rem 0 0;
}

.progress-dialog {
  width: min(94vw, 30rem);
  overflow: hidden;
}

.progress-card {
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
}

.progress-header {
  padding-bottom: 0.85rem;
}

.progress-body {
  box-sizing: border-box;
  display: grid;
  gap: 0.9rem;
  min-width: 0;
  padding: 1rem 1.15rem 1.2rem;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
}

.progress-meta {
  align-items: baseline;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.progress-meta strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.progress-track {
  background: rgba(210, 176, 144, 0.24);
  border: 1px solid rgba(197, 94, 13, 0.14);
  box-sizing: border-box;
  border-radius: 999px;
  height: 0.72rem;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.progress-dialog .dialog-brand-copy span {
  overflow-wrap: anywhere;
}

.progress-bar {
  background: linear-gradient(90deg, #ef8f32, #d95f13);
  border-radius: inherit;
  display: block;
  height: 100%;
  width: 0%;
}

.bucket-dialog {
  width: min(94vw, 68rem);
}

.bucket-card-shell {
  overflow: visible;
}

.bucket-header {
  align-items: center;
}

.bucket-body {
  display: grid;
  gap: 1rem;
}

.bucket-dialog-meta,
.bucket-dialog-hint {
  margin: 0;
  color: var(--muted);
}

.bucket-dialog-hint {
  font-size: 0.82rem;
}

.bucket-action-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
}

.bucket-action-card {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 244, 233, 0.8));
  border: 1px solid rgba(197, 94, 13, 0.12);
  border-radius: 22px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  min-height: 10.6rem;
  padding: 1rem 0.9rem;
  text-align: center;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.bucket-action-card:hover,
.bucket-action-card:focus-visible {
  border-color: rgba(222, 109, 16, 0.42);
  box-shadow: 0 16px 28px rgba(82, 49, 22, 0.1);
  outline: none;
  transform: translateY(-2px);
}

.bucket-action-card[data-selected="true"] {
  background:
    linear-gradient(180deg, rgba(255, 248, 238, 0.98), rgba(255, 236, 214, 0.94));
  border-color: rgba(222, 109, 16, 0.68);
  box-shadow: 0 18px 34px rgba(224, 109, 16, 0.18);
}

.bucket-action-card[data-available="false"] {
  opacity: 0.8;
}

.bucket-action-icon {
  align-items: center;
  background: linear-gradient(180deg, rgba(243, 154, 53, 0.18), rgba(235, 126, 22, 0.08));
  border-radius: 18px;
  display: inline-flex;
  height: 3.8rem;
  justify-content: center;
  width: 3.8rem;
}

.bucket-action-icon svg {
  fill: none;
  height: 2rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 2rem;
}

.bucket-action-label {
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.3;
}

.bucket-action-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.bucket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.compress-quality-field {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 0.6rem;
  justify-content: flex-start;
}

.compress-quality-field input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  height: var(--control-h);
  padding: 0 0.7rem;
  text-align: center;
  width: 76px;
}

.compress-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.compress-presets .tool-button[aria-pressed="true"] {
  border-color: rgba(197, 94, 13, 0.45);
  box-shadow: inset 0 0 0 1px rgba(217, 95, 19, 0.2);
}

.preview-viewport {
  align-items: flex-start;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 1.2rem;
}

.preview-stage {
  align-items: flex-start;
  display: flex;
  justify-content: center;
  min-height: 100%;
  min-width: 100%;
}

#previewCanvas {
  background: #fff;
  border: 1px solid rgba(190, 180, 170, 0.72);
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.18);
  display: block;
  max-width: none;
}

.context-menu {
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
  display: grid;
  gap: 0.14rem;
  left: 0;
  min-width: 248px;
  padding: 0.45rem;
  position: fixed;
  top: 0;
  z-index: 1400;
}

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

.context-menu-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--button-text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  gap: 0.58rem;
  min-height: 2.4rem;
  padding: 0 0.72rem;
  text-align: left;
}

.context-menu-item svg {
  fill: none;
  height: 1.1rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
  width: 1.1rem;
}

.context-menu-item:hover:not(:disabled),
.context-menu-item:focus-visible {
  background: var(--surface-2);
  border-color: rgba(197, 94, 13, 0.13);
  color: var(--button-hover-text);
  outline: none;
}

.context-menu-item:disabled {
  color: var(--disabled);
  cursor: not-allowed;
}

.context-menu-separator {
  background: var(--line);
  height: 1px;
  margin: 0.22rem 0.18rem;
}

.snackbar {
  position: fixed;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%) translateY(110px);
  z-index: 1000;
  min-width: 18rem;
  max-width: min(92vw, 34rem);
  padding: 0.9rem 1.2rem;
  background: var(--notice-bg);
  color: var(--notice-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
  transition: transform 0.28s ease;
  pointer-events: none;
}

.snackbar.is-visible {
  transform: translateX(-50%) translateY(0);
}

body.toolbar-compact {
  --toolbar-height: 58px;
  --control-h: 34px;
  --toolbar-font: 0.82rem;
  --toolbar-icon: 20px;
}

body.toolbar-compact .brand-group {
  min-width: 198px;
}

body.toolbar-compact .brand-mark {
  width: 56px;
}

body.toolbar-compact .brand-image {
  width: 30px;
  height: 30px;
}

body.toolbar-compact .brand-copy {
  gap: 0.12rem;
  padding-right: 0.9rem;
}

body.toolbar-compact .brand-topline strong {
  font-size: 0.98rem;
}

body.toolbar-compact .brand-bottomline {
  display: none;
}

body.toolbar-compact .tool-group {
  gap: 0.3rem;
  padding: 7px 9px;
}

body.toolbar-compact .toolbar .tool-button,
body.toolbar-compact .toolbar .density-option {
  padding: 0 0.52rem;
}

body.toolbar-compact .toolbar .tool-button > span:not(.chevron),
body.toolbar-compact .toolbar .density-option > span,
body.toolbar-compact .toolbar .density-caption {
  display: none;
}

body.theme-dark .workspace {
  background:
    radial-gradient(circle at 8% 4%, rgba(243, 154, 53, 0.14), transparent 26rem),
    radial-gradient(circle at 92% 10%, rgba(235, 126, 22, 0.1), transparent 18rem),
    linear-gradient(180deg, #1f1814 0%, #171210 100%);
}

body.theme-dark .drop-illustration,
body.theme-dark .dialog-brand-mark,
body.theme-dark .tutorial-art,
body.theme-dark .bucket-action-icon {
  background: linear-gradient(180deg, rgba(255, 241, 226, 0.12), rgba(255, 229, 203, 0.07));
}

body.theme-dark .density-option[aria-pressed="true"] {
  background: rgba(255, 241, 226, 0.1);
}

body.theme-dark .page-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.theme-dark .page-card.is-selected,
body.theme-dark .page-card.is-selected:hover {
  background:
    linear-gradient(color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--surface-3) 82%, transparent)) padding-box,
    linear-gradient(180deg, rgba(243, 154, 53, 0.98), rgba(235, 126, 22, 0.9)) border-box;
  box-shadow: 0 18px 30px rgba(235, 126, 22, 0.16);
}

body.theme-dark .page-thumb-state {
  background: rgba(35, 28, 24, 0.5);
  color: #f1d6bf;
}

body.theme-dark .page-thumb-state.is-error {
  background: rgba(78, 28, 20, 0.5);
  color: #ffb9a3;
}

body.theme-dark .dropzone p,
body.theme-dark .tutorial-copy p,
body.theme-dark .dialog-brand-copy span,
body.theme-dark .page-meta,
body.theme-dark .statusbar {
  color: var(--muted);
}

body.theme-dark .context-menu {
  background: var(--surface-2);
}

body.theme-dark .bucket-action-card {
  background: linear-gradient(180deg, rgba(39, 29, 24, 0.95), rgba(30, 23, 19, 0.92));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .bucket-action-card[data-selected="true"] {
  background:
    linear-gradient(180deg, rgba(55, 38, 28, 0.98), rgba(42, 29, 22, 0.96));
  border-color: rgba(243, 154, 53, 0.72);
}

body.theme-dark .brand-sep {
  color: #8d7567;
}

body.theme-dark .page-number {
  color: #f3dfd0;
}

body.theme-dark .primary-action {
  box-shadow: 0 10px 18px rgba(224, 109, 16, 0.24);
}

body.toolbar-compact .page-picker input {
  width: 52px;
}

body.toolbar-compact .zoom-picker input {
  width: 62px;
}

body.toolbar-compact .statusbar span {
  font-size: 0.78rem;
}

@media (max-width: 980px) {
  .brand-group {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .brand-group {
    min-width: 100%;
  }

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

  .tutorial-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .toolbar {
    align-items: flex-start;
  }

  .tool-group,
  .brand-group {
    min-height: auto;
    width: 100%;
  }

  .tool-group {
    border-right: none;
    border-top: 1px solid rgba(225, 214, 200, 0.92);
    flex-wrap: wrap;
  }

  .brand-group {
    border-right: none;
  }

  .density-switch {
    flex: 1 1 auto;
    justify-content: center;
  }

  .dropzone {
    min-height: min(52vh, 370px);
  }

  .pages-grid {
    justify-content: center;
  }

  .dialog-panel,
  .tutorial-dialog {
    width: min(96vw, 38rem);
  }

  .tutorial-footer {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .compress-quality-field {
    justify-content: center;
  }

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

  .bucket-actions .tool-button {
    flex: 1 1 auto;
  }

  .help-hotkeys-list li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .brand-copy {
    padding-right: 0.9rem;
  }

  .brand-bottomline {
    font-size: 0.72rem;
  }

  .tool-button,
  .density-option {
    flex: 1 1 auto;
  }

  .page-picker,
  .zoom-picker {
    width: 100%;
    justify-content: flex-start;
  }

  .statusbar-controls,
  .update-actions,
  .help-inline-actions,
  .help-actions,
  .bucket-actions {
    flex-direction: column;
  }

  .statusbar-switch .density-option {
    flex: 0 0 auto;
  }
}
