body, html {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  background-color: #111827;
  color: #f3f4f6;
  height: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
}

.main-header {
  padding: 1.25rem 0;
  text-align: center;
  border-bottom: 1px solid #374151;
  margin-bottom: 2rem;
  width: 100%;
  position: -webkit-sticky; /* For Safari */
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #111827; /* Match body background */
}

.header-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.header-links a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.2s ease;
}

.header-links a:hover {
  color: #f3f4f6;
  text-decoration: underline;
}

.header-links span {
  color: #4b5563;
}

.main-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 auto 0.5rem;
  background: linear-gradient(90deg, #60a5fa, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
  max-width: 100%;
  padding: 0 var(--mobile-padding);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.main-header p {
  font-size: 1rem;
  color: #9ca3af;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--mobile-padding);
  line-height: 1.6;
}

.app-definition {
  background-color: #1f2937;
  border-radius: 0.75rem;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid #374151;
  text-align: left;
}

.app-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #374151;
  padding-bottom: 2rem;
}

.app-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.app-name {
  font-size: 1.875rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0;
}

.app-version {
  color: #9ca3af;
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.8;
}

.app-description {
  color: #d1d5db;
  font-size: 1.125rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

.abilities-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ability-card {
  background-color: #111827;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ability-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ability-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f3f4f6;
  margin: 0 0 0.75rem 0;
}

.ability-description {
  color: #d1d5db;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.parameters-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin: 1.5rem 0 0.75rem 0;
}

.parameter-item {
  background-color: rgba(17, 24, 39, 0.5);
  border-left: 3px solid #3b82f6;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0 0.25rem 0.25rem 0;
}

.parameter-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.parameter-name {
  font-weight: 600;
  color: #f3f4f6;
  margin-bottom: 0.25rem;
}

.parameter-type {
  font-size: 0.75rem;
  color: #9ca3af;
  background: rgba(75, 85, 99, 0.5);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
}

.parameter-description {
  color: #9ca3af;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-all;
}

@media (max-width: 480px) {
  .parameter-name-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .parameter-type {
    margin-left: 0;
  }
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.card {
  background-color: #1f2937;
  border-radius: 0.75rem;
  padding: 1.5rem;
  border: 1px solid #374151;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  border-color: #4b5563;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #f9fafb;
  line-height: 1.3;
}

.card-text {
  color: #d1d5db;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  font-size: 0.95rem;
}

/* Responsive adjustments for cards */
@media (min-width: 480px) {
  .card {
    padding: 1.75rem;
  }

  .card-title {
    font-size: 1.4rem;
  }
}

@media (min-width: 768px) {
  .card {
    padding: 2rem;
  }

  .card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
}

.status-indicator {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background-color: #374151;
  border-radius: 9999px;
  width: fit-content;
}

.status-indicator .dot {
  width: 12px;
  height: 12px;
  background-color: #34d399;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

:root {
  --mobile-padding: 1rem;
  --desktop-padding: 2rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  color: #f3f4f6;
  background-color: #111827;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg {
  max-width: 100%;
  height: auto;
}

button, input, textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

button, input {
  overflow: visible;
}

button, [type="button"], [type="reset"], [type="submit"] {
  -webkit-appearance: button;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--mobile-padding);
  flex: 1;
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--desktop-padding);
  }
}

.endpoint-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.endpoint-list li {
  margin-bottom: 0.75rem;
}

.code-block {
  background-color: #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  color: #e5e7eb;
}

.app-actions {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
}

.action-button {
  background-color: #4f46e5;
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.action-button:hover {
  background-color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.action-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.action-button:disabled {
  background-color: #4b5563;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
  transform: none !important;
  box-shadow: none !important;
}

/* Button container */
.button-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  margin-top: 1.5rem;
}

@media (min-width: 480px) {
  .button-container {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .action-button {
    width: auto;
    min-width: 180px;
  }
}

@media (min-width: 768px) {
  .button-container {
    margin-top: 2rem;
  }
}

.pkp-address-container {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background-color: rgba(31, 41, 55, 0.9);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.pkp-address-label {
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pkp-address-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #4f46e5;
  margin-right: 4px;
}

.pkp-address {
  font-family: 'Fira Code', 'Courier New', monospace;
  color: #60a5fa;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 100%;
  word-break: break-all;
  overflow-wrap: break-word;
  hyphens: auto;
  letter-spacing: -0.01em;
}

/* Responsive adjustments for PKP address */
@media (min-width: 480px) {
  .pkp-address-container {
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.25rem;
  }

  .pkp-address {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: #1f2937;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin: 2rem 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@media (min-width: 640px) {
  .modal {
    align-items: center;
    padding: 1.5rem;
  }

  .modal-content {
    margin: 0;
    max-height: 90vh;
  }
}

@media (min-width: 768px) {
  .modal {
    padding: 2rem;
  }

  .modal-content {
    max-width: 600px;
  }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.1);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0;
  line-height: 1.4;
}

.modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem -0.5rem -0.5rem 0.5rem;
  line-height: 1;
  transition: all 0.2s ease;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #f3f4f6;
  background-color: rgba(255, 255, 255, 0.05);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  -webkit-overflow-scrolling: touch;
}

.connection-instructions {
  margin-bottom: 1.75rem;
  color: #d1d5db;
  line-height: 1.7;
  font-size: 0.95rem;
}

.connection-instructions p {
  margin-bottom: 1.25rem;
}

.connection-instructions p:last-child {
  margin-bottom: 0;
}

.connection-link-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
  width: 100%;
}

.connection-link {
  flex-grow: 1;
  padding: 0.875rem 1rem;
  background-color: rgba(17, 24, 39, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  color: #e5e7eb;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
  word-break: break-all;
  overflow-wrap: break-word;
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

.copy-button {
  background-color: #4f46e5;
  border: none;
  border-radius: 0.5rem;
  color: white;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.copy-button:hover {
  background-color: #4338ca;
  transform: translateY(-1px);
}

.copy-button:active {
  transform: translateY(0);
  background-color: #3f3bb9;
}

.copy-button:disabled {
  background-color: #4b5563;
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  background-color: rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for connection link */
@media (min-width: 480px) {
  .connection-link-container {
    flex-direction: row;
    align-items: center;
  }

  .connection-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: none;
    padding-right: 1.5rem;
  }

  .copy-button {
    width: auto;
    min-width: 120px;
  }
}

/* Animation for copy feedback */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-5px); }
  10% { opacity: 1; transform: translateY(0); }
  90% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(5px); }
}

.copy-feedback {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: #10b981;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeInOut 2s ease-in-out forwards;
  pointer-events: none;
  opacity: 0;
}

.main-footer {
  border-top: 1px solid #374151;
  padding: 2rem;
  color: #9ca3af;
  margin-top: auto;
}
