/* Shared toolkit components: language switcher + history drawer.
   Relies on the CSS custom properties each tool's stylesheet already defines
   (--surface, --surface-2, --line, --ink, --muted, --faint, --accent,
    --accent-soft, --shadow, --mono, --sans). */

.tk-lang, .tk-hist { position: relative; display: inline-flex; }

.tk-lang-btn { min-width: 44px; gap: 4px; font-family: var(--sans); font-weight: 700; font-size: 12.5px; }
.tk-lang-btn .tk-lang-code { letter-spacing: .02em; }

.tk-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; min-width: 180px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.tk-lang.open .tk-menu, .tk-hist.open .tk-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.tk-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink);
  padding: 9px 12px; border-radius: 8px; text-align: left;
}
.tk-menu-item:hover { background: var(--surface-2); }
.tk-menu-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.tk-flag { font-size: 17px; line-height: 1; }

/* History drawer */
.tk-hist-panel { min-width: 300px; max-width: min(360px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.tk-hist-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.tk-hist-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.tk-hist-clear {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 7px; cursor: pointer;
}
.tk-hist-clear:hover { border-color: var(--accent); color: var(--accent); }
.tk-hist-list { max-height: min(360px, 60vh); overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.tk-hist-item {
  display: flex; width: 100%; appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; text-align: left;
}
.tk-hist-item:hover { background: var(--surface-2); }
.tk-hist-text {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
}
.tk-hist-empty { padding: 22px 14px; text-align: center; color: var(--faint); font-size: 13px; }

@media (max-width: 460px) {
  .tk-menu { position: fixed; top: 60px; right: 10px; left: 10px; min-width: 0; }
  .tk-hist-panel { max-width: none; }
}
