* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea, #764ba2);
  min-height: 100vh;
  color: #333;
}

.topbar {
  background: rgba(255, 255, 255, 0.95);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 32px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.brand h1 {
  font-size: 22px;
  color: #4a2b8f;
}

.brand p {
  font-size: 13px;
  color: #777;
}

.mode-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
}

.badge.visitor {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.badge.owner {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.container {
  max-width: 700px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

/* Tab bar */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.25);
  padding: 8px;
  border-radius: 16px;
}

.tab-btn {
  flex: 1;
  border: none;
  padding: 13px 10px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  background: transparent;
  color: #fff;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.tab-btn:active {
  transform: scale(0.97);
}

.tab-btn.active {
  background: #fff;
  color: #4a2b8f;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card h2 {
  margin-bottom: 14px;
  color: #4a2b8f;
  font-size: 19px;
}

.count {
  background: #ede7f6;
  color: #5e35b1;
  font-size: 14px;
  padding: 2px 12px;
  border-radius: 12px;
}

.backup-text {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  resize: vertical;
  outline: none;
  transition: border 0.2s;
  background: #fafafa;
}

textarea:not([readonly]):focus {
  border-color: #764ba2;
  background: #fff;
}

textarea[readonly] {
  background: #f1f1f1;
  cursor: not-allowed;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
  margin-top: 8px;
}

.muted {
  font-size: 12px;
  color: #888;
}

.preview-box {
  background: #f7f3ff;
  border: 1px dashed #b39ddb;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
  min-height: 60px;
}

.preview-label {
  font-size: 12px;
  color: #7e57c2;
  font-weight: bold;
}

.preview-box p {
  margin-top: 6px;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: strict;
}

.btn-row {
  margin-top: 6px;
}

.btn {
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.96);
}

.btn.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

.btn.success {
  background: #2e7d32;
  color: #fff;
}

.btn.danger {
  background: #fff;
  color: #c62828;
  border: 2px solid #ef9a9a;
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
  background: #4a2b8f;
  color: #fff;
}

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

.bio-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bio-item {
  background: #faf7ff;
  border: 1px solid #e1d5f5;
  border-radius: 12px;
  padding: 14px;
}

.bio-item p.bio-text {
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: strict;
  margin-bottom: 6px;
}

.bio-item .date {
  font-size: 11px;
  color: #999;
  margin-bottom: 10px;
  display: block;
}

.bio-item .actions {
  display: flex;
  gap: 8px;
}

.mini-btn {
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.mini-btn.copy {
  background: #2e7d32;
  color: #fff;
}

.mini-btn.del {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.empty {
  text-align: center;
  color: #999;
  padding: 24px 10px;
  font-size: 14px;
}

.footer {
  text-align: center;
  color: #fff;
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.8;
}

.footer .muted {
  color: rgba(255, 255, 255, 0.75);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 26px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.modal-box h3 {
  color: #4a2b8f;
  margin-bottom: 6px;
}

.modal-box input {
  width: 100%;
  padding: 12px;
  margin: 14px 0;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  text-align: center;
}

.modal-box input:focus {
  border-color: #764ba2;
}

.modal-box .row {
  justify-content: center;
}

.link {
  background: none;
  border: none;
  color: #764ba2;
  font-size: 12px;
  margin-top: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.notice {
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: bold;
}

.notice.green {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.notice.blue {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .topbar {
    flex-direction: column;
    text-align: center;
  }
  .btn-row .btn {
    flex: 1;
  }
}
