/* /tools/ calculators and level tests. The buttons reuse
   the .date-btn look from dates.css, restated here so the pages need one file. */

.date-btn {
  display: inline-block;
  text-decoration: none;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.date-btn:hover { border-color: rgba(70, 164, 248, 0.7); }
.date-btn.primary { background: rgb(70, 164, 248); border-color: rgb(70, 164, 248); color: #000; font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; }

.tool-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgb(52 52 52 / 60%);
  border-radius: 18px;
}

.field { display: grid; gap: 0.4rem; margin-bottom: 1.1rem; text-align: left; }
.field label { font-size: 0.85rem; color: var(--text-gray); letter-spacing: 0.02em; }
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0b0d14;
  color: var(--text-light);
  font: inherit;
  font-size: 1rem;
}
.field textarea { min-height: 7rem; resize: vertical; font-size: 0.95rem; }
.field input[type=range] { width: 100%; accent-color: rgb(70, 164, 248); }
.field .value { color: #7ec8f4; font-weight: 600; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1.2rem; }

.result {
  margin-top: 0.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}
.result .big {
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  font-weight: 700;
  color: #eaf4ff;
  text-shadow: 0 0 26px rgba(70, 164, 248, 0.45);
  line-height: 1.1;
}
.result .sub { color: var(--text-gray); margin-top: 0.5rem; font-size: 0.95rem; }
.result .note { color: var(--text-gray); margin-top: 1rem; font-size: 0.85rem; }

.method { max-width: 760px; margin: 0 auto; }
.method p, .method li { color: rgba(255, 255, 255, 0.88); line-height: 1.7; }
.method a, .method a:visited, .note a { color: #7ec8f4; }
.method ol > li { margin-bottom: 0.8rem; }
.method ul ul { margin: 0.3rem 0 0.4rem; }
.method code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  color: #7ec8f4;
}

.fsi-table { width: 100%; max-width: 760px; margin: 0 auto; border-collapse: collapse; }
.fsi-table th, .fsi-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
  font-size: 0.95rem;
}
.fsi-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-gray); font-weight: 500; }
.fsi-table a { color: #7ec8f4; }

/* Level test ----------------------------------------------------------- */

.result-cta {
  margin-top: 1.8rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.result-cta p { margin: 0; color: var(--text-light); font-size: 1rem; }
.result-cta .store-badge img { height: 48px; width: auto; display: block; }
.lt-progress { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; margin-bottom: 1.4rem; }
.lt-progress span { display: block; height: 100%; width: 0; background: rgb(70, 164, 248); transition: width 0.3s ease; }
.lt-count { font-size: 0.8rem; color: var(--text-gray); text-align: center; margin-bottom: 0.4rem; }
.lt-word { text-align: center; font-size: clamp(2rem, 8vw, 3rem); font-weight: 700; color: #eaf4ff; line-height: 1.2; }
.lt-roman { text-align: center; color: var(--text-gray); margin-top: 0.3rem; min-height: 1.3rem; }
.lt-options { display: grid; gap: 0.6rem; margin-top: 1.6rem; }
.lt-option {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-light);
  font: inherit;
  font-size: 1.02rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.lt-option:hover { border-color: rgba(70, 164, 248, 0.7); }
.lt-option.right { border-color: #3ecf8e; background: rgba(62, 207, 142, 0.12); }
.lt-option.wrong { border-color: #ff6b6b; background: rgba(255, 107, 107, 0.12); }
.lt-option.skip { color: var(--text-gray); border-style: dashed; }
.lt-bars { display: grid; gap: 0.5rem; max-width: 420px; margin: 1.6rem auto 0; }
.lt-bar { display: grid; grid-template-columns: 2.4rem 1fr 3rem; gap: 0.6rem; align-items: center; font-size: 0.9rem; }
.lt-bar .track { height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 6px; overflow: hidden; }
.lt-bar .track, .lt-bar .fill { display: block; }
.lt-bar .fill { height: 100%; background: rgb(70, 164, 248); border-radius: 6px; }
.lt-bar .pct { color: var(--text-gray); text-align: right; }
.lang-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; max-width: 900px; margin: 0 auto; }
/* Calculator components ------------------------------------------------ */

.field-label { font-size: 0.85rem; color: var(--text-gray); letter-spacing: 0.02em; }
.opt-flag { width: 24px; height: 16px; border-radius: 3px; object-fit: cover; flex: 0 0 auto; }
.opt-code {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.1); color: var(--text-gray);
}

.picker { position: relative; }
.picker-btn, .chips-field {
  width: 100%;
  min-height: 46px;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0b0d14;
  color: var(--text-light);
  font: inherit; font-size: 1rem; text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.picker-btn:hover, .chips-field:hover, .picker.open .picker-btn, .picker.open .chips-field { border-color: rgba(70, 164, 248, 0.7); }
.picker-btn:focus-visible, .chip-add:focus-visible, .seg button:focus-visible { outline: 2px solid rgb(70, 164, 248); outline-offset: 2px; }
.picker-value { display: inline-flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; }
.chev { width: 12px; height: 8px; color: var(--text-gray); transition: transform 0.15s ease; }
.picker.open .chev { transform: rotate(180deg); }

.picker-pop {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  background: #10131c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  padding: 0.4rem;
}
.picker-search {
  width: 100%; margin-bottom: 0.3rem;
  padding: 0.55rem 0.7rem; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12); background: #0b0d14;
  color: var(--text-light); font: inherit; font-size: 0.95rem;
}
.picker-pop ul { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.picker-pop li {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer;
  color: var(--text-light); font-size: 0.95rem;
}
.picker-pop li[hidden] { display: none; }
.picker-pop li.active { background: rgba(70, 164, 248, 0.14); }
.picker-pop li[aria-selected="true"] { color: #7ec8f4; font-weight: 600; }
.picker-pop li .tick { margin-left: auto; visibility: hidden; color: #7ec8f4; }
.picker-pop li[aria-selected="true"] .tick { visibility: visible; }

.chips-field { flex-wrap: wrap; cursor: text; }
.chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.3rem 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(70, 164, 248, 0.14);
  border: 1px solid rgba(70, 164, 248, 0.45);
  font-size: 0.88rem;
}
.chip .opt-flag { width: 18px; height: 12px; }
.chip-x {
  border: 0; background: transparent; color: var(--text-gray);
  font: inherit; font-size: 1rem; line-height: 1; padding: 0 0.3rem; cursor: pointer; border-radius: 999px;
}
.chip-x:hover { color: var(--text-light); }
.chip-add {
  border: 1px dashed rgba(255, 255, 255, 0.25); background: transparent;
  color: var(--text-gray); font: inherit; font-size: 0.9rem;
  padding: 0.25rem 0.7rem; border-radius: 999px; cursor: pointer;
}
.chip-add:hover { color: var(--text-light); border-color: rgba(70, 164, 248, 0.7); }

.seg {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.4rem;
  padding: 0.3rem; border-radius: 12px; background: #0b0d14;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.seg button {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  padding: 0.55rem 0.4rem; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text-gray); font: inherit; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg button b { font-size: 0.98rem; color: var(--text-light); }
.seg button span { font-size: 0.75rem; }
.seg button:hover { background: rgba(255, 255, 255, 0.05); }
.seg button[aria-checked="true"] {
  background: rgba(70, 164, 248, 0.18); border-color: rgba(70, 164, 248, 0.6); color: #cfe7fb;
}

.tool-card .field-row { align-items: start; }
.seg.compact { grid-template-columns: repeat(5, 1fr); }
.seg.compact button { padding: 0.55rem 0.2rem; }
.seg.compact button b { white-space: nowrap; }
@media (max-width: 480px) { .seg.compact { grid-template-columns: repeat(3, 1fr); } }
.field-group {
  margin: 0.4rem 0 1.1rem; padding: 1rem 1rem 0.2rem;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08);
}
.field .hint { font-size: 0.8rem; color: var(--text-gray); }
.group-title { display: block; font-weight: 600; margin-bottom: 0.8rem; color: var(--text-light); }
.lang-grid a { display: inline-flex; align-items: center; gap: 0.5rem; }
.hidden { display: none !important; }
