* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background: linear-gradient(
    45deg,
    rgba(120, 163, 139, 0.25),
    rgba(46, 67, 94, 0.25),
    rgba(22, 39, 59, 0.25)
  );
  min-height: 100vh;
  color: #1a1a1a;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* Top Bar Header */
.top-bar {
  width: 100%;
  padding: 0;
  margin: 0;
  background: linear-gradient(
    45deg,
    rgba(120, 163, 139, 0.25),
    rgba(58, 81, 110, 0.25),
    rgba(33, 55, 80, 0.25)
  );
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(229, 231, 235, 1);
  position: relative;
}

.top-bar-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar-left {
  display: flex;
  align-items: center;
}

.lock-button {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
}

.lock-button:hover {
  color: #111827;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lock-button.locked {
  background: transparent;
  border: none;
}

.lock-icon {
  font-size: 1rem;
  margin-right: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(72, 97, 91), rgb(120, 163, 139));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(229, 231, 235, 1);
}

.avatar > * {
  width: 100%;
  height: 100%;
}

.pubkey-display {
  background: transparent;
  border: none;
  padding: 0;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e40af;
  transition: max-width 0.3s ease, color 0.2s ease;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  min-width: 0;
  text-align: right; /* Add this */
  direction: rtl; /* Add this */
}

.pubkey-display:hover {
  max-width: 1000px;
  color: #1e3a8a;
  text-decoration: underline;
  text-underline-offset: 4px;
  background: transparent;
  box-shadow: none;
  z-index: 10;
  position: relative;
}

.pubkey-display.compressed {
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .top-bar-content {
    padding: 6px 16px;
  }

  .lock-button {
    font-size: 0.8rem;
  }

  .avatar {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .pubkey-display {
    font-size: 0.75rem;
    max-width: 100px;
  }
}

.header {
  text-align: center;
  padding: 20px 0;
}

.logo {
  font-size: 48px;
  margin-bottom: 10px;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #4a5568;
}

.warning-box {
  background: rgba(254, 226, 226, 0.8);
  border: 2px solid rgba(220, 38, 38, 0.6);
  padding: 20px;
  border-radius: 12px;
  margin: 30px 0;
  text-align: center;
}

.warning-box strong {
  display: block;
  color: #991b1b;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.warning-box p {
  color: #7f1d1d;
  font-size: 0.9rem;
}

.card {
  background: rgba(80, 112, 115, 0.175);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(209, 213, 219, 0.3);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #171819;
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(209, 213, 219, 0.3);
}

.info-section {
  background: rgba(255, 255, 255, 0.4);
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid rgba(72, 97, 91, 0.6);
}

.info-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 4px;
}

.info-value {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  color: #1a1a1a;
  word-break: break-all;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #343840;
  margin: 24px 0 12px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

button {
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  width: 100%;
  display: block;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.btn-primary {
  background: linear-gradient(
    to bottom right,
    rgb(72, 97, 91),
    rgb(55, 65, 81)
  ) !important;
  color: rgba(239, 255, 251, 1) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

button.btn-primary:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 15px 20px -3px rgba(0, 0, 0, 0.3);
}

button.btn-secondary {
  background: rgba(255, 255, 255, 0.675) !important;
  color: #1a1a1a !important;
  border: 2px solid rgba(72, 97, 91, 0.3) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button.btn-secondary:hover:not(:disabled) {
  border-color: rgba(72, 97, 91, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(72, 97, 91, 0.2);
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  margin: 20px 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.checkbox-container:hover {
  background: rgba(255, 255, 255, 0.6);
}

.checkbox-container input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-container label {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a1a1a;
  user-select: none;
}

.input-field,
textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.675);
  font-size: 0.95rem;
  font-family: "Courier New", monospace;
  transition: all 0.2s ease;
  resize: vertical;
  min-height: 80px;
}

.input-field:focus,
textarea:focus {
  outline: none;
  border-color: rgba(72, 97, 91, 0.6);
  box-shadow: 0 0 0 3px rgba(72, 97, 91, 0.2), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.input-field::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

.output-box {
  background: rgba(245, 245, 245, 0.8);
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
  border-left: 4px solid rgba(72, 97, 91, 0.6);
  display: none;
}

.output-box.show {
  display: block;
}

.output-box.success {
  border-left-color: #10b981;
  background: rgba(236, 253, 245, 0.8);
}

.output-box.error {
  border-left-color: #ef4444;
  background: rgba(254, 242, 242, 0.8);
}

.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  gap: 16px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(156, 163, 175, 0.5);
}

.divider-text {
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer {
  text-align: center;
  padding: 40px 20px;
  margin-top: 60px;
  border-top: 2px solid rgba(209, 213, 219, 0.5);
}

.footer p {
  font-size: 0.85rem;
  color: #4a5568;
  letter-spacing: 0.1em;
}

.hidden {
  display: none;
}

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.popup {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 44px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(72, 97, 91, 0.2);
}

.popup .icon {
  font-size: 52px;
  text-align: center;
  margin-bottom: 20px;
}

.popup .title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.popup .subtitle {
  font-size: 0.9rem;
  text-align: center;
  color: #6b7280;
  margin-bottom: 32px;
  line-height: 1.5;
}

.popup .input-group {
  margin-bottom: 24px;
}

.popup .input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.popup .input-field {
  width: 100%;
  padding: 14px 0;
  border: none;
  border-bottom: 2px solid rgba(72, 97, 91, 0.25);
  background: transparent;
  font-size: 1rem;
  letter-spacing: 0.3em;
  transition: all 0.3s ease;
  font-family: "Courier New", monospace;
  color: #1a1a1a;
  min-height: auto;
}

.popup .input-field:focus {
  outline: none;
  border-bottom-color: rgb(72, 97, 91);
  box-shadow: none;
}

.popup .input-field.error {
  border-bottom-color: #ef4444;
}

.popup .error-message {
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 6px;
  display: none;
}

.popup .error-message.show {
  display: block;
}

.popup .password-strength {
  margin-top: 12px;
  display: none;
}

.popup .password-strength.show {
  display: block;
}

.popup .strength-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.popup .strength-fill {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.popup .strength-fill.weak {
  width: 33%;
  background: #ef4444;
}

.popup .strength-fill.medium {
  width: 66%;
  background: #f59e0b;
}

.popup .strength-fill.strong {
  width: 100%;
  background: #10b981;
}

.popup .strength-text {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
}

.popup button {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.popup .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 20px;
  }

  .popup {
    padding: 32px 24px;
  }
}
