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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 500px;
  width: 100%;
  margin: 1rem;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  color: #58a6ff;
}

.subtitle {
  color: #8b949e;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.step {
  animation: fadeIn 0.2s ease;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e1e4e8;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #58a6ff;
}

.role-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  flex: 1;
}

.btn:hover {
  opacity: 0.9;
}

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

.btn-primary {
  background: #238636;
  color: #fff;
}

.btn-secondary {
  background: #30363d;
  color: #e1e4e8;
}

.btn-danger {
  background: #da3633;
  color: #fff;
  margin-top: 1rem;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  flex: none;
  background: #30363d;
  color: #e1e4e8;
}

.instructions {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1rem 1rem 2rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: #8b949e;
  line-height: 1.6;
}

.instructions li {
  margin-bottom: 0.25rem;
}

.instructions strong {
  color: #e1e4e8;
}

.token-row {
  display: flex;
  gap: 0.5rem;
}

.token-row input {
  flex: 1;
}

.done-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-back {
  margin-top: 1.25rem;
  flex: none;
  width: auto;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress */
.progress-bar {
  width: 100%;
  height: 20px;
  background: #0d1117;
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
  border: 1px solid #30363d;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #238636, #2ea043);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.transfer-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #8b949e;
}

#transfer-percent {
  font-weight: 700;
  color: #58a6ff;
}

/* Status bar */
.status-bar {
  margin-top: 1.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #8b949e;
  border-top: 1px solid #30363d;
  min-height: 1.5rem;
}

.status-bar.error {
  color: #f85149;
}

.status-bar.success {
  color: #3fb950;
}

#file-info, #receive-info {
  margin-top: 1rem;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.8rem;
}

.footer a {
  color: #8b949e;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: #58a6ff;
}

/* Subpages */
.back-link {
  display: inline-block;
  color: #58a6ff;
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.page .section {
  margin-bottom: 1.5rem;
}

.page h2 {
  font-size: 1rem;
  color: #58a6ff;
  margin-bottom: 0.5rem;
}

.page h3 {
  font-size: 0.9rem;
  color: #e1e4e8;
  margin: 0.75rem 0 0.25rem;
}

.page ul {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.page li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.page a {
  color: #58a6ff;
  text-decoration: none;
}

.page a:hover {
  text-decoration: underline;
}
