:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface-hover: #1a2336;
  --border: #1b3f73;
  --border-hover: #2a5090;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #33e6bf;
  --accent-hover: #2dd4ad;
  --accent-dim: rgba(51, 230, 191, 0.15);
  --error: #fb2c36;
  --error-bg: rgba(251, 44, 54, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Header */
.header {
  padding: 3rem 0 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Loader */
.loader-container {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.loader-content {
  text-align: center;
}
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
.loader-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.loader-error {
  color: var(--error);
  padding: 2rem;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Upload Section */
.upload-section {
  margin: 2rem 0;
}

.file-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.input-wrapper {
  flex: 1;
  display: flex;
  gap: 0.75rem;
}

.file-drop-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}
.file-drop-label:hover,
.file-drop-label.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.file-drop-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-input {
  display: none;
}

.password-input {
  width: 200px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}
.password-input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}
.btn-icon-only:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-bg);
}

/* Actions */
.actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Results */
.results-container {
  margin: 2rem 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.results-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.result-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.result-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.error-card {
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.error-card h3 {
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.error-card p {
  color: var(--text);
  font-size: 0.9rem;
}

/* Share Details */
.share-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.share-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
.share-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.share-value {
  color: var(--text);
}
.share-value.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* Key Rows */
.key-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.key-row:last-child {
  border-bottom: none;
}
.key-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.key-value-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.key-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  line-height: 1.5;
  flex: 1;
  color: var(--text);
}
.sensitive .key-value {
  color: var(--text-muted);
}

.copy-btn {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.copy-btn.copied {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Coin Grid */
.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.coin-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color 0.2s;
}
.coin-card:hover {
  border-color: var(--border-hover);
}

.coin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.coin-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: capitalize;
}
.coin-icon {
  border-radius: 50%;
  flex-shrink: 0;
}
.coin-path {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.coin-field {
  margin-bottom: 0.5rem;
}
.coin-field-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.coin-field-value-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.coin-field-value {
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  line-height: 1.4;
  flex: 1;
}

.show-secrets-btn {
  margin-top: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.show-secrets-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Collapsible */
.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.collapsible-header .arrow {
  font-family: var(--mono);
  color: var(--text-muted);
}
.collapsible-body {
  display: none;
  padding-top: 0.75rem;
}

/* Demo Section */
.demo-section {
  margin: 1.5rem 0;
  text-align: center;
}
.demo-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.demo-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-demo {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
}

/* Info Section */
.info-section {
  margin: 2rem 0;
}
.info-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.info-section summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}
.info-section summary:hover {
  color: var(--accent);
}
.info-section details[open] summary {
  border-bottom: 1px solid var(--border);
}
.info-section details p,
.info-section details ul {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.info-section details ul {
  padding-left: 2rem;
}
.info-section details li {
  margin-bottom: 0.25rem;
}
.info-section details pre {
  margin: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.info-section details pre code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-links {
  margin-top: 0.5rem;
}
.footer-links .sep {
  margin: 0 0.5rem;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 640px) {
  .header h1 {
    font-size: 1.5rem;
  }
  .input-wrapper {
    flex-direction: column;
  }
  .password-input {
    width: 100%;
  }
  .actions {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
  .coin-grid {
    grid-template-columns: 1fr;
  }
}
