@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700;800&display=swap');

/* ---- Two-Level Navigation ---- */
#tool-nav { background: #0b0d13; }

.nav-categories {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 16px 0;
  position: relative;
}
.nav-home {
  padding: 7px 18px 9px; border-radius: 10px 10px 0 0; font-size: 0.82rem; font-weight: 700;
  color: #888; text-decoration: none; transition: all 0.15s; margin-right: 8px;
  border: 1px solid transparent; border-bottom: none;
  margin-bottom: -1px; position: relative;
}
.nav-home:hover { color: #ccc; }
.nav-cat {
  padding: 7px 18px 9px; border-radius: 10px 10px 0 0; font-size: 0.82rem; font-weight: 700;
  color: #888; text-decoration: none; transition: all 0.15s;
  border: 1px solid transparent; border-bottom: none;
  margin-bottom: -1px; position: relative;
}
.nav-cat:hover { color: #ccc; }
.nav-cat.active { color: #fff; background: #0f1117; border-color: #2a2d3e; border-bottom: none; }

.nav-tools {
  display: none;
}
.nav-tool {
  padding: 5px 14px; border-radius: 10px; font-size: 0.76rem; font-weight: 600;
  color: #666; text-decoration: none; transition: all 0.15s; border: 1px solid transparent;
}
.nav-tool:hover { color: #ccc; background: #1a1d27; }
.nav-tool.active { color: #fff; background: #1e2030; border-color: #2a2d3a; }

/* ---- Site Header (compact for tool pages) ---- */
.site-header { background: #0a0c14; padding: 10px 20px; text-align: center; border-bottom: 2px solid #1a1d2e; }
.site-header a { color: #fff; text-decoration: none; }
.site-header a:hover { color: #ccc; }
.site-title { font-size: 1rem; font-weight: 800; color: #fff; letter-spacing: 0.03em; }
.site-subtitle { font-size: 0.75rem; color: #7a8aaa; line-height: 1.5; max-width: 640px; margin: 4px auto 0; }

/* ---- Tool Page Layout ---- */
.tool-page {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 1rem; max-width: 960px; margin: 0 auto; min-height: calc(100vh - 200px);
}
.tool-page h1 {
  font-size: 1.4rem; font-weight: 600; letter-spacing: 0.05em;
  color: #fff; margin-bottom: 1rem; text-transform: uppercase;
}

/* ---- Page Title Row ---- */
.page-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  padding: 6px 0;
}
.page-subtitle {
  text-align: center;
  color: #888;
  font-size: 0.82rem;
  margin: 0 auto 1rem;
  max-width: 800px;
  line-height: 1.4;
  white-space: nowrap;
}

/* "Select tool" label */
.page-menu-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.page-menu-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 2px;
}

/* Title is the dropdown trigger */
.page-menu-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 0 0 4px 0; border: none; background: none;
  font-size: 1.4rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: #fff; cursor: pointer;
  transition: color 0.15s;
  position: relative;
}
.page-menu-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 28px;
  height: 2px;
  background: #7cb8ff;
  border-radius: 10px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}
.page-menu-btn:hover::after { transform: scaleX(1); }
.page-menu-btn:hover { color: #ccc; }
.page-menu-btn::after { background: #888; }
.page-menu-btn .page-menu-chevron {
  width: 18px; height: 18px;
  color: #666;
  transition: transform 0.2s, color 0.15s;
  flex-shrink: 0;
}
.page-menu-btn:hover .page-menu-chevron { color: #ccc; }
.page-menu-btn.open .page-menu-chevron { transform: rotate(180deg); color: #ccc; }

/* Dropdown */
.page-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #13151f;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  padding: 6px;
  min-width: 200px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.page-menu-dropdown.open { display: block; }
.page-menu-item {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  color: #aaa;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.12s;
  white-space: nowrap;
}
.page-menu-item:hover { background: #1a1d27; color: #fff; }
.page-menu-item.current { color: #ccc; background: #2a2d3a; pointer-events: none; }

/* ---- Reset & Body ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Ensure form elements inherit Roboto */
select, button, input, textarea, option, optgroup {
  font-family: inherit;
}

/* ---- Global Toolbar ---- */
.global-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 7px 16px;
  background: #0b0d13;
  border-bottom: 2px solid #2a2d3a;
  flex-wrap: wrap;
}
.gt-group { display: flex; align-items: center; gap: 5px; }
.gt-label { font-size: 0.62rem; color: #555; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; white-space: nowrap; }
.gt-select-wrap { position: relative; }
.gt-select {
  padding: 8px 32px 8px 12px; border: 1.5px solid #2a2d3a; border-radius: 10px;
  background: #1a1d27; color: #ccc; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; appearance: none; -webkit-appearance: none; outline: none;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.gt-select:hover, .gt-select:focus { border-color: #3a3d4a; color: #fff; }
.gt-bpm {
  width: 52px; padding: 5px 4px; border: 1.5px solid #2a2d3a; border-radius: 10px;
  background: #13151f; color: #fff; font-size: 0.82rem; font-weight: 700;
  text-align: center; outline: none;
}
.gt-bpm:focus { border-color: #3a3d4a; }
/* ---- Shared Controls ---- */
.cof-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.cof-pill-group { display: flex; gap: 0; border-radius: 10px; overflow: hidden; border: 1.5px solid #2a2d3a; }
.cof-pill { padding: 6px 14px; font-size: 0.78rem; background: #13151f; color: #888; border: none; cursor: pointer; transition: all 0.15s; font-family: inherit; font-weight: 600; }

.cof-pill.active { background: #2a2d3a; color: #ccc; }

/* Global action button */
.btn {
  padding: 7px 14px;
  border: 1.5px solid #2a2d3a;
  border-radius: 10px;
  background: #1a1d27;
  color: #ccc;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  white-space: nowrap;
}
.btn:hover { background: #252836; border-color: #555; color: #fff; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ---- Tab Panels ---- */
.tab-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  padding: 1rem;
}
.tab-panel.active {
  display: flex;
}

/* ---- Toolbar Icon Button (shared across all tools) ---- */
.lib-dice-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--icon-btn-size, 35px); height: var(--icon-btn-size, 35px);
  border-radius: 10px; border: 1.5px solid #2a2d3a; background: #13151f; color: #888;
  cursor: pointer; transition: all 0.2s; flex-shrink: 0; box-sizing: border-box;
}
.lib-dice-btn:hover { background: #1e2030; border-color: #3a3d4a; color: #ccc; }
.lib-dice-btn.active { background: #1e2030; border-color: #3a3d4a; color: #ccc; }
.lib-dice-btn svg { width: 16px; height: 16px; }

/* ---- Glossary Reference Link (shared across pages) ---- */
.lib-glossary-ref { margin-top: 12px; padding-top: 12px; border-top: 2px solid #2a2d3a; }
.lib-glossary-ref a {
  font-size: 0.75rem; color: #7cb8ff; text-decoration: none;
  font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.lib-glossary-ref a:hover { color: #a0d0ff; text-decoration: underline; }

/* ---- Subtle Product Links ---- */
.product-link { margin-top: 8px; }
.product-link a {
  font-size: 0.72rem; color: #8a8a9a; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.product-link a:hover { color: #7cb8ff; text-decoration: underline; }


/* Responsive */
@media (max-width: 600px) {
  .page-subtitle { white-space: normal; }
  .global-toolbar { gap: 8px; padding: 5px 10px; }
  .gt-group { gap: 3px; }
  .gt-select { font-size: 0.75rem; padding: 6px 28px 6px 10px; }
  .gt-bpm { width: 46px; font-size: 0.76rem; }
  .nav-categories { padding: 6px 10px 0; gap: 1px; }
  .nav-cat { padding: 5px 12px 7px; font-size: 0.74rem; border-radius: 10px 10px 0 0; }
  .nav-home { padding: 5px 12px 7px; font-size: 0.74rem; border-radius: 10px 10px 0 0; }
  .nav-tools { padding: 4px 10px; gap: 1px; }
  .nav-tool { padding: 4px 10px; font-size: 0.7rem; }
  .tool-page { padding: 1rem 0.5rem; }
  .tool-page h1 { font-size: 1.1rem; }
  .page-menu-btn { font-size: 1rem; }
  .cof-controls { gap: 4px; }
  .cof-pill { padding: 5px 10px; font-size: 0.72rem; }
  .site-header { padding: 8px 12px; }
  .site-title { font-size: 0.88rem; }
  .lib-dice-btn svg { width: 14px; height: 14px; }
}
@media (max-width: 400px) {
  .gt-select { font-size: 0.7rem; padding: 5px 24px 5px 8px; }
  .cof-pill { padding: 4px 8px; font-size: 0.68rem; }
  .nav-cat, .nav-home { padding: 4px 8px 6px; font-size: 0.68rem; }
  .page-menu-btn { font-size: 0.88rem; gap: 6px; }
  .lib-dice-btn svg { width: 12px; height: 12px; }
}

/* ---- Shared A-Z Letter Bar ---- */
.lib-glossary-letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; justify-content: center; }
.lib-glossary-letter { width: 28px; height: 28px; border-radius: 0; font-size: 0.72rem; font-weight: 700; background: none; color: #888; border: none; cursor: pointer; transition: color 0.15s; display: flex; align-items: center; justify-content: center; font-family: inherit; padding: 0; }
.lib-glossary-letter:hover:not(.disabled) { color: #bbb; }
.lib-glossary-letter.active { color: #ccc; }
