/* Token 工具沿用落地页的色板，只补充双栏计算工作台。 */
.token-estimator-page {
  color: var(--text-primary);
}

.token-estimator-shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(46px, 7vw, 88px) 0 56px;
}

.token-estimator-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: clamp(28px, 6vw, 84px);
  align-items: end;
  margin-bottom: 30px;
}

.token-estimator-intro h1,
.token-estimator-explain h2,
.token-estimator-cta h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  letter-spacing: 0;
}

.token-estimator-intro h1 {
  font-size: clamp(2.35rem, 5.4vw, 4.7rem);
  line-height: 1.08;
}

.token-estimator-intro h1 em {
  color: var(--accent-amber);
  font-style: normal;
}

.token-estimator-intro p,
.token-estimator-explain p,
.token-estimator-cta p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.9;
}

.token-estimator-intro aside {
  padding: 20px 0 20px 20px;
  border-left: 2px solid var(--accent-amber);
}

.token-estimator-intro aside strong {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.token-estimator-intro aside p {
  font-size: 0.82rem;
  line-height: 1.8;
}

/* 控制栏始终是 flex；窄屏时只换行，不改成纵向的独立布局。 */
.token-estimator-controlbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  margin-bottom: 12px;
}

.token-estimator-model-controls {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.token-estimator-combo {
  position: relative;
  display: flex;
  flex: 0 1 220px;
  flex-direction: column;
  gap: 5px;
  min-width: 180px;
}

.token-estimator-combo-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.token-estimator-select,
.token-estimator-clear {
  min-height: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  background: rgba(17, 17, 24, 0.96);
  color: var(--text-primary);
  font-size: 0.78rem;
}

.token-estimator-select {
  width: 100%;
  padding: 0 34px 0 12px;
  text-align: left;
}

.token-estimator-select--native-hidden {
  display: none;
}

.token-estimator-combo-trigger {
  position: relative;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease;
}

.token-estimator-combo-trigger::after {
  position: absolute;
  top: calc(50% - 3px);
  right: 13px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  opacity: 0.72;
  pointer-events: none;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.token-estimator-combo-trigger[aria-expanded="true"]::after {
  transform: translateY(3px) rotate(225deg);
}

.token-estimator-combo-trigger:hover:not(:disabled) {
  border-color: rgba(232, 180, 75, 0.5);
  background: rgba(232, 180, 75, 0.08);
}

.token-estimator-select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.token-estimator-combo-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 30;
  display: flex;
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  scrollbar-color: rgba(232, 180, 75, 0.55) rgba(255, 255, 255, 0.035);
  scrollbar-width: thin;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  background: rgba(17, 17, 24, 0.99);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.token-estimator-combo-menu::-webkit-scrollbar {
  width: 9px;
}

.token-estimator-combo-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
}

.token-estimator-combo-menu::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(232, 180, 75, 0.55);
  background-clip: padding-box;
}

.token-estimator-combo-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(232, 180, 75, 0.78);
  background-clip: padding-box;
}

.token-estimator-combo-menu[hidden] {
  display: none;
}

.token-estimator-combo-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.token-estimator-combo-option {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.76rem;
  text-align: left;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.token-estimator-combo-option:hover,
.token-estimator-combo-option.is-active {
  color: var(--text-primary);
  background: rgba(232, 180, 75, 0.1);
}

.token-estimator-select:focus-visible,
.token-estimator-clear:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 2px;
}

.token-estimator-clear {
  padding: 0 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.token-estimator-clear:hover {
  border-color: rgba(232, 180, 75, 0.5);
  color: var(--text-primary);
  background: rgba(232, 180, 75, 0.08);
}

.token-estimator-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, 0.72fr);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: rgba(17, 17, 24, 0.88);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.token-estimator-editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  border-right: 1px solid var(--border-subtle);
  background: rgba(7, 8, 12, 0.72);
}

.token-estimator-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.token-estimator-panel-top strong,
.token-estimator-result-head h2,
.token-estimator-price-overview h3 {
  font-family: var(--font-display);
}

.token-estimator-panel-top span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.token-estimator-editor-panel textarea {
  width: 100%;
  min-width: 0;
  min-height: 480px;
  resize: vertical;
  padding: 27px 28px 32px;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
  caret-color: var(--accent-amber);
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.95;
}

.token-estimator-editor-panel textarea::placeholder {
  color: var(--text-muted);
}

/* 输入区与 AI 味检测工具使用同一套细滚动条，避免浏览器默认滑轨突兀。 */
.token-estimator-editor-panel textarea {
  scrollbar-color: rgba(232, 180, 75, 0.55) rgba(255, 255, 255, 0.035);
  scrollbar-width: thin;
}

.token-estimator-editor-panel textarea::-webkit-scrollbar {
  width: 9px;
}

.token-estimator-editor-panel textarea::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(232, 180, 75, 0.5);
  background-clip: padding-box;
}

.token-estimator-text-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.014);
}

.token-estimator-text-stats div {
  padding: 15px 18px;
  border-right: 1px solid var(--border-subtle);
}

.token-estimator-text-stats div:last-child {
  border-right: 0;
}

.token-estimator-text-stats b {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.15;
}

.token-estimator-text-stats span {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.token-estimator-result-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.token-estimator-result-head {
  padding: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.token-estimator-result-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.token-estimator-result-head p {
  min-height: 1.4em;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.token-estimator-token-block {
  padding: 27px 22px 23px;
  border-bottom: 1px solid var(--border-subtle);
}

.token-estimator-token-block > span,
.token-estimator-cost-compare span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.token-estimator-token-block > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.token-estimator-token-block strong {
  color: var(--accent-amber);
  font-family: var(--font-display);
  font-size: clamp(2.65rem, 4vw, 4.2rem);
  line-height: 1;
}

.token-estimator-token-block b {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
}

.token-estimator-token-block small {
  display: block;
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.token-estimator-cost-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
}

.token-estimator-cost-compare > div {
  min-width: 0;
  padding: 19px 20px;
}

.token-estimator-cost-compare > div + div {
  border-left: 1px solid var(--border-subtle);
}

.token-estimator-cost-compare strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-estimator-cost-compare small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.62rem;
}

.token-estimator-cost-cache strong {
  color: var(--accent-teal);
}

.token-estimator-price-overview {
  padding: 18px 20px 12px;
}

.token-estimator-price-overview h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.token-estimator-price-overview > p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.token-estimator-price-list {
  border-top: 1px solid var(--border-subtle);
}

.token-estimator-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  border-bottom: 1px solid var(--border-subtle);
}

.token-estimator-price-row span {
  color: var(--text-muted);
  font-size: 0.69rem;
}

.token-estimator-price-row strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 400;
}

.token-estimator-price-row[data-kind="cache"] strong {
  color: var(--accent-teal);
}

.token-estimator-price-row[data-kind="output"] strong {
  color: #c9b782;
}

.token-estimator-source-box {
  margin: auto 20px 20px;
  padding: 12px 13px;
  border-left: 2px solid var(--accent-teal);
  background: rgba(77, 184, 176, 0.045);
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.65;
}

.token-estimator-source-box a {
  color: var(--text-primary);
  border-bottom: 1px solid rgba(238, 234, 227, 0.3);
}

.token-estimator-source-box a[aria-disabled="true"] {
  border-bottom: 0;
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
}

.token-estimator-explain {
  margin-top: clamp(56px, 7vw, 82px);
  padding: 28px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.token-estimator-explain > div:first-child {
  max-width: 760px;
  margin-bottom: 26px;
}

.token-estimator-explain h2,
.token-estimator-cta h2 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
}

.token-estimator-explain-list article {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 28px;
  padding: 17px 0;
  border-top: 1px solid var(--border-subtle);
}

.token-estimator-explain-list h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.token-estimator-explain-list p {
  font-size: 0.78rem;
  line-height: 1.85;
}

.token-estimator-cta {
  display: grid;
  justify-items: center;
  gap: 20px;
  margin-top: clamp(64px, 9vw, 112px);
  padding: 34px clamp(18px, 4vw, 56px) 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.token-estimator-cta > div:first-child {
  max-width: 650px;
}

.token-estimator-cta > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.token-estimator-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: var(--weight-bold);
}

.token-estimator-button:hover {
  border-color: rgba(232, 180, 75, 0.5);
  background: rgba(232, 180, 75, 0.08);
}

.token-estimator-button-primary {
  border-color: var(--accent-amber);
  background: var(--accent-amber);
  color: var(--bg-deep);
}

.token-estimator-button-primary:hover {
  background: #f0c55e;
  color: var(--bg-deep);
}

.token-estimator-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.67rem;
}

.token-estimator-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .token-estimator-intro,
  .token-estimator-workbench {
    grid-template-columns: 1fr;
  }

  .token-estimator-editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .token-estimator-result-panel {
    min-height: 500px;
  }
}

@media (max-width: 680px) {
  .token-estimator-shell,
  .token-estimator-footer {
    width: calc(100% - 34px);
  }

  .token-estimator-controlbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .token-estimator-model-controls {
    width: 100%;
  }

  .token-estimator-combo {
    flex: 1 1 150px;
    min-width: 0;
  }

  .token-estimator-combo-label {
    display: none;
  }

  .token-estimator-select {
    min-width: 0;
  }

  .token-estimator-clear {
    flex: 1 1 100%;
  }

  .token-estimator-editor-panel textarea {
    min-height: 360px;
    padding: 22px 20px 30px;
  }

  .token-estimator-text-stats div {
    padding: 13px 12px;
  }

  .token-estimator-cost-compare,
  .token-estimator-explain-list article {
    grid-template-columns: 1fr;
  }

  .token-estimator-cost-compare > div + div {
    border-top: 1px solid var(--border-subtle);
    border-left: 0;
  }

  .token-estimator-explain-list article {
    gap: 7px;
  }

  .token-estimator-footer {
    display: grid;
  }
}
