/* ==========================================================================
   PangramMatrix - Interactive 7-Letter Pangram Detector & Word Matrix
   Luxury Emerald & Obsidian Stylesheet
   ========================================================================== */

:root {
  --bg-body: #f0fdf4;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-header: #022c22;
  --text-main: #064e3b;
  --text-dark: #0f172a;
  --text-body: #1e293b;
  --text-muted: #334155;
  --text-faint: #64748b;
  --border-emerald: #a7f3d0;
  --border-subtle: #e2e8f0;
  --primary-emerald: #059669;
  --primary-emerald-dark: #047857;
  --primary-emerald-light: #ecfdf5;
  --accent-gold: #f59e0b;
  --accent-gold-dark: #d97706;
  --accent-gold-light: #fffbeb;
  --perfect-purple: #7e22ce;
  --perfect-purple-light: #faf5ff;
  --shadow-sm: 0 1px 3px 0 rgba(6, 78, 59, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(6, 78, 59, 0.08), 0 2px 4px -2px rgba(6, 78, 59, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(6, 78, 59, 0.1), 0 4px 6px -4px rgba(6, 78, 59, 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-body);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Site Header
   -------------------------------------------------------------------------- */
.site-header {
  background: var(--bg-header);
  color: #ffffff;
  border-bottom: 2px solid #065f46;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(110, 231, 183, 0.4);
}

.header-status-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: #a7f3d0;
  background: #064e3b;
  border: 1px solid #047857;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   Main Layout & Hero
   -------------------------------------------------------------------------- */
.main-wrapper {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4rem;
  width: 100%;
}

.hero-intro {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 2.25rem;
}

.hero-intro h1 {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero-intro p {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Solver Interactive Card
   -------------------------------------------------------------------------- */
.solver-card {
  background: var(--bg-card);
  border: 2px solid var(--border-emerald);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
  margin-bottom: 3rem;
}

.input-block-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-hint {
  font-size: 0.85rem;
  color: var(--text-faint);
}

.pangram-input-wrap {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
}

@media (max-width: 650px) {
  .pangram-input-wrap {
    grid-template-columns: 1fr;
  }
}

.center-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.outer-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.center-input {
  height: 58px;
  background: var(--accent-gold-light);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-md);
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-dark);
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.center-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
  background: #ffffff;
}

.outer-input {
  height: 58px;
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-emerald);
  border-radius: var(--radius-md);
  padding: 0 1.25rem;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: var(--text-dark);
  text-transform: uppercase;
  transition: all 0.15s ease;
}

.outer-input:focus {
  outline: none;
  border-color: var(--primary-emerald);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

/* Visual Letter Matrix Bar */
.matrix-tiles-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.5rem 0;
  min-height: 48px;
}

.matrix-tile {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.matrix-tile.is-center {
  background: var(--accent-gold);
  color: #000000;
  border: 2px solid var(--accent-gold-dark);
}

.matrix-tile.is-outer {
  background: var(--primary-emerald-light);
  color: var(--primary-emerald-dark);
  border: 2px solid var(--border-emerald);
}

/* Action Buttons */
.action-buttons-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.btn-primary {
  flex: 2;
  min-width: 160px;
  height: 52px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  flex: 1;
  min-width: 100px;
  height: 52px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  color: var(--text-dark);
}

.btn-sample {
  background: none;
  border: none;
  color: var(--primary-emerald);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  align-self: flex-start;
}

.btn-sample:hover {
  color: var(--primary-emerald-dark);
}

/* Alert Box */
.alert-box {
  display: none;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Results Section
   -------------------------------------------------------------------------- */
.results-container {
  display: none;
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
}

.single-line-notice {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  color: #166534;
  line-height: 1.4;
}

.notice-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 800px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  text-align: center;
}

.stat-item-highlight {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border: 2px solid var(--primary-emerald);
}

.stat-item-perfect {
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%);
  border: 2px solid var(--perfect-purple);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
}

.stat-item-highlight .stat-value {
  color: var(--primary-emerald-dark);
}

.stat-item-perfect .stat-value {
  color: var(--perfect-purple);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-top: 0.35rem;
}

.stat-subtext {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.25rem;
}

/* Toolbar & Filters */
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-pills-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: var(--bg-card-subtle);
  color: var(--text-dark);
}

.filter-pill.active {
  background: var(--primary-emerald);
  border-color: var(--primary-emerald);
  color: #ffffff;
}

.sort-and-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-copy-all {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-copy-all:hover {
  background: var(--bg-card-subtle);
}

/* Words Grid */
.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.word-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.word-pill:hover {
  border-color: var(--primary-emerald);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.word-text {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-dark);
  white-space: nowrap;
}

.word-points {
  font-size: 0.76rem;
  font-weight: 700;
  color: #1e293b;
  background: #e2e8f0;
  padding: 0.18rem 0.45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 0.35rem;
}

.word-pill.is-pangram {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.word-pill.is-pangram .word-text {
  color: #047857;
}

.word-pill.is-pangram .word-points {
  background: #d1fae5;
  color: #047857;
  font-weight: 800;
}

.word-pill.is-perfect {
  background: #faf5ff;
  border-color: #d8b4fe;
}

.word-pill.is-perfect .word-text {
  color: #6b21a8;
}

.word-pill.is-perfect .word-points {
  background: #f3e8ff;
  color: #6b21a8;
  font-weight: 800;
}

.star-icon {
  color: #f59e0b;
  margin-right: 0.25rem;
}

.crown-icon {
  color: #9333ea;
  margin-right: 0.25rem;
}

/* --------------------------------------------------------------------------
   Editorial Content Sections
   -------------------------------------------------------------------------- */
.content-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.content-section h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.content-section h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.content-section p {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

/* Comparison Illustration Cards */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.75rem 0;
}

@media (max-width: 700px) {
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

.compare-card {
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 2px solid;
}

.compare-card.standard {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.compare-card.perfect {
  background: #faf5ff;
  border-color: #e9d5ff;
}

.compare-title {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.compare-card.standard .compare-title { color: #047857; }
.compare-card.perfect .compare-title { color: #6b21a8; }

.compare-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.compare-card.standard .compare-badge { background: #d1fae5; color: #065f46; }
.compare-card.perfect .compare-badge { background: #f3e8ff; color: #581c87; }

.compare-example {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  background: #ffffff;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0.5rem 0;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Timeline Visualization */
.timeline-wrap {
  position: relative;
  padding: 1.5rem 0 1.5rem 2rem;
  margin: 1.5rem 0;
  border-left: 3px solid var(--primary-emerald);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -2.7rem;
  top: 0;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border: 4px solid var(--primary-emerald);
  border-radius: var(--radius-full);
}

.timeline-year {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary-emerald-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0.25rem 0 0.4rem;
}

.timeline-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* FAQ Accordion Styling */
.faq-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.faq-item {
  background: var(--bg-body);
  border: 1px solid var(--border-emerald);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.faq-question {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.faq-answer {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Strategic Companion Bridge Section */
.companion-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border: 2px solid var(--border-emerald);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}

.companion-card h3 {
  color: #064e3b;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.companion-card p {
  color: #1e293b;
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.editorial-brand-link {
  color: #047857;
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.15s ease;
}

.editorial-brand-link:hover {
  color: #064e3b;
}

.companion-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-emerald);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.companion-btn:hover {
  background: var(--primary-emerald-dark);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-header);
  border-top: 1px solid #065f46;
  padding: 2.5rem 1.25rem;
  margin-top: auto;
  font-size: 0.88rem;
  color: #a7f3d0;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: #d1fae5;
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: #ffffff;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #022c22;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}
