:root {
  --page-ratio: 0.7182;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #f3ede3 0%, #e6ddd0 100%);
}

.stage {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 24px;
}

.sheet {
  width: min(calc(100vw - 48px), calc((100vh - 48px) * var(--page-ratio)));
  aspect-ratio: var(--page-ratio);
}

#pageSvg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 20px 30px rgba(33, 24, 14, 0.18));
}

#pageSvg image {
  pointer-events: none;
  -webkit-user-drag: none;
}

.panel-context-menu {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  border: 1px solid rgba(25, 18, 10, 0.14);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 18px 30px rgba(30, 22, 12, 0.18);
  backdrop-filter: blur(12px);
}

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

.panel-context-button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: #fffaf1;
  color: #23180d;
  font: 600 14px/1.2 "Segoe UI", sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.panel-context-button:hover {
  background: #f0e4d2;
  transform: translateY(-1px);
}

.panel-context-button.danger {
  background: #fff1ee;
  color: #7f2312;
}

.panel-context-button.danger:hover {
  background: #ffdcd3;
}

@media print {
  html,
  body {
    background: #ffffff !important;
    overflow: visible;
  }

  .stage {
    display: block;
    padding: 0;
  }

  #pageSvg {
    filter: none;
  }
}
