:root {
  --bg-yellow: #facc15;
  --dot-color: rgba(17, 24, 39, 0.28);
  --ink: #111827;
  --white: #ffffff;
  --soft: #f9fafb;
  --blue: #3b82f6;
  --purple: #c4b5fd;
  --yellow-btn: #facc15;
  --green: #22c55e;
  --red: #ef4444;
  --shadow: 5px 5px 0px #111827;
  --shadow-sm: 3px 3px 0px #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background-color: var(--bg-yellow);
  background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}

.page-wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 20px 14px 44px;
}

.comic-hero {
  text-align: center;
  margin-bottom: 18px;
}

.comic-title {
  margin: 0;
  font-family: "Bangers", Impact, sans-serif;
  font-size: clamp(44px, 11vw, 62px);
  letter-spacing: 2px;
  line-height: 1;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0px var(--ink);
}

.comic-tagline {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.comic-card {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 18px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.comic-input,
.comic-select {
  width: 100%;
  height: 44px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.comic-select {
  background: var(--green);
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.comic-btn {
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 9px 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.comic-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink);
}

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

.comic-btn.btn-small {
  padding: 5px 9px;
  font-size: 11px;
  box-shadow: 2px 2px 0px var(--ink);
}

.btn-blue { background: var(--blue); color: var(--white); }
.btn-purple { background: var(--purple); color: var(--ink); }
.btn-yellow { background: var(--yellow-btn); color: var(--ink); }
.btn-green { background: var(--green); color: var(--ink); }
.btn-red { background: var(--red); color: var(--white); }

.active-email-box {
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: var(--soft);
  padding: 10px 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  word-break: break-all;
  margin-bottom: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  border: 1.5px solid var(--ink);
  flex-shrink: 0;
}

.status-dot.err {
  background: var(--red);
}

.notice-text {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  min-height: 16px;
  color: #1f2937;
}

.notice-text.err {
  color: #b91c1c;
}

.notice-text.ok {
  color: #15803d;
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.inbox-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-icon {
  font-size: 22px;
}

.inbox-title {
  margin: 0;
  font-family: "Bangers", Impact, sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
}

.inbox-meta {
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-row {
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--soft);
  cursor: pointer;
}

.msg-row:hover,
.msg-row.selected {
  background: #fef9c3;
}

.msg-row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.msg-row-sender {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-row-time {
  font-size: 11px;
  color: #4b5563;
  flex-shrink: 0;
}

.msg-row-subject {
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waiting-state {
  padding: 22px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid #e5e7eb;
  border-top-color: var(--ink);
  border-right-color: var(--red);
  animation: spin 0.85s linear infinite;
}

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

.waiting-bubble {
  position: relative;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: var(--white);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.waiting-bubble::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--white);
  border-left: 2.5px solid var(--ink);
  border-top: 2.5px solid var(--ink);
}

/* Gmail-like compact message reader */
.detail-panel {
  margin-top: 12px;
  border-top: 2px dashed var(--ink);
  padding-top: 12px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.detail-tabs {
  display: flex;
  gap: 6px;
}

.tab-pill {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.tab-pill.active {
  background: var(--blue);
  color: var(--white);
}

.gmail-header {
  background: var(--soft);
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.gmail-subject {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 4px;
  word-break: break-word;
}

.gmail-meta-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: #374151;
}

.gmail-sender {
  font-weight: 700;
  word-break: break-all;
}

.gmail-date {
  font-size: 10.5px;
  color: #6b7280;
  white-space: nowrap;
}

.gmail-to {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  word-break: break-all;
}

.detail-body-wrap {
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

.msg-iframe {
  display: block;
  width: 100%;
  min-height: 250px;
  border: 0;
  background: var(--white);
}

.msg-text-pre {
  margin: 0;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.detail-attachments {
  margin-top: 8px;
  font-size: 11px;
  color: #374151;
}

.detail-attachments ul {
  margin: 4px 0 0;
  padding-left: 16px;
}

.hidden {
  display: none !important;
}
