:root {
  --bg: #0f1220;
  --card: #1a1f36;
  --card-2: #232a4d;
  --text: #e7eaf6;
  --muted: #9aa3c7;
  --accent: #6c8cff;
  --accent-2: #4f6ef0;
  --border: #2c335a;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.lang-select {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 60;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

/* 登录界面 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 26px; }
.login-card .sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}
.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border-color: var(--accent);
  font-size: 15px;
}
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 8px;
}
header h1 { margin: 0; font-size: 24px; }
.header-actions { display: flex; gap: 8px; }
button.ghost { background: transparent; font-size: 13px; padding: 7px 12px; }

.address-row { display: flex; gap: 8px; align-items: stretch; }
#local-part {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.domain-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}
#open-btn { background: var(--accent); border-color: var(--accent); white-space: nowrap; }
.current-address { color: var(--text); font-size: 16px; font-weight: 700; margin-left: auto; font-family: ui-monospace, monospace; }

main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}
select, button {
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
button:hover { background: var(--accent-2); }
#copy-btn { background: var(--accent); border-color: var(--accent); }
.countdown { color: var(--muted); font-size: 13px; margin-left: auto; }

.mail-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}
.status { font-size: 12px; }

.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--card-2);
  transition: border-color .15s;
}
.mail-item:hover { border-color: var(--accent); }
.mail-item.unseen { border-left: 3px solid var(--accent); }
.mail-item .from { font-weight: 600; font-size: 14px; }
.mail-item .subject { margin: 4px 0; font-size: 15px; }
.mail-item .meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.empty { color: var(--muted); text-align: center; padding: 30px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  border: none; background: none;
  font-size: 26px; color: var(--muted);
  cursor: pointer;
}
.mail-detail h2 { margin-top: 0; font-size: 20px; }
.mail-detail .headers { color: var(--muted); font-size: 13px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.mail-detail .body { line-height: 1.6; }
.mail-detail iframe { width: 100%; border: none; min-height: 300px; background: #fff; border-radius: 8px; }
.mail-detail .attachments a {
  display: inline-block; margin: 4px 8px 4px 0; padding: 6px 12px;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--accent); text-decoration: none; font-size: 13px;
}
.mail-detail .del-btn { background: transparent; border-color: var(--danger); color: var(--danger); margin-top: 14px; }

.pwd-modal-content { max-width: 380px; }
.pwd-modal-content h2 { margin-top: 0; }
.pwd-modal-content input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}
.pwd-modal-content button[type="submit"] {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  border-color: var(--accent);
}

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--accent-2); color: #fff; padding: 14px 26px; border-radius: 12px;
  font-size: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.45);
  max-width: 90vw; text-align: center; word-break: break-all;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; }
