:root {
  /* Light Mode Variables (Default) */
  --color-primary: #3b82f6; 
  --color-primary-dark: #2563eb;
  --color-background: #ffffff; /* Clean white */
  --color-surface: #e8f0fe; /* Light gray surface */
  --color-text: #3a3e45; /* Dark gray for text */
  --color-text-light: #5f6368; /* Medium gray */
  --color-border: #e8f0fe; /* Very light blueish gray */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  
  --header-height: 64px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --color-primary: #8ab4f8; 
  --color-primary-dark: #aecbfa;
  --color-background: #202124; /* Dark gray bg */
  --color-surface: #292a2d; /* Slightly lighter surface */
  --color-text: #e8eaed; /* Light gray text */
  --color-text-light: #9aa0a6; /* Medium light gray */
  --color-border: #3c4043; /* Dark border */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul { list-style: none; }

/* Layout */
.container {
  max-width: 1280px;
  margin: 2% auto;
  padding: 0 1.5rem;
}

/* Header Grid Layout */
header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-left, .header-right {
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-center {
  flex: 1;
  text-align: center;
  display: flex;
  justify-content: center;
}

/* Stylish Logo */
.logo-container {
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  text-decoration: none !important;
}

.logo-box {
  background-color: var(--color-primary); /* Use primary color */
  color: #ffffff;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  margin-right: 4px;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.logo-text {
  color: var(--color-text);
  font-weight: 800;
  font-size: 1.7rem;
  margin-left: 2%;
}

/* Header Buttons */
#mobile-menu-btn, #theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#mobile-menu-btn:hover, #theme-toggle:hover {
  background: rgba(0,0,0,0.05);
}

[data-theme="dark"] #mobile-menu-btn:hover, 
[data-theme="dark"] #theme-toggle:hover {
  background: rgba(255,255,255,0.1);
}

/* Mobile Nav Drawer */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-nav {
  position: fixed;
  top: 0;
  left: -300px;
  bottom: 0;
  width: 280px;
  background: var(--color-surface);
  z-index: 200;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.mobile-nav.active {
  transform: translateX(300px);
}

.mobile-nav-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--color-border);
}

.nav-title {
  font-weight: 700;
  font-size: 1.1rem;
}

#close-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
}

.mobile-nav-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.nav-main-links li {
  margin-bottom: 0.5rem;
}

.nav-main-links a {
  display: block;
  padding: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  border-radius: var(--radius-sm);
}

.nav-main-links a:hover {
  background: rgba(0,0,0,0.05);
  text-decoration: none;
}

.nav-divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}

.nav-section h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.nav-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.nav-tags a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.85rem;
  background: var(--color-background);
}

.nav-tags a:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  text-decoration: none;
}

/* Breadcrumbs Below Header */
.breadcrumb-container {
  padding: 0.75rem 0;
  margin: .5rem 2rem;
}

.breadcrumb {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin: 0;
}

.breadcrumb a {
  color: var(--color-text-light);
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

/* Hero Section */
.hero-section {
  background: var(--color-surface);
  padding: 3rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.hero-title {
  font-size: 2.5rem;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.hero-subtitle {
  color: var(--color-text-light);
  margin-bottom: 2.5rem;
  font-size: 1.1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Search Form - Prominent & Modern */
.wordfinder {
    background: var(--color-surface);
    padding: 15px;
    border: none;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 10px;
}

.wordfinder form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  align-items: center;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper input {
  padding: 0.8rem 1rem;
  padding-right: 0.5rem;
  border: 1px solid #dfe1e5; /* Google-like border */
  border-radius: 7px; /* More rounded like Google */
  font-size: 1rem;
  background: #ffffff; 
  color: var(--color-text);
  width: 100%;
  transition: all 0.2s;
}

[data-theme="dark"] .input-wrapper input {
  background: #303134; 
  border-color: #5f6368;
  color: #e8eaed;
  box-shadow: none;
}

.input-wrapper input:focus {
  outline: none;
  box-shadow: 0 1px 6px rgba(32,33,36,0.28), 0 0 0 1px #dfe1e5;
  border-color: transparent;
}

[data-theme="dark"] .input-wrapper input:focus {
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
  border-color: var(--color-primary);
}

.clear-input {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  padding: 4px;
  line-height: 1;
  z-index: 10;
}

.clear-input:hover {
  color: var(--color-text);
}

.wordfinder button {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500; /* Less bold */
  cursor: pointer;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
  height: auto;
  min-height: 48px;
  transition: background-color 0.2s;
  width: 100%;
  max-width: 300px; /* Limit width */
  grid-column: 1 / -1; /* Span all columns */
  margin: 1rem auto 0; /* Center it */
}

.wordfinder button:hover {
  background-color: var(--color-primary-dark);
}

/* Main Content Layout */
.main-layout {
  display: block; 
  padding-bottom: 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Sections */
.section-card {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  color: var(--color-text);
  font-weight: 700; /* Less bold */
}

.text-center { text-align: center; }

h2 {
  font-size: 1.3rem;
  font-weight: 500; /* Less bold */
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  text-align: center; /* Centered H2 */
}

p { margin-bottom: 1.2rem; }

/* Total Count - Subtle */
.total-count {
  font-size: 0.85rem;
  color: var(--color-text-light);
  text-align: center;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

/* Sort Dropdown Container */
.sort-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.sort-select {
  padding: 0.4rem 2rem 0.4rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-background);
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
}

.sort-select:focus {
  outline: none;
  border-color: var(--color-primary);
}
.word-group-container {
    background: var(--color-surface);
    padding: 2%;
    border-radius: 10px;
}
/* Word List */
.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 2rem;
  background: var(--color-surface);
  padding: 2%;
  border-radius: 10px;  
}

.word-item {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.5rem;
  text-align: center;
  font-weight: 400; /* Less bold */
  color: var(--color-text);
  font-size: 1.1rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  box-shadow: var(--shadow-sm);
}

.word-item:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.word-points {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.5); /* Much lighter */
  line-height: 1;
}

[data-theme="dark"] .word-points {
    color: rgba(255,255,255,0.3);
}

/* View All Link - Subtle & SEO Friendly */
.view-all-link {
  display: inline-block;
  margin-left: 1rem;
  font-size: 0.75rem; /* Smaller */
  color: var(--color-text-light); /* Less prominent */
  font-weight: 400;
  text-decoration: underline;
}

.view-all-link:hover {
  color: var(--color-primary);
}

/* Load More Button */
.load-more-btn {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 2.5rem auto 0;
  padding: 0.9rem;
  background: var(--color-surface);
  border: 0px solid var(--color-border);
  border-radius: 30px;
  color: var(--color-text);
  font-weight: 500; /* Less bold */
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.load-more-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

/* Footer */
footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 3rem 0;
  text-align: center;
  margin-top: auto;
}

.footer-links a {
  margin: 0 0.8rem;
  color: var(--color-text-light);
  font-size: 0.95rem;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* Tooltip & Back to Top */
.copy-tooltip {
  position: absolute;
  background: var(--color-text);
  color: var(--color-background);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s;
}

.copy-tooltip.show { opacity: 1; transform: translateY(0); }

.back-to-top {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 50px;
  height: 50px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
  z-index: 90;
  font-size: 1.2rem;
}

.back-to-top.visible { opacity: 1; visibility: visible; }

/* Responsive adjustments */
@media (max-width: 600px) {
  .hero-title { font-size: 1.8rem; }
  .section-card { padding: 1rem; }
  .container { padding: 0 0.5rem; } /* Minimal side padding */
  .hero-section { padding: 1.5rem 0.5rem; }
  
  /* Stack inputs on mobile */
  .wordfinder form { 
    grid-template-columns: 1fr; 
    gap: 0.75rem;
  }
  
  .input-wrapper input {
    padding: 0.7rem 0.8rem; /* Slightly smaller padding */
  }

  /* Grid Layout for Words on Mobile */
  .word-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Columns */
    gap: 0.5rem;
    justify-content: stretch;
    padding: 0.5rem; /* Reduce padding */
  }

  .word-item {
    width: 100%; /* Full width of grid cell */
    padding: 0.5rem 0.2rem; /* Compact padding */
    font-size: 0.95rem; /* Slightly smaller font */
    min-height: 40px; /* Smaller height */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0; /* Remove any margins */
  }
  
  .word-group-container {
      padding: 0.5rem; /* Reduce container padding */
  }

  /* Adjust Sort Container */
  .sort-container {
      justify-content: space-between;
      margin-bottom: 0.5rem;
  }
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.feature-card h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.feature-card p {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 0;
}
/ *   P W A   I n s t a l l   B u t t o n   * / 
 
 . i n s t a l l - p w a - b t n   { 
 
         p o s i t i o n :   f i x e d ; 
 
         b o t t o m :   2 0 p x ; 
 
         l e f t :   5 0 % ; 
 
         t r a n s f o r m :   t r a n s l a t e X ( - 5 0 % )   t r a n s l a t e Y ( 1 0 0 p x ) ; 
 
         b a c k g r o u n d :   v a r ( - - c o l o r - s u r f a c e ) ; 
 
         b o r d e r :   1 p x   s o l i d   v a r ( - - c o l o r - b o r d e r ) ; 
 
         b o r d e r - r a d i u s :   1 2 p x ; 
 
         p a d d i n g :   1 2 p x ; 
 
         b o x - s h a d o w :   0   4 p x   1 2 p x   r g b a ( 0 , 0 , 0 , 0 . 1 5 ) ; 
 
         z - i n d e x :   1 0 0 0 ; 
 
         w i d t h :   9 0 % ; 
 
         m a x - w i d t h :   4 0 0 p x ; 
 
         t r a n s i t i o n :   t r a n s f o r m   0 . 3 s   c u b i c - b e z i e r ( 0 . 1 7 5 ,   0 . 8 8 5 ,   0 . 3 2 ,   1 . 2 7 5 ) ; 
 
 } 
 
 
 
 . i n s t a l l - p w a - b t n . v i s i b l e   { 
 
         t r a n s f o r m :   t r a n s l a t e X ( - 5 0 % )   t r a n s l a t e Y ( 0 ) ; 
 
 } 
 
 
 
 . p w a - c o n t e n t   { 
 
         d i s p l a y :   f l e x ; 
 
         a l i g n - i t e m s :   c e n t e r ; 
 
         g a p :   1 2 p x ; 
 
 } 
 
 
 
 . p w a - i c o n   { 
 
         f o n t - s i z e :   2 4 p x ; 
 
 } 
 
 
 
 . p w a - t e x t   { 
 
         f l e x :   1 ; 
 
         d i s p l a y :   f l e x ; 
 
         f l e x - d i r e c t i o n :   c o l u m n ; 
 
         f o n t - s i z e :   0 . 9 r e m ; 
 
 } 
 
 
 
 . p w a - t e x t   s t r o n g   { 
 
         c o l o r :   v a r ( - - c o l o r - t e x t ) ; 
 
 } 
 
 
 
 . p w a - t e x t   s p a n   { 
 
         c o l o r :   v a r ( - - c o l o r - t e x t - l i g h t ) ; 
 
         f o n t - s i z e :   0 . 8 r e m ; 
 
 } 
 
 
 
 . p w a - a c t i o n   { 
 
         b a c k g r o u n d :   v a r ( - - c o l o r - p r i m a r y ) ; 
 
         c o l o r :   w h i t e ; 
 
         b o r d e r :   n o n e ; 
 
         p a d d i n g :   8 p x   1 6 p x ; 
 
         b o r d e r - r a d i u s :   2 0 p x ; 
 
         f o n t - w e i g h t :   6 0 0 ; 
 
         c u r s o r :   p o i n t e r ; 
 
         f o n t - s i z e :   0 . 9 r e m ; 
 
 } 
 
 
 
 . p w a - c l o s e   { 
 
         b a c k g r o u n d :   n o n e ; 
 
         b o r d e r :   n o n e ; 
 
         f o n t - s i z e :   1 . 2 r e m ; 
 
         c o l o r :   v a r ( - - c o l o r - t e x t - l i g h t ) ; 
 
         c u r s o r :   p o i n t e r ; 
 
         p a d d i n g :   0   4 p x ; 
 
 } 
 
 