.llm-token-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
  background: #faf8f5;
  min-height: 100vh;
}

.llm-token-tool {
  max-width: 1200px;
  width: 100%;
  padding: 0;
  background: #faf8f5;
}

body:has(.llm-token-tool) {
  background: #faf8f5 !important;
}

/* Header */
.llm-token-tool .tool-header {
  text-align: center;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #292524 0%, #44403c 100%);
  border-radius: 12px;
  color: #faf8f5;
  box-shadow: 0 2px 12px rgba(41, 37, 36, 0.15);
  position: relative;
  overflow: hidden;
}

.llm-token-tool .tool-intro {
  text-align: center;
  color: #57534e;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 auto 24px;
  padding: 0 16px;
}

@media (min-width: 1024px) {
  .llm-token-tool .tool-intro {
    font-size: 1rem;
  }
}

.llm-token-tool .tool-intro strong {
  color: #44403c;
}

.llm-token-tool .tool-title {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}

.llm-token-tool .tool-title i {
  font-size: 1.2rem;
  color: #fef3c7;
}

.llm-token-tool .tool-subtitle {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.75;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  color: #d6d3d1;
}

/* Counter Main Section */
.counter-main {
  margin-bottom: 32px;
}

.input-section {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

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

.input-row-header label {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
  margin: 0;
}

.input-row-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  padding: 10px 12px;
  background: #f5f0e8;
  border: 2px solid #e7e0d5;
  border-radius: 8px;
  color: #78716c;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.btn-icon:hover {
  background: #e7e0d5;
  color: #44403c;
}

.token-textarea {
  width: 100%;
  padding: 16px 18px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  border: 2px solid #e7e0d5;
  border-radius: 8px;
  background: #ffffff;
  color: #292524;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 180px;
  max-height: 480px;
  overflow-y: auto;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  cursor: text;
}

.token-textarea:focus {
  outline: none;
  border-color: #a8a29e;
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.15);
}

.token-textarea[contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: #a8a29e;
  pointer-events: none;
  display: block;
}

/* Model Selector */
.model-selector {
  margin-top: 20px;
}

.model-selector > label {
  display: block;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.model-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.model-btn {
  padding: 10px 14px;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f5f0e8;
  border: 2px solid #e7e0d5;
  border-radius: 8px;
  color: #57534e;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.model-btn:hover {
  background: #e7e0d5;
  border-color: #d6cfc4;
}

.model-btn.active {
  background: #292524;
  border-color: #292524;
  color: #ffffff;
}

.model-btn i {
  font-size: 0.95rem;
}

.model-btn .model-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #ffffff;
  color: #6b7280;
}

.model-btn .model-tag.exact {
  background: #dcfce7;
  color: #166534;
}

.model-btn .model-tag.approx {
  background: #fef3c7;
  color: #92400e;
}

.model-btn.active .model-tag.exact {
  background: rgba(220, 252, 231, 0.95);
}

.model-btn.active .model-tag.approx {
  background: rgba(254, 243, 199, 0.95);
}

/* Tokenizer status */
.tokenizer-status {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f5f0e8;
  border: 1px solid #e7e0d5;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #78716c;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tokenizer-status.ready {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.tokenizer-status.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.tokenizer-status.hidden {
  display: none;
}

.tokenizer-status i {
  font-size: 0.95rem;
}

/* Stats Section */
.stats-section {
  margin-bottom: 20px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .stats-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 10px;
  padding: 18px 16px;
  text-align: center;
}

.stat-card.primary {
  background: linear-gradient(135deg, #292524 0%, #44403c 100%);
  border-color: #292524;
  color: #ffffff;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #78716c;
  margin-bottom: 6px;
}

.stat-card.primary .stat-label {
  color: #a8a29e;
}

.stat-value {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #292524;
  line-height: 1.1;
  word-break: break-word;
}

.stat-card.primary .stat-value {
  color: #ffffff;
}

.stat-meta {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.7rem;
  color: #a8a29e;
  margin-top: 6px;
}

.stat-card.primary .stat-meta {
  color: #d6d3d1;
}

.stats-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-secondary {
  padding: 10px 18px;
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f5f0e8;
  color: #44403c;
  border: 2px solid #e7e0d5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: #e7e0d5;
  border-color: #d6cfc4;
}

.copy-feedback {
  font-size: 0.85rem;
  font-weight: 600;
  color: #166534;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 6px;
  transition: opacity 0.2s ease;
}

.copy-feedback.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Visualization */
.visualization-section {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.visualization-section.hidden {
  display: none;
}

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

.viz-header h3 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.viz-header h3 i {
  color: #78716c;
}

.viz-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 999px;
}

.viz-mode-badge.exact {
  background: #dcfce7;
  color: #166534;
}

.viz-mode-badge.approx {
  background: #fef3c7;
  color: #92400e;
}

.viz-help {
  font-size: 0.85rem;
  color: #78716c;
  margin: 0 0 14px 0;
}

.viz-content {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  line-height: 1.9;
  background: #fdfaf3;
  border: 1px dashed #e7e0d5;
  border-radius: 8px;
  padding: 14px 16px;
  max-height: 360px;
  overflow-y: auto;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Token chips: 8 alternating, calm pastel palette */
.tok {
  display: inline;
  padding: 1px 1px;
  border-radius: 3px;
  margin: 0;
  white-space: pre-wrap;
  transition: filter 0.15s ease;
}

.tok:hover {
  filter: brightness(0.92);
  cursor: help;
}

.tok-0 { background: #fef3c7; color: #78350f; }
.tok-1 { background: #fed7aa; color: #7c2d12; }
.tok-2 { background: #fbcfe8; color: #831843; }
.tok-3 { background: #e9d5ff; color: #581c87; }
.tok-4 { background: #d9f99d; color: #365314; }
.tok-5 { background: #bbf7d0; color: #14532d; }
.tok-6 { background: #bae6fd; color: #075985; }
.tok-7 { background: #e7e0d5; color: #44403c; }

.tok.tok-newline {
  background: transparent;
  color: #c7c2b9;
}

.tok.tok-newline::before {
  content: "↵";
  color: #c7c2b9;
}

.viz-empty {
  color: #a8a29e;
  font-style: italic;
}

/* Examples Section */
.examples-section {
  margin-bottom: 32px;
}

.examples-section h3 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.examples-section h3 i {
  color: #f59e0b;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .examples-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.example-btn {
  padding: 16px;
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.example-btn:hover {
  border-color: #78716c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(120, 113, 108, 0.15);
}

.example-platform {
  font-size: 0.75rem;
  font-weight: 600;
  color: #57534e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.example-platform i {
  font-size: 0.9rem;
  color: #78716c;
}

.example-desc {
  font-size: 0.8rem;
  color: #57534e;
}

.related-tool-link {
  text-decoration: none;
  color: inherit;
}

.related-tool-link:hover,
.related-tool-link:focus {
  text-decoration: none;
  color: inherit;
}

.example-btn code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.75rem;
  background: #292524;
  color: #fef3c7;
  padding: 4px 8px;
  border-radius: 4px;
  display: block;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reference Section */
.reference-section {
  margin-bottom: 32px;
}

.reference-section h3 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reference-section h3 i {
  color: #78716c;
}

.epoch-reference {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}

.epoch-reference h4 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 16px 0;
}

.ratio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 580px;
}

.ratio-table th,
.ratio-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e7e0d5;
}

.ratio-table th {
  font-weight: 600;
  color: #57534e;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ratio-table td {
  color: #374151;
}

.ratio-table td i {
  margin-right: 8px;
  width: 16px;
  color: #78716c;
}

.ratio-table td code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.82rem;
  background: #292524;
  color: #fef3c7;
  padding: 4px 8px;
  border-radius: 4px;
}

.ratio-table tr:last-child td {
  border-bottom: none;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge.exact {
  background: #dcfce7;
  color: #166534;
}

.badge.approx {
  background: #fef3c7;
  color: #92400e;
}

/* Syntax Guide */
.syntax-guide-section {
  margin-bottom: 32px;
}

.syntax-guide-section > h3 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.syntax-guide-section > h3 i.fa-graduation-cap {
  color: #7c3aed;
}

.syntax-guide-content {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 12px;
  overflow: hidden;
}

.guide-article {
  padding: 24px 28px;
  border-bottom: 1px solid #e7e0d5;
}

.guide-article:last-child {
  border-bottom: none;
}

.guide-article h2 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #292524;
  margin: 0 0 12px 0;
}

.guide-article p {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: #57534e;
  margin: 0 0 12px 0;
  line-height: 1.7;
}

.guide-article p:last-child {
  margin-bottom: 0;
}

.guide-article ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-article ul li {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: #57534e;
  line-height: 1.7;
  padding: 8px 0 8px 20px;
  position: relative;
  border-bottom: 1px solid #f5f0e8;
}

.guide-article ul li:last-child {
  border-bottom: none;
}

.guide-article ul li::before {
  content: "•";
  color: #f59e0b;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.guide-article code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  background: #292524;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #fef3c7;
}

/* FAQ */
.faq-section {
  margin-bottom: 32px;
  padding: 30px;
  background: #f5f0e8;
  border-radius: 16px;
  border: 2px solid #e7e0d5;
}

.faq-section h2 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.faq-section h2 i {
  color: #78716c;
}

.faq-item {
  background: #fffdf9;
  border: 2px solid #e7e0d5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}

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

.faq-item h3 {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #292524;
  margin: 0 0 10px 0;
}

.faq-item p {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: #78716c;
  margin: 0;
  line-height: 1.6;
}

.faq-item code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  background: #292524;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #fef3c7;
}

/* Responsive */
@media (max-width: 768px) {
  .llm-token-page-wrapper {
    padding: 15px 12px 30px;
  }

  .llm-token-tool .tool-header {
    padding: 14px 16px;
    border-radius: 10px;
  }

  .llm-token-tool .tool-title {
    font-size: 1.2rem;
    flex-direction: column;
    gap: 6px;
  }

  .input-section {
    padding: 20px 16px;
  }

  .model-buttons {
    flex-direction: column;
  }

  .model-btn {
    justify-content: flex-start;
  }

  .stats-cards {
    grid-template-columns: 1fr 1fr;
  }

  .examples-grid {
    grid-template-columns: 1fr;
  }

  .ratio-table {
    font-size: 0.82rem;
  }
}
