:root {
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --text: #e5e5e5;
    --accent: #e5e5e5;
    --radius: 16px;
    --shadow: 0 12px 40px rgba(0,0,0,0.5);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: "Raleway", Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;
  }

  header {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26,26,26,0.9);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
  }

  body:hover header,
  header.show { opacity: 1; pointer-events: auto; }

  button {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }

  button:hover { background: rgba(255,255,255,0.1); color: var(--accent); }
  button:active { transform: scale(0.95); }

  #page-info {
    font-size: 0.95rem;
    color: var(--accent);
    min-width: 90px;
    text-align: center;
  }

  #viewer {
    flex: 1;
    overflow: hidden;
    background: #000;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none; /* Control total */
  }

  #pdf-container {
    position: relative;
    cursor: grab;
    transition: transform 0.3s ease;
  }

  #pdf-container.dragging { cursor: grabbing; }

  canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow);
    image-rendering: crisp-edges;
    transform-origin: center;
  }

  #zoom-indicator {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 50;
  }

  #page-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0,0,0,0.8);
    color: var(--accent);
    padding: 1rem 2rem;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 60;
    backdrop-filter: blur(8px);
  }