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

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #222633;
  --border: #2a2e3d;
  --text: #e4e6f0;
  --text-dim: #8b8fa3;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --green: #00b894;
  --red: #e17055;
  --yellow: #fdcb6e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

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

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo h1 span {
  color: var(--accent);
}

.tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Email Display */
.email-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.email-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.email-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.email-address {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--accent);
  word-break: break-all;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(108, 92, 231, 0.08);
  border-radius: 8px;
  border: 1px dashed rgba(108, 92, 231, 0.25);
  cursor: pointer;
  transition: all 0.2s;
}

.email-address:hover {
  background: rgba(108, 92, 231, 0.14);
  border-color: rgba(108, 92, 231, 0.4);
}

.email-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn svg {
  flex-shrink: 0;
}

.btn-copy {
  background: var(--accent);
  color: white;
}

.btn-copy:hover {
  background: #5a4bd4;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-refresh {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-refresh:hover {
  background: #2a2e3d;
}

.btn-new {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-new:hover {
  background: rgba(0, 184, 148, 0.1);
}

.btn-back {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-back:hover {
  background: var(--bg-card);
}

/* Timer */
.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.timer svg {
  opacity: 0.6;
}

/* Inbox */
.inbox-section {
  margin-top: 24px;
}

.inbox-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.inbox-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}

.badge:empty,
.badge[data-count="0"] {
  background: var(--border);
}

.inbox-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
}

.inbox-empty svg {
  opacity: 0.3;
  margin-bottom: 12px;
}

.inbox-empty p {
  margin-bottom: 4px;
}

.inbox-empty .hint {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Message List */
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.message-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.message-item .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
}

.message-item .info {
  flex: 1;
  min-width: 0;
}

.message-item .from {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-item .subject {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-item .date {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Message View */
.message-view {
  margin-top: 16px;
}

.message-header {
  margin-bottom: 16px;
}

.message-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.message-meta {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.message-meta h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.message-meta .meta-row {
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.message-meta .meta-label {
  color: var(--text-dim);
  min-width: 50px;
}

.message-body {
  line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
}

.message-body img {
  max-width: 100%;
  height: auto;
}

.message-body pre {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.message-body a {
  color: var(--accent);
  text-decoration: none;
}

.message-body a:hover {
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--green);
  box-shadow: 0 8px 32px rgba(0, 184, 148, 0.15);
}

.toast-icon {
  color: var(--green);
  flex-shrink: 0;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon-warn {
  background: rgba(225, 112, 85, 0.12);
  color: var(--red);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-modal-cancel {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-modal-cancel:hover {
  background: #2a2e3d;
}

.btn-modal-confirm {
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-modal-confirm:hover {
  background: #d4503f;
  box-shadow: 0 0 20px rgba(225, 112, 85, 0.3);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 600px) {
  .email-address {
    font-size: 1.1rem;
  }

  .email-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .message-item {
    padding: 12px 14px;
  }

  .message-item .date {
    display: none;
  }

  .message-content {
    padding: 16px;
  }
}

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

.message-item {
  animation: fadeIn 0.2s ease-out;
}

.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

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