.kline-fs-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: calc(12px * var(--fs, 1));
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}

.kline-fs-btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.kline-fs-btn:hover {
  border-color: var(--brand-blue);
  color: var(--text);
}

.kline-fs-btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.kline-fs-btn[hidden] {
  display: none;
}

.kfs-placeholder {
  display: block;
}

.kfs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483420;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html.kfs-open .toast-stack {
  z-index: 2147483450 !important;
}

.kfs-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  display: flex;
  flex-direction: row;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  transition: opacity 160ms ease;
}

.kfs-rot .kfs-stage {
  padding: env(safe-area-inset-right, 0px) max(env(safe-area-inset-bottom, 0px), 14px) env(safe-area-inset-left, 0px) env(safe-area-inset-top, 0px);
}

.kfs-port .kfs-stage {
  flex-direction: column;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px);
}

.kfs-pending .kfs-stage {
  opacity: 0;
}

.kfs-wait {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(13px * var(--fs, 1));
  color: var(--text-muted);
}

.kfs-pending .kfs-wait {
  display: flex;
}

.kfs-overlay .kfs-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 8px 12px 6px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.kfs-bar {
  order: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0 0 4px;
}

.kfs-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.kfs-title-main {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: calc(15px * var(--fs, 1));
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.kfs-title-unit {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(var(--surface-tint-rgb), 0.07);
  font-size: calc(12px * var(--fs, 1));
  font-weight: 800;
  color: var(--text);
}

.kfs-title-unit:empty {
  display: none;
}

.kfs-title-range {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: calc(11.5px * var(--fs, 1));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.kfs-port .kfs-title {
  flex-wrap: wrap;
  row-gap: 1px;
}

.kfs-port .kfs-title-range {
  flex: 1 0 100%;
  font-size: calc(11px * var(--fs, 1));
}

.kfs-tools {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.kfs-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: calc(13px * var(--fs, 1));
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}

.kfs-tool[hidden] {
  display: none;
}

.kfs-tool svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.kfs-tool:hover {
  border-color: var(--brand-blue);
}

.kfs-tool:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.kfs-tool.kfs-gear.active {
  background: var(--brand-gradient);
  border-color: transparent;
  color: var(--on-accent);
}

.kfs-port .kfs-tools {
  gap: 6px;
}

.kfs-port .kfs-tool {
  width: 36px;
  height: 34px;
  padding: 0;
}

.kfs-port .kfs-tool svg {
  width: 17px;
  height: 17px;
}

.kfs-port .kfs-tool span {
  display: none;
}

.kfs-panel {
  flex: 0 0 var(--kfs-panel-w, 300px);
  width: var(--kfs-panel-w, 300px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-left: 1px solid var(--border-strong);
  box-shadow: -10px 0 28px rgba(var(--shadow-rgb), 0.22);
  -webkit-user-select: none;
  user-select: none;
}

.kfs-panel[hidden] {
  display: none;
}

.kfs-port .kfs-panel {
  flex: 0 0 var(--kfs-panel-h, 46%);
  width: auto;
  height: var(--kfs-panel-h, 46%);
  margin: 0 -1px;
  border-left: 0;
  border-top: 1px solid var(--border-strong);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 28px rgba(var(--shadow-rgb), 0.22);
}

.kfs-panel-hd {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 9px 16px;
  border-bottom: 1px solid var(--border);
}

.kfs-panel-hd strong {
  font-size: calc(14px * var(--fs, 1));
  font-weight: 800;
  color: var(--text);
}

.kfs-panel-done {
  min-height: 30px;
  padding: 4px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: var(--on-accent);
  font-family: inherit;
  font-size: calc(12.5px * var(--fs, 1));
  font-weight: 800;
  cursor: pointer;
}

.kfs-panel-done:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.kfs-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding: 2px 14px 18px;
  scrollbar-width: thin;
}

.kfs-sec {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.kfs-sec:last-child {
  border-bottom: 0;
}

.kfs-sec-title {
  margin: 0 0 9px;
  font-size: calc(11.5px * var(--fs, 1));
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kfs-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--overlay-surface-border);
  background: var(--overlay-surface);
  color: var(--on-overlay);
  font-size: calc(13px * var(--fs, 1));
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 220ms ease, transform 220ms ease;
}

.kfs-hint.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.kfs-hint svg {
  width: 20px;
  height: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .kfs-stage,
  .kfs-hint {
    transition: none;
  }
}
