.papercut-auth {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, rgba(196, 40, 40, .28), transparent 32%), #160f0c;
  color: #27130d;
  font-family: "Noto Serif SC", serif;
}

.papercut-auth.hidden {
  display: none;
}

.papercut-login {
  width: min(380px, calc(100vw - 36px));
  padding: 28px;
  background: #fff8ec;
  border: 1px solid rgba(139, 34, 23, .35);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

.papercut-login h1 {
  margin: 0 0 10px;
  color: #a8241d;
  font-size: 28px;
}

.papercut-login p {
  margin: 0 0 18px;
  color: #7a6354;
}

.papercut-login input,
.papercut-login button,
.papercut-cloud-panel input,
.papercut-cloud-panel button,
.papercut-cloud-panel select {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(90, 50, 36, .28);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.papercut-login button,
.papercut-cloud-panel button {
  border: 0;
  background: #b72820;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.papercut-login .error,
.papercut-cloud-panel .message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #b72820;
  font-size: 13px;
}

.papercut-cloud-toggle {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 99999;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: #b72820;
  color: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .32);
  cursor: pointer;
  font: 800 20px/1 system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.papercut-cloud-toggle.hidden {
  display: none;
}

.papercut-cloud-panel {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 64px);
  z-index: 99999;
  width: min(300px, calc(100vw - 28px));
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 248, 236, .96);
  border: 1px solid rgba(139, 34, 23, .3);
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .24);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}

.papercut-cloud-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.96);
}

.papercut-cloud-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #5c2a20;
  font-weight: 800;
}

.papercut-cloud-panel .header-actions {
  display: flex;
  gap: 6px;
}

.papercut-cloud-panel .header-actions button {
  width: auto;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
}

.papercut-cloud-panel .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.papercut-cloud-panel button.secondary {
  background: #3f332d;
}

.papercut-cloud-panel button.ghost {
  background: #fff;
  color: #5c2a20;
  border: 1px solid rgba(90, 50, 36, .28);
}

body.portal {
  margin: 0;
  min-height: 100vh;
  background: #1a1510;
  color: #fff8ec;
  font-family: "Noto Serif SC", serif;
}

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

.hero {
  text-align: center;
}

.hero p {
  margin: 0 0 8px;
  color: #d5a74d;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 7vw, 76px);
}

.hero span {
  display: block;
  margin-top: 12px;
  color: rgba(255, 248, 236, .72);
}

.version-grid {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.version-card {
  display: grid;
  gap: 10px;
  min-height: 180px;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  background: #fff8ec;
  color: #2b1c16;
  border: 1px solid rgba(213, 167, 77, .45);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .3);
}

.version-card strong {
  color: #b72820;
  font-size: 26px;
}

@media (max-width: 720px) {
  .version-grid {
    grid-template-columns: 1fr;
  }

  .papercut-cloud-panel {
    left: 10px;
    right: 10px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 62px);
    width: auto;
    max-height: min(58vh, 360px);
    overflow-y: auto;
    transform-origin: bottom center;
  }

  .papercut-cloud-toggle {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}
