:root {
  --three-e-quick: #2563eb;
  --three-e-full: #15803d;
  --three-e-deep: #7c3aed;
  --three-e-research: #b45309;
  --three-e-ink: #0f172a;
  --three-e-muted: #475569;
  --three-e-line: #dbe3ec;
}

.three-e-reading-modes {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 1.25rem 0 2rem;
  padding: 1rem;
  color: var(--three-e-ink);
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--three-e-line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.admin-bar .three-e-reading-modes { top: 32px; }

.three-e-reading-modes__heading {
  margin-bottom: .75rem;
  font-weight: 750;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.three-e-reading-modes__tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
}

.three-e-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: .45rem;
  padding: .65rem .7rem;
  border: 1px solid var(--three-e-line);
  border-radius: 10px;
  background: #fff;
  color: var(--three-e-ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.three-e-mode:hover { transform: translateY(-1px); }
.three-e-mode:focus-visible { outline: 3px solid #94a3b8; outline-offset: 2px; }
.three-e-mode--quick { color: var(--three-e-quick); }
.three-e-mode--full { color: var(--three-e-full); }
.three-e-mode--deep { color: var(--three-e-deep); }
.three-e-mode--research { color: var(--three-e-research); }
.three-e-mode--quick[aria-checked="true"] { background: #eff6ff; border-color: var(--three-e-quick); }
.three-e-mode--full[aria-checked="true"] { background: #f0fdf4; border-color: var(--three-e-full); }
.three-e-mode--deep[aria-checked="true"] { background: #f5f3ff; border-color: var(--three-e-deep); }
.three-e-mode--research[aria-checked="true"] { background: #fffbeb; border-color: var(--three-e-research); }

.three-e-mode__icon { font-size: 1.15em; line-height: 1; }
.three-e-reading-modes__status { min-height: 1.2em; margin: .65rem 0 0; color: var(--three-e-muted); font-size: .82rem; }

.three-e-quick-view {
  margin: 0 0 2rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--three-e-quick);
  border-radius: 0 10px 10px 0;
  background: #eff6ff;
}

.three-e-quick-view::before {
  display: block;
  margin-bottom: .65rem;
  color: var(--three-e-quick);
  content: "Quick Overview";
  font-weight: 800;
}

.three-e-deep {
  display: block;
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #c4b5fd;
  border-left: 4px solid var(--three-e-deep);
  border-radius: 10px;
  background: #f5f3ff;
}

.three-e-layer-label { margin-bottom: .45rem; color: var(--three-e-deep); font-weight: 800; }
.three-e-mode-full .three-e-deep,
.three-e-mode-quick .three-e-deep { display: none; }
.three-e-mode-quick .three-e-article-content { display: none; }

.three-e-research-action {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: .25rem 0 .35rem .45rem;
  padding: .25rem .5rem;
  border: 1px solid #f5c26b;
  border-radius: 999px;
  background: #fffbeb;
  color: var(--three-e-research);
  font: inherit;
  font-size: .75rem;
  font-weight: 750;
  cursor: pointer;
  vertical-align: middle;
}

.three-e-research-action:hover { background: #fef3c7; }
.three-e-research-action[hidden],
.three-e-research-panel[hidden] { display: none !important; }
.three-e-research-panel {
  margin: .7rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid #f5c26b;
  border-left: 4px solid var(--three-e-research);
  border-radius: 10px;
  background: #fffbeb;
}

.three-e-research-panel label { display: block; margin-bottom: .45rem; color: var(--three-e-research); font-weight: 800; }
.three-e-research-prompt {
  width: 100%;
  min-height: 9rem;
  box-sizing: border-box;
  padding: .75rem;
  border: 1px solid #d6a34c;
  border-radius: 8px;
  background: #fff;
  color: var(--three-e-ink);
  font: 400 .86rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  resize: vertical;
}

.three-e-research-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.three-e-copy-prompt,
.three-e-ai-link {
  min-height: 38px;
  padding: .45rem .7rem;
  border: 1px solid #d6a34c;
  border-radius: 8px;
  background: #fff;
  color: #7c3f00;
  font: inherit;
  font-size: .8rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.three-e-copy-prompt { background: var(--three-e-research); color: #fff; }
.three-e-copy-prompt:hover { background: #92400e; }
.three-e-ai-link:hover { background: #fef3c7; }

@media (max-width: 760px) {
  .three-e-reading-modes {
    margin: .5rem 0 1rem;
    padding: .4rem;
    border-radius: 10px;
  }
  .three-e-reading-modes__heading,
  .three-e-reading-modes__status { display: none; }
  .three-e-reading-modes__tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .3rem;
  }
  .three-e-mode {
    flex-direction: column;
    min-height: 52px;
    gap: .12rem;
    padding: .3rem .15rem;
    border-radius: 8px;
    font-size: clamp(.62rem, 2.7vw, .74rem);
  }
  .three-e-mode__icon { font-size: 1rem; }
}

@media (max-width: 782px) {
  body.admin-bar .three-e-reading-modes { top: 46px; }
}

@media (max-width: 420px) {
  .three-e-reading-modes__tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .three-e-mode { transition: none; }
}
