/* Footer styles */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--font-color-footer);
  text-align: center;
  max-width: 38rem;
  margin: 2rem auto 0;
}

footer a {
  color: inherit;
  text-underline-offset: 0.18rem;
}

footer a:hover {
  color: var(--link-hover-color);
}

.footer-primary {
  margin: 0;
  text-wrap: balance;
}

/* Inline icon stays attached to the first line when the text wraps. */
.footer-primary .footer-icon {
  display: inline-block;
  margin-right: 0.4rem;
  vertical-align: -2px;
}

.footer-secondary {
  margin: 0;
  text-wrap: balance;
}

.footer-version {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--font-color-footer);
}

.footer-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-control);
  text-decoration: none;
}

footer a:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

footer a:hover,
footer a:focus-visible {
  color: var(--link-hover-color);
}

::selection {
  background: var(--accent-dim);
  color: var(--font-color);
}

button:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.card[data-state="idle"] {
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.card[data-state="idle"] .state-idle {
  padding: 0;
}

.drop-zone:has(:focus-visible) {
  outline: 2px solid var(--focus-color);
  outline-offset: 4px;
}

.input-row .input {
  min-width: 0;
}

.actions button {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Shared responsive shell: keep identical in both apps. */
#browse-btn,
#file-upload-label {
  min-height: 48px;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  line-height: 1.25;
}

#browse-btn .icon,
#file-upload-label .icon {
  font-size: 1.125rem;
}

.header-top > button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0 0 0 auto;
  padding: 0.5rem;
}

a.branding,
a.branding:visited,
a.branding:hover {
  color: var(--branding-font-color);
}

.branding:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.footer-secondary a {
  color: var(--color-blue-text);
  text-decoration: underline;
  text-underline-offset: 0.18rem;
  white-space: nowrap;
}

.footer-secondary .footer-try {
  white-space: nowrap;
}

.drop-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--font-color);
}

.drop-sub {
  margin: 0.5rem 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--font-color-2);
  text-wrap: balance;
}

.drop-touch-hint {
  display: none;
}

@media (pointer: coarse) {
  .drop-touch-hint { display: inline; }
  .drop-drag-hint { display: none; }
}

@media (max-width: 640px) {
  body {
    padding: 0.5rem max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  }

  .state-locked,
  .state-owner-locked,
  .state-ready {
    padding: 1rem;
  }

  #protection-form > .actions .btn-block {
    width: 100%;
  }

  #protect-btn {
    margin-left: 0;
  }

  .hero {
    margin: 1.25rem auto 1rem;
  }

  .hero h1 {
    max-width: 19ch;
    font-size: 2rem;
  }

  .hero p {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
  }

  .hero-points {
    gap: 0.375rem;
    margin-bottom: 1.5rem;
  }

  .hero-point {
    font-size: 0.75rem;
    padding: 0.35rem 0.55rem;
  }

  .input {
    min-height: 44px;
    padding: 0.6rem;
    font-size: 16px;
  }

  .field-label,
  .permissions-toggles .toggle-item label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--font-color-2);
  }

  .permissions-toggles .toggle-item label {
    min-height: 44px;
    gap: 10px;
  }

  .btn-primary,
  .btn-danger {
    min-height: 44px;
    padding: 0.875rem 1rem;
  }

  .file-header {
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .file-info {
    flex-basis: 100%;
  }

  #encryption-badge,
  #encryption-badge .protection-pills {
    flex-wrap: wrap;
  }

  #encryption-badge {
    overflow-x: visible;
  }

  #encryption-badge .protection-pills {
    flex-shrink: 1;
    min-width: 0;
  }

  .scan-label,
  .scan-found-pw {
    min-width: 0;
  }

  .scan-found-pw,
  #success-filename {
    overflow-wrap: anywhere;
  }

  .success-banner {
    flex-wrap: wrap;
  }

  #success-filename {
    min-width: 0;
  }

  .success-redownload {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  footer {
    margin-top: 1.5rem;
  }
}

@media (max-width: 380px) {
  .toggle-group.permissions-toggles {
    grid-template-columns: 1fr;
  }
}
