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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text, #333);
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--bg, #f5f5f5);
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface, #fff);
  border-radius: 6px;
  box-shadow: 0 1px 3px var(--shadow, rgba(0,0,0,0.08));
}

.page-nav a, .cell.name a, .attr-table a {
  color: var(--link, #2980b9);
  text-decoration: none;
  font-size: max(16px, 0.9rem);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--link-border, #d0dce8);
  white-space: nowrap;
}

.page-nav a:hover, .cell.name a:hover, .attr-table a:hover {
  background: var(--hover, #eaf2fb);
  border-color: var(--accent, #3498db);
}

h1 {
  color: var(--text, #2c3e50);
  margin-bottom: 1rem;
  font-size: 2.5rem;
}

h2 {
  color: var(--text, #34495e);
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent, #3498db);
}

h3 {
  color: var(--text, #555);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

code {
  background: var(--code-bg, #f8f8f8);
  border: 1px solid var(--border, #ddd);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font-family: 'Courier New', monospace;
  font-size: max(16px, 0.9em);
  color: var(--text, inherit);
}

pre {
  background: var(--pre-bg, #2c3e50);
  color: var(--pre-fg, #ecf0f1);
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

.usage-section {
  background: var(--surface, #fff);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow, rgba(0,0,0,0.1));
}

.playground {
  background: var(--surface, #fff);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow, rgba(0,0,0,0.1));
  margin-top: 2rem;
}

.playground textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--border, #ddd);
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  font-size: max(16px, 0.9rem);
  resize: vertical;
  margin-bottom: 1rem;
  background: var(--surface, #fff);
  color: var(--text, #000);
}

.playground textarea:focus {
  outline: none;
  border-color: var(--accent, #3498db);
}

.button {
  background: var(--accent, #3498db);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.button:hover {
  background: var(--accent-dark, #2980b9);
}

.button:active {
  transform: translateY(1px);
}

.button:focus {
  outline: 2px solid var(--accent, #3498db);
  outline-offset: 2px;
}

.example-btn {
  background: #95a5a6;
  padding: 0.5rem 1rem;
  font-size: max(16px, 0.9rem);
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.example-btn:hover {
  background: #7f8c8d;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--scrim, rgba(0,0,0,0.5));
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface, #fff);
  color: var(--text, #000);
  padding: 2rem;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  position: relative;
  box-shadow: var(--shadow-modal, 0 10px 25px rgba(0,0,0,0.3));
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--error, #e74c3c);
  color: #fff;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.modal-close:hover {
  background: #c0392b;
}

.modal-close:focus {
  outline: 2px solid var(--error, #e74c3c);
  outline-offset: 2px;
}

ul {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

.note {
  background: var(--note-bg, #fff3cd);
  border-left: 4px solid var(--note-border, #ffc107);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
  color: var(--text, inherit);
}

.examples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.result-table th,
.result-table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--border, #dee2e6);
}

.result-table th {
  background: var(--th-bg, #f8f9fa);
  font-weight: 600;
}

.result-table tr:nth-child(even) {
  background: var(--hover, #f8f9fa);
}

.result-table td {
  word-break: break-all;
}
