@import url("https://fonts.googleapis.com/css2?family=Didact+Gothic&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Libre+Baskerville:ital,wght@0,400..700;1,400..700&display=swap");
:root {
  --font-serif: 'Libre Baskerville', serif;
  --font-sans: 'Inter', Arial, sans-serif;
  --font-sans-alt: 'Didact Gothic', sans-serif;
  --black: #2E302F;
  --white: #FFFFFF;
  --grey: #CCCCCC;
  --dark-grey: #666666;
  --off-white: #FAF5ED;
  --accent-dark: #AE643E;
  --accent-dark-bg: #F1E2DA;
  --accent-light: #D4B800;
  --accent-light-bg: #F2ECB8;
  --text-primary: var(--black);
  --text-inverse: var(--white);
  --text-secondary: var(--accent-dark);
  --surface-primary: var(--off-white);
  --surface-inverse: var(--black);
  --stroke-primary: var(--black);
  --border-primary: var(--black);
  --border-secondary: var(--grey);
  --lens-border: var(--black);
  --inactive: var(--dark-grey);
  --muted: var(--dark-grey);
  --icon_sm: 14px;
  --icon_md: 18px;
  --icon_lg: 22px;
  --border-radius: 12px;
  --sp_sm: 5px;
  --sp_md: 10px;
  --sp_lg: 20px;
  --sp_xl: 40px;
  --sp_xxl: 80px;
}

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

html {
  font-size: 16px;
  color: var(--black);
}

body {
  font-family: var(--font-sans);
  background: var(--surface-primary);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.5;
}

a {
  color: var(--text);
  text-decoration: underline;
  font-weight: 500;
}
a:hover {
  text-decoration: none;
  opacity: 0.75;
}

p {
  font-size: 1rem;
  line-height: 1.5;
}

ul li {
  list-style: disc;
  margin: 0 0 0.5rem 1rem;
  line-height: 1.6;
}

.title-icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
  display: inline-block;
}

.app {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 0 1rem;
  min-height: calc(100vh - 40px - 80px);
}

footer {
  padding: 40px 0 20px;
  text-align: center;
  font-size: 0.8rem;
}

.section-label {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
}
.badge-row .badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.center_wrapper {
  width: 100%;
  text-align: center;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-primary);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.125rem;
}

h3 {
  font-size: 1.125rem;
}

h4 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

input[type=text],
input[type=email] {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.15s;
  padding: 8px;
  box-sizing: border-box;
}
input[type=text]::placeholder,
input[type=email]::placeholder {
  color: #49454F;
}

button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 4px;
  background-color: var(--surface-inverse);
  color: var(--text-inverse);
}
button:hover {
  opacity: 0.85;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

button.icon {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 2px 0 0 5px;
  text-align: center;
}

fieldset {
  border: 1px dashed var(--black);
  padding: var(--sp_lg);
}

legend {
  background-image: radial-gradient(circle, var(--black) 45%, transparent 45%);
  background-size: 4px 4px;
  padding: 0.5rem 0.75rem;
  margin: 0 auto;
}
legend span {
  background-color: var(--surface-primary);
  padding: 0.1rem 0.2rem;
  font-weight: 700;
}

input::placeholder {
  font-style: italic;
  color: var(--black);
}

.masthead {
  padding: 0;
  margin: 0;
  margin-bottom: 0;
  text-align: left;
}
.masthead .masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.masthead .masthead-top img.logo {
  width: 150px;
}
.masthead .masthead-top nav {
  position: relative;
}

.logo-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans-alt);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
}

.logo-line1,
.logo-line2 {
  display: block;
}

.masthead-link {
  text-decoration: none;
}

.masthead-actions {
  position: absolute;
  top: 1.1rem;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.masthead-share {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.masthead-share img {
  width: 20px;
  height: 20px;
}

.masthead-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}
.masthead-close img {
  width: 22px;
  height: 22px;
}
.masthead-close:hover {
  opacity: 1;
}

.masthead-eyebrow {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.masthead-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0;
  transition: color 0.15s;
}

.masthead h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  padding-bottom: 0;
  width: 85%;
}

.color-picker {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 50;
}
.color-picker.open {
  display: flex;
}

.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--border-primary);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.color-swatch:hover {
  transform: scale(1.15);
}

.color-picker-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.color-picker-close:hover {
  opacity: 1;
}
.color-picker-close img {
  width: 1.25rem;
  height: 1.25rem;
}

.masthead-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}
.masthead-hamburger svg {
  width: var(--icon_lg);
}

.fullscreen-menu {
  position: fixed;
  inset: 0;
  background: var(--surface-primary);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.fullscreen-menu[hidden] {
  display: none;
}

.fullscreen-menu-close {
  position: fixed;
  top: 28px;
  right: max(20px, 20px + (100vw - 780px) / 2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fullscreen-menu-close img {
  width: var(--icon_lg);
}

.fullscreen-menu-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.fullscreen-menu-nav a {
  font-size: 1.5rem;
  text-decoration: none;
  transition: opacity 0.15s;
}
.fullscreen-menu-nav a:hover {
  opacity: 0.6;
}
.fullscreen-menu-nav a.menu-link--disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.fullscreen-menu-nav a.menu-link--disabled:hover {
  opacity: 0.35;
}

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--surface-primary) 92%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.loading-overlay p {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--border-dark);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-dots {
  display: inline-block;
}
.loading-dots span {
  opacity: 0;
  animation: loading-dot 1.2s infinite;
}
.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}
.loading-dots span:nth-child(2) {
  animation-delay: 0.3s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes loading-dot {
  0%, 100% {
    opacity: 0;
  }
  30%, 70% {
    opacity: 1;
  }
}
.lens-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.lens-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.lens-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-primary);
  border-top: 1px solid var(--black);
  padding: var(--sp_lg) var(--sp_lg) 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
  max-height: 80vh;
  overflow-y: auto;
}
.lens-drawer.open {
  transform: translateY(0);
  box-shadow: 0 -9px 10px rgba(0, 0, 0, 0.05);
}
.lens-drawer .signin-drawer-inner {
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-gap: var(--sp_sm);
  max-width: 600px;
  margin: 0 auto;
}
.lens-drawer .signin-drawer-message {
  padding: 0 0 var(--sp_sm);
}
.lens-drawer .signin-drawer-message[hidden] {
  display: none;
}
.lens-drawer .signin-drawer-success {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--sp_md) 0;
}
.lens-drawer .signin-drawer-success[hidden] {
  display: none;
}
.lens-drawer .lens-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: var(--sp_md);
}

.lens-drawer-listitem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--border-secondary);
  padding: 10px;
  min-height: 68px;
}

.lens-drawer-listitem-flag {
  font-size: 1.1rem;
  width: 35px;
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.lens-drawer-listitem-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lens-drawer-listitem-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.lens-drawer-listitem-value {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.25px;
}

.lens-drawer-listitem-caret {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.lens-drawer-listitem--expandable {
  cursor: pointer;
}
.lens-drawer-listitem--expandable.expanded .lens-drawer-listitem-caret {
  transform: rotate(180deg);
}

.lens-drawer-listitem--empty {
  border-style: dashed;
}

#lensDrawerTaxonomy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#lensDrawerTaxonomy:empty {
  display: none;
}
#lensDrawerTaxonomy.taxonomy-inactive {
  opacity: 0.35;
  pointer-events: none;
}

.lens-drawer-options {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-secondary);
  border-top: none;
}
.lens-drawer-options[hidden] {
  display: none;
}

.lens-drawer-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-secondary);
  transition: background 0.1s;
}
.lens-drawer-option:last-child {
  border-bottom: none;
}
.lens-drawer-option:hover {
  background: rgba(0, 0, 0, 0.03);
}

.lens-drawer-option-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  color: transparent;
  font-size: 16px;
}
.lens-drawer-option.selected .lens-drawer-option-check {
  color: var(--text);
}

.lens-drawer-option-content {
  flex: 1;
  min-width: 0;
}

.lens-drawer-option-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.lens-drawer-option-def {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #49454F;
  margin-top: 2px;
}

.lens-drawer-native-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.lens-drawer-field[hidden] {
  display: none;
}

.lens-drawer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  position: sticky;
  bottom: 0;
  background: var(--surface-primary);
  border-top: 1px solid var(--border-secondary);
  margin: var(--sp_lg) -20px;
  padding: var(--sp_lg);
  z-index: 1;
}

.lens-drawer-btn-cancel {
  color: var(--black);
  background: none;
  border: 1px solid var(--black);
}
.lens-drawer-btn-cancel:hover {
  background-color: var(--accent-dark-bg);
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr max-content;
  grid-gap: var(--sp_md);
  align-items: center;
}

.auth-panel {
  margin: 2rem 0 0;
}
.auth-panel [hidden] {
  display: none !important;
}
.auth-panel .auth-status {
  font-size: 0.85rem;
  margin-top: 0.6rem;
  font-style: italic;
}
.auth-panel .auth-status.error {
  color: var(--accent);
  font-style: normal;
}
.auth-panel .auth-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0;
}
.auth-panel .auth-user-row .card-subtitle {
  margin-bottom: 0;
}
.auth-panel .auth-user-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.briefing-list {
  margin-top: 1rem;
}

.briefing-list-empty {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.briefing-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
}

.briefing-list-link {
  flex: 1;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}
.briefing-list-link:hover {
  text-decoration-color: var(--text-primary);
}

.kebab-wrap {
  position: relative;
  flex-shrink: 0;
}

.kebab-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}
.kebab-btn:hover {
  opacity: 0.5;
}

.kebab-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 20;
  min-width: 130px;
}
.kebab-menu.open {
  display: block;
}

.kebab-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.kebab-item:hover {
  background: var(--surface-primary);
}
.kebab-item.danger {
  color: var(--accent);
}

.rename-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 237, 255, 0.92);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  align-items: center;
  justify-content: center;
}
.rename-overlay.visible {
  display: flex;
}

.rename-dialog {
  background: var(--surface);
  border: 1px solid var(--border-dark);
  padding: 1.75rem;
  width: min(480px, 100vw - 2.5rem);
}
.rename-dialog .section-label {
  margin-bottom: 1rem;
}

.rename-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface-primary);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}
.rename-input:focus {
  border-color: var(--border-dark);
}

.rename-actions {
  display: flex;
  gap: 0.75rem;
}

.rename-save-btn {
  padding: 0.5rem 1.25rem;
  background: var(--border-dark);
  color: var(--surface-primary);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.rename-save-btn:hover {
  opacity: 0.82;
}

.rename-cancel-btn {
  padding: 0.5rem 1.25rem;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.rename-cancel-btn:hover {
  border-color: var(--border-dark);
  color: var(--text);
}

.conv-auth-prompt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}

.conv-auth-text {
  font-family: var(--font-sans);
  font-size: 14px;
  color: #49454F;
  margin: 0;
}

.auth-panel {
  margin: 2rem 0 0;
}
.auth-panel > h2 {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 1rem;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--black);
}
.auth-panel > p {
  margin: 0 0 var(--sp_lg);
}
.auth-panel > p:last-child {
  margin-bottom: 0;
}
.auth-panel .about-lead {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 700;
  color: var(--text);
}
.auth-panel .about-meta {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: var(--sp_md);
  border-top: 1px solid var(--border-secondary);
}
.auth-panel .about-meta a {
  color: var(--text);
}
.auth-panel fieldset {
  border: 2px solid var(--black);
  padding: 1.5rem 1.25rem;
}
.auth-panel legend {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.5rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-label-sub {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
}

.profile-email {
  font-size: 0.95rem;
  color: var(--text);
}

.profile-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}

.profile-leaning-select,
.profile-select-wrap .country-select {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.profile-context {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  border: 2px solid var(--black);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  resize: vertical;
}
.profile-context::placeholder {
  color: var(--muted);
}

.profile-char-count {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-save-btn {
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
}

.profile-save-status {
  font-size: 0.85rem;
}
.profile-save-status.ok {
  color: green;
}
.profile-save-status.error {
  color: red;
}

.profile-signin-hint {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}
.profile-signin-hint a {
  color: var(--text);
  font-weight: 700;
}

.auth-signout-btn {
  background: none;
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  color: var(--text);
}
.auth-signout-btn:hover {
  border-color: var(--text);
}
