/* Layout */
.text-analyzer {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* Left column (textarea) */
.text-analyzer .editor {
  flex: 1 1 0;
  min-width: 0; /* prevents overflow with long lines */
}

/* Match your existing class name but give it nicer defaults */
.form-controls {
  width: 100%;
  padding: 14px 16px;
  line-height: 1.5;
  font-size: 16px;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  resize: vertical;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02) inset;
}

/* Right column (panel) */
.metrics-panel {
  flex: 0 0 280px; /* panel width */
  position: sticky; /* stays visible while scrolling the textarea */
  top: 16px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Header bar like the screenshot’s soft tint */
.metrics-header {
  background: #fdecc8; /* soft warm tint */
  padding: 12px 16px;
  font-weight: 600;
}

/* Metric rows */
.metrics-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.metrics-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #f5f5f5;
  font-size: 14px;
}

.metrics-list li:first-child {
  border-top: none;
}
.metrics-list span {
  color: #555;
}
.metrics-list strong {
  font-weight: 600;
}

/* Small screens: stack */
@media (max-width: 900px) {
  .text-analyzer {
    flex-direction: column;
  }
  .metrics-panel {
    position: static;
    width: 100%;
    flex-basis: auto;
  }
}

/* Utility: hide-only label for a11y */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.kd-card {
  width: 100%;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.kd-header {
  background: #fdecc8; /* soft warm tint like screenshot */
  padding: 12px 16px;
  font-weight: 600;
}
.kd-body {
  padding: 6px 0;
}

.kd-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}
.kd-table tbody tr {
  border-top: 1px solid #f5f5f5;
}
.kd-table tbody tr:first-child {
  border-top: none;
}

.kd-word,
.kd-count,
.kd-pct {
  padding: 10px 16px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Columns: word left, count middle, pct right */
.kd-word {
  color: #333;
  font-weight: 600;
  text-align: left;
}
.kd-count {
  color: #22a559;
  font-weight: 700;
  text-align: right;
  width: 56px;
}
.kd-pct {
  color: #777;
  text-align: right;
  width: 70px;
}

/* Screen-reader only (keeps table semantics) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.limit-hit {
  outline: 2px solid #e86a6a;
  outline-offset: 2px;
  transition: outline-color 0.2s ease;
}

/* --- Tooltips --- */
.tooltip {
  position: absolute; /* was: fixed */
  z-index: 9999;
  max-width: 280px;
  padding: 8px 10px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tooltip[data-show="true"] {
  opacity: 1;
  transform: translateY(0);
}
/* Left-edge, vertically centered arrow */
.tooltip .tip-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #1f2937;
  left: -4px; /* poke out the left edge */
  top: var(--arrow-top, 50%); /* set by JS; default center */
  transform: translateY(-50%) rotate(-45deg); /* point left */
}

@media (hover: none) and (pointer: coarse) {
  /* Slightly larger on touch screens (when triggered via focus/click) */
  .tooltip {
    font-size: 13px;
  }
}

.btn-copy,
.btn-clear {
  background-color: #000;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 10px;
  font-weight: bold;
  margin-top: 10px;
  width: 48%;
  transition: background-color 0.2s ease;
}

.heading-with-tiles {
  font-size: 2em;
  text-align: left;
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  align-items: center;
}

.scrabble-title {
  display: inline-flex;
  gap: 5px;
  margin: 0 10px;
}

.scrabble-title .tile {
  background: #f4b860;
  color: #000;
  font-family: "Space Grotesk", sans-serif !important;
  font-size: 0.7em;
  font-weight: bold;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.scrabble-title .score {
  font-size: 0.6em;
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-weight: normal;
}

@media (max-width: 900px) {
  .metrics-panel,
  .kd-card {
    margin-top: 12px; /* add small gap when stacked */
  }
}
